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 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
796}
797
798impl FileLocation {
799 pub fn new() -> Self {
800 std::default::Default::default()
801 }
802
803 /// Sets the value of [file_path][crate::model::FileLocation::file_path].
804 ///
805 /// # Example
806 /// ```ignore,no_run
807 /// # use google_cloud_grafeas_v1::model::FileLocation;
808 /// let x = FileLocation::new().set_file_path("example");
809 /// ```
810 pub fn set_file_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
811 self.file_path = v.into();
812 self
813 }
814
815 /// Sets the value of [layer_details][crate::model::FileLocation::layer_details].
816 ///
817 /// # Example
818 /// ```ignore,no_run
819 /// # use google_cloud_grafeas_v1::model::FileLocation;
820 /// use google_cloud_grafeas_v1::model::LayerDetails;
821 /// let x = FileLocation::new().set_layer_details(LayerDetails::default()/* use setters */);
822 /// ```
823 pub fn set_layer_details<T>(mut self, v: T) -> Self
824 where
825 T: std::convert::Into<crate::model::LayerDetails>,
826 {
827 self.layer_details = std::option::Option::Some(v.into());
828 self
829 }
830
831 /// Sets or clears the value of [layer_details][crate::model::FileLocation::layer_details].
832 ///
833 /// # Example
834 /// ```ignore,no_run
835 /// # use google_cloud_grafeas_v1::model::FileLocation;
836 /// use google_cloud_grafeas_v1::model::LayerDetails;
837 /// let x = FileLocation::new().set_or_clear_layer_details(Some(LayerDetails::default()/* use setters */));
838 /// let x = FileLocation::new().set_or_clear_layer_details(None::<LayerDetails>);
839 /// ```
840 pub fn set_or_clear_layer_details<T>(mut self, v: std::option::Option<T>) -> Self
841 where
842 T: std::convert::Into<crate::model::LayerDetails>,
843 {
844 self.layer_details = v.map(|x| x.into());
845 self
846 }
847}
848
849impl wkt::message::Message for FileLocation {
850 fn typename() -> &'static str {
851 "type.googleapis.com/grafeas.v1.FileLocation"
852 }
853}
854
855/// BaseImage describes a base image of a container image.
856#[derive(Clone, Default, PartialEq)]
857#[non_exhaustive]
858pub struct BaseImage {
859 /// The name of the base image.
860 pub name: std::string::String,
861
862 /// The repository name in which the base image is from.
863 pub repository: std::string::String,
864
865 /// The number of layers that the base image is composed of.
866 pub layer_count: i32,
867
868 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
869}
870
871impl BaseImage {
872 pub fn new() -> Self {
873 std::default::Default::default()
874 }
875
876 /// Sets the value of [name][crate::model::BaseImage::name].
877 ///
878 /// # Example
879 /// ```ignore,no_run
880 /// # use google_cloud_grafeas_v1::model::BaseImage;
881 /// let x = BaseImage::new().set_name("example");
882 /// ```
883 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
884 self.name = v.into();
885 self
886 }
887
888 /// Sets the value of [repository][crate::model::BaseImage::repository].
889 ///
890 /// # Example
891 /// ```ignore,no_run
892 /// # use google_cloud_grafeas_v1::model::BaseImage;
893 /// let x = BaseImage::new().set_repository("example");
894 /// ```
895 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
896 self.repository = v.into();
897 self
898 }
899
900 /// Sets the value of [layer_count][crate::model::BaseImage::layer_count].
901 ///
902 /// # Example
903 /// ```ignore,no_run
904 /// # use google_cloud_grafeas_v1::model::BaseImage;
905 /// let x = BaseImage::new().set_layer_count(42);
906 /// ```
907 pub fn set_layer_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
908 self.layer_count = v.into();
909 self
910 }
911}
912
913impl wkt::message::Message for BaseImage {
914 fn typename() -> &'static str {
915 "type.googleapis.com/grafeas.v1.BaseImage"
916 }
917}
918
919/// Details about the layer a package was found in.
920#[derive(Clone, Default, PartialEq)]
921#[non_exhaustive]
922pub struct LayerDetails {
923 /// The index of the layer in the container image.
924 pub index: i32,
925
926 /// The diff ID (typically a sha256 hash) of the layer in the container image.
927 pub diff_id: std::string::String,
928
929 /// The layer chain ID (sha256 hash) of the layer in the container image.
930 /// <https://github.com/opencontainers/image-spec/blob/main/config.md#layer-chainid>
931 pub chain_id: std::string::String,
932
933 /// The layer build command that was used to build the layer. This may not be
934 /// found in all layers depending on how the container image is built.
935 pub command: std::string::String,
936
937 /// The base images the layer is found within.
938 pub base_images: std::vec::Vec<crate::model::BaseImage>,
939
940 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
941}
942
943impl LayerDetails {
944 pub fn new() -> Self {
945 std::default::Default::default()
946 }
947
948 /// Sets the value of [index][crate::model::LayerDetails::index].
949 ///
950 /// # Example
951 /// ```ignore,no_run
952 /// # use google_cloud_grafeas_v1::model::LayerDetails;
953 /// let x = LayerDetails::new().set_index(42);
954 /// ```
955 pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
956 self.index = v.into();
957 self
958 }
959
960 /// Sets the value of [diff_id][crate::model::LayerDetails::diff_id].
961 ///
962 /// # Example
963 /// ```ignore,no_run
964 /// # use google_cloud_grafeas_v1::model::LayerDetails;
965 /// let x = LayerDetails::new().set_diff_id("example");
966 /// ```
967 pub fn set_diff_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
968 self.diff_id = v.into();
969 self
970 }
971
972 /// Sets the value of [chain_id][crate::model::LayerDetails::chain_id].
973 ///
974 /// # Example
975 /// ```ignore,no_run
976 /// # use google_cloud_grafeas_v1::model::LayerDetails;
977 /// let x = LayerDetails::new().set_chain_id("example");
978 /// ```
979 pub fn set_chain_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
980 self.chain_id = v.into();
981 self
982 }
983
984 /// Sets the value of [command][crate::model::LayerDetails::command].
985 ///
986 /// # Example
987 /// ```ignore,no_run
988 /// # use google_cloud_grafeas_v1::model::LayerDetails;
989 /// let x = LayerDetails::new().set_command("example");
990 /// ```
991 pub fn set_command<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
992 self.command = v.into();
993 self
994 }
995
996 /// Sets the value of [base_images][crate::model::LayerDetails::base_images].
997 ///
998 /// # Example
999 /// ```ignore,no_run
1000 /// # use google_cloud_grafeas_v1::model::LayerDetails;
1001 /// use google_cloud_grafeas_v1::model::BaseImage;
1002 /// let x = LayerDetails::new()
1003 /// .set_base_images([
1004 /// BaseImage::default()/* use setters */,
1005 /// BaseImage::default()/* use (different) setters */,
1006 /// ]);
1007 /// ```
1008 pub fn set_base_images<T, V>(mut self, v: T) -> Self
1009 where
1010 T: std::iter::IntoIterator<Item = V>,
1011 V: std::convert::Into<crate::model::BaseImage>,
1012 {
1013 use std::iter::Iterator;
1014 self.base_images = v.into_iter().map(|i| i.into()).collect();
1015 self
1016 }
1017}
1018
1019impl wkt::message::Message for LayerDetails {
1020 fn typename() -> &'static str {
1021 "type.googleapis.com/grafeas.v1.LayerDetails"
1022 }
1023}
1024
1025/// License information.
1026#[derive(Clone, Default, PartialEq)]
1027#[non_exhaustive]
1028pub struct License {
1029 /// Often a single license can be used to represent the licensing terms.
1030 /// Sometimes it is necessary to include a choice of one or more licenses
1031 /// or some combination of license identifiers.
1032 /// Examples: "LGPL-2.1-only OR MIT", "LGPL-2.1-only AND MIT",
1033 /// "GPL-2.0-or-later WITH Bison-exception-2.2".
1034 pub expression: std::string::String,
1035
1036 /// Comments
1037 pub comments: std::string::String,
1038
1039 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1040}
1041
1042impl License {
1043 pub fn new() -> Self {
1044 std::default::Default::default()
1045 }
1046
1047 /// Sets the value of [expression][crate::model::License::expression].
1048 ///
1049 /// # Example
1050 /// ```ignore,no_run
1051 /// # use google_cloud_grafeas_v1::model::License;
1052 /// let x = License::new().set_expression("example");
1053 /// ```
1054 pub fn set_expression<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1055 self.expression = v.into();
1056 self
1057 }
1058
1059 /// Sets the value of [comments][crate::model::License::comments].
1060 ///
1061 /// # Example
1062 /// ```ignore,no_run
1063 /// # use google_cloud_grafeas_v1::model::License;
1064 /// let x = License::new().set_comments("example");
1065 /// ```
1066 pub fn set_comments<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1067 self.comments = v.into();
1068 self
1069 }
1070}
1071
1072impl wkt::message::Message for License {
1073 fn typename() -> &'static str {
1074 "type.googleapis.com/grafeas.v1.License"
1075 }
1076}
1077
1078/// Digest information.
1079#[derive(Clone, Default, PartialEq)]
1080#[non_exhaustive]
1081pub struct Digest {
1082 /// `SHA1`, `SHA512` etc.
1083 pub algo: std::string::String,
1084
1085 /// Value of the digest.
1086 pub digest_bytes: ::bytes::Bytes,
1087
1088 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1089}
1090
1091impl Digest {
1092 pub fn new() -> Self {
1093 std::default::Default::default()
1094 }
1095
1096 /// Sets the value of [algo][crate::model::Digest::algo].
1097 ///
1098 /// # Example
1099 /// ```ignore,no_run
1100 /// # use google_cloud_grafeas_v1::model::Digest;
1101 /// let x = Digest::new().set_algo("example");
1102 /// ```
1103 pub fn set_algo<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1104 self.algo = v.into();
1105 self
1106 }
1107
1108 /// Sets the value of [digest_bytes][crate::model::Digest::digest_bytes].
1109 ///
1110 /// # Example
1111 /// ```ignore,no_run
1112 /// # use google_cloud_grafeas_v1::model::Digest;
1113 /// let x = Digest::new().set_digest_bytes(bytes::Bytes::from_static(b"example"));
1114 /// ```
1115 pub fn set_digest_bytes<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1116 self.digest_bytes = v.into();
1117 self
1118 }
1119}
1120
1121impl wkt::message::Message for Digest {
1122 fn typename() -> &'static str {
1123 "type.googleapis.com/grafeas.v1.Digest"
1124 }
1125}
1126
1127#[derive(Clone, Default, PartialEq)]
1128#[non_exhaustive]
1129pub struct ComplianceNote {
1130 /// The title that identifies this compliance check.
1131 pub title: std::string::String,
1132
1133 /// A description about this compliance check.
1134 pub description: std::string::String,
1135
1136 /// The OS and config versions the benchmark applies to.
1137 pub version: std::vec::Vec<crate::model::ComplianceVersion>,
1138
1139 /// A rationale for the existence of this compliance check.
1140 pub rationale: std::string::String,
1141
1142 /// A description of remediation steps if the compliance check fails.
1143 pub remediation: std::string::String,
1144
1145 /// Serialized scan instructions with a predefined format.
1146 pub scan_instructions: ::bytes::Bytes,
1147
1148 pub compliance_type: std::option::Option<crate::model::compliance_note::ComplianceType>,
1149
1150 /// Potential impact of the suggested remediation
1151 pub potential_impact: std::option::Option<crate::model::compliance_note::PotentialImpact>,
1152
1153 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1154}
1155
1156impl ComplianceNote {
1157 pub fn new() -> Self {
1158 std::default::Default::default()
1159 }
1160
1161 /// Sets the value of [title][crate::model::ComplianceNote::title].
1162 ///
1163 /// # Example
1164 /// ```ignore,no_run
1165 /// # use google_cloud_grafeas_v1::model::ComplianceNote;
1166 /// let x = ComplianceNote::new().set_title("example");
1167 /// ```
1168 pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1169 self.title = v.into();
1170 self
1171 }
1172
1173 /// Sets the value of [description][crate::model::ComplianceNote::description].
1174 ///
1175 /// # Example
1176 /// ```ignore,no_run
1177 /// # use google_cloud_grafeas_v1::model::ComplianceNote;
1178 /// let x = ComplianceNote::new().set_description("example");
1179 /// ```
1180 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1181 self.description = v.into();
1182 self
1183 }
1184
1185 /// Sets the value of [version][crate::model::ComplianceNote::version].
1186 ///
1187 /// # Example
1188 /// ```ignore,no_run
1189 /// # use google_cloud_grafeas_v1::model::ComplianceNote;
1190 /// use google_cloud_grafeas_v1::model::ComplianceVersion;
1191 /// let x = ComplianceNote::new()
1192 /// .set_version([
1193 /// ComplianceVersion::default()/* use setters */,
1194 /// ComplianceVersion::default()/* use (different) setters */,
1195 /// ]);
1196 /// ```
1197 pub fn set_version<T, V>(mut self, v: T) -> Self
1198 where
1199 T: std::iter::IntoIterator<Item = V>,
1200 V: std::convert::Into<crate::model::ComplianceVersion>,
1201 {
1202 use std::iter::Iterator;
1203 self.version = v.into_iter().map(|i| i.into()).collect();
1204 self
1205 }
1206
1207 /// Sets the value of [rationale][crate::model::ComplianceNote::rationale].
1208 ///
1209 /// # Example
1210 /// ```ignore,no_run
1211 /// # use google_cloud_grafeas_v1::model::ComplianceNote;
1212 /// let x = ComplianceNote::new().set_rationale("example");
1213 /// ```
1214 pub fn set_rationale<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1215 self.rationale = v.into();
1216 self
1217 }
1218
1219 /// Sets the value of [remediation][crate::model::ComplianceNote::remediation].
1220 ///
1221 /// # Example
1222 /// ```ignore,no_run
1223 /// # use google_cloud_grafeas_v1::model::ComplianceNote;
1224 /// let x = ComplianceNote::new().set_remediation("example");
1225 /// ```
1226 pub fn set_remediation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1227 self.remediation = v.into();
1228 self
1229 }
1230
1231 /// Sets the value of [scan_instructions][crate::model::ComplianceNote::scan_instructions].
1232 ///
1233 /// # Example
1234 /// ```ignore,no_run
1235 /// # use google_cloud_grafeas_v1::model::ComplianceNote;
1236 /// let x = ComplianceNote::new().set_scan_instructions(bytes::Bytes::from_static(b"example"));
1237 /// ```
1238 pub fn set_scan_instructions<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1239 self.scan_instructions = v.into();
1240 self
1241 }
1242
1243 /// Sets the value of [compliance_type][crate::model::ComplianceNote::compliance_type].
1244 ///
1245 /// Note that all the setters affecting `compliance_type` are mutually
1246 /// exclusive.
1247 ///
1248 /// # Example
1249 /// ```ignore,no_run
1250 /// # use google_cloud_grafeas_v1::model::ComplianceNote;
1251 /// use google_cloud_grafeas_v1::model::compliance_note::CisBenchmark;
1252 /// let x = ComplianceNote::new().set_compliance_type(Some(
1253 /// google_cloud_grafeas_v1::model::compliance_note::ComplianceType::CisBenchmark(CisBenchmark::default().into())));
1254 /// ```
1255 pub fn set_compliance_type<
1256 T: std::convert::Into<std::option::Option<crate::model::compliance_note::ComplianceType>>,
1257 >(
1258 mut self,
1259 v: T,
1260 ) -> Self {
1261 self.compliance_type = v.into();
1262 self
1263 }
1264
1265 /// The value of [compliance_type][crate::model::ComplianceNote::compliance_type]
1266 /// if it holds a `CisBenchmark`, `None` if the field is not set or
1267 /// holds a different branch.
1268 pub fn cis_benchmark(
1269 &self,
1270 ) -> std::option::Option<&std::boxed::Box<crate::model::compliance_note::CisBenchmark>> {
1271 #[allow(unreachable_patterns)]
1272 self.compliance_type.as_ref().and_then(|v| match v {
1273 crate::model::compliance_note::ComplianceType::CisBenchmark(v) => {
1274 std::option::Option::Some(v)
1275 }
1276 _ => std::option::Option::None,
1277 })
1278 }
1279
1280 /// Sets the value of [compliance_type][crate::model::ComplianceNote::compliance_type]
1281 /// to hold a `CisBenchmark`.
1282 ///
1283 /// Note that all the setters affecting `compliance_type` are
1284 /// mutually exclusive.
1285 ///
1286 /// # Example
1287 /// ```ignore,no_run
1288 /// # use google_cloud_grafeas_v1::model::ComplianceNote;
1289 /// use google_cloud_grafeas_v1::model::compliance_note::CisBenchmark;
1290 /// let x = ComplianceNote::new().set_cis_benchmark(CisBenchmark::default()/* use setters */);
1291 /// assert!(x.cis_benchmark().is_some());
1292 /// ```
1293 pub fn set_cis_benchmark<
1294 T: std::convert::Into<std::boxed::Box<crate::model::compliance_note::CisBenchmark>>,
1295 >(
1296 mut self,
1297 v: T,
1298 ) -> Self {
1299 self.compliance_type = std::option::Option::Some(
1300 crate::model::compliance_note::ComplianceType::CisBenchmark(v.into()),
1301 );
1302 self
1303 }
1304
1305 /// Sets the value of [potential_impact][crate::model::ComplianceNote::potential_impact].
1306 ///
1307 /// Note that all the setters affecting `potential_impact` are mutually
1308 /// exclusive.
1309 ///
1310 /// # Example
1311 /// ```ignore,no_run
1312 /// # use google_cloud_grafeas_v1::model::ComplianceNote;
1313 /// use google_cloud_grafeas_v1::model::compliance_note::PotentialImpact;
1314 /// let x = ComplianceNote::new().set_potential_impact(Some(PotentialImpact::Impact("example".to_string())));
1315 /// ```
1316 pub fn set_potential_impact<
1317 T: std::convert::Into<std::option::Option<crate::model::compliance_note::PotentialImpact>>,
1318 >(
1319 mut self,
1320 v: T,
1321 ) -> Self {
1322 self.potential_impact = v.into();
1323 self
1324 }
1325
1326 /// The value of [potential_impact][crate::model::ComplianceNote::potential_impact]
1327 /// if it holds a `Impact`, `None` if the field is not set or
1328 /// holds a different branch.
1329 pub fn impact(&self) -> std::option::Option<&std::string::String> {
1330 #[allow(unreachable_patterns)]
1331 self.potential_impact.as_ref().and_then(|v| match v {
1332 crate::model::compliance_note::PotentialImpact::Impact(v) => {
1333 std::option::Option::Some(v)
1334 }
1335 _ => std::option::Option::None,
1336 })
1337 }
1338
1339 /// Sets the value of [potential_impact][crate::model::ComplianceNote::potential_impact]
1340 /// to hold a `Impact`.
1341 ///
1342 /// Note that all the setters affecting `potential_impact` are
1343 /// mutually exclusive.
1344 ///
1345 /// # Example
1346 /// ```ignore,no_run
1347 /// # use google_cloud_grafeas_v1::model::ComplianceNote;
1348 /// let x = ComplianceNote::new().set_impact("example");
1349 /// assert!(x.impact().is_some());
1350 /// ```
1351 pub fn set_impact<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1352 self.potential_impact = std::option::Option::Some(
1353 crate::model::compliance_note::PotentialImpact::Impact(v.into()),
1354 );
1355 self
1356 }
1357}
1358
1359impl wkt::message::Message for ComplianceNote {
1360 fn typename() -> &'static str {
1361 "type.googleapis.com/grafeas.v1.ComplianceNote"
1362 }
1363}
1364
1365/// Defines additional types related to [ComplianceNote].
1366pub mod compliance_note {
1367 #[allow(unused_imports)]
1368 use super::*;
1369
1370 /// A compliance check that is a CIS benchmark.
1371 #[derive(Clone, Default, PartialEq)]
1372 #[non_exhaustive]
1373 pub struct CisBenchmark {
1374 pub profile_level: i32,
1375
1376 pub severity: crate::model::Severity,
1377
1378 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1379 }
1380
1381 impl CisBenchmark {
1382 pub fn new() -> Self {
1383 std::default::Default::default()
1384 }
1385
1386 /// Sets the value of [profile_level][crate::model::compliance_note::CisBenchmark::profile_level].
1387 ///
1388 /// # Example
1389 /// ```ignore,no_run
1390 /// # use google_cloud_grafeas_v1::model::compliance_note::CisBenchmark;
1391 /// let x = CisBenchmark::new().set_profile_level(42);
1392 /// ```
1393 pub fn set_profile_level<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1394 self.profile_level = v.into();
1395 self
1396 }
1397
1398 /// Sets the value of [severity][crate::model::compliance_note::CisBenchmark::severity].
1399 ///
1400 /// # Example
1401 /// ```ignore,no_run
1402 /// # use google_cloud_grafeas_v1::model::compliance_note::CisBenchmark;
1403 /// use google_cloud_grafeas_v1::model::Severity;
1404 /// let x0 = CisBenchmark::new().set_severity(Severity::Minimal);
1405 /// let x1 = CisBenchmark::new().set_severity(Severity::Low);
1406 /// let x2 = CisBenchmark::new().set_severity(Severity::Medium);
1407 /// ```
1408 pub fn set_severity<T: std::convert::Into<crate::model::Severity>>(mut self, v: T) -> Self {
1409 self.severity = v.into();
1410 self
1411 }
1412 }
1413
1414 impl wkt::message::Message for CisBenchmark {
1415 fn typename() -> &'static str {
1416 "type.googleapis.com/grafeas.v1.ComplianceNote.CisBenchmark"
1417 }
1418 }
1419
1420 #[derive(Clone, Debug, PartialEq)]
1421 #[non_exhaustive]
1422 pub enum ComplianceType {
1423 CisBenchmark(std::boxed::Box<crate::model::compliance_note::CisBenchmark>),
1424 }
1425
1426 /// Potential impact of the suggested remediation
1427 #[derive(Clone, Debug, PartialEq)]
1428 #[non_exhaustive]
1429 pub enum PotentialImpact {
1430 Impact(std::string::String),
1431 }
1432}
1433
1434/// Describes the CIS benchmark version that is applicable to a given OS and
1435/// os version.
1436#[derive(Clone, Default, PartialEq)]
1437#[non_exhaustive]
1438pub struct ComplianceVersion {
1439 /// The CPE URI (<https://cpe.mitre.org/specification/>) this benchmark is
1440 /// applicable to.
1441 pub cpe_uri: std::string::String,
1442
1443 /// The name of the document that defines this benchmark, e.g. "CIS
1444 /// Container-Optimized OS".
1445 pub benchmark_document: std::string::String,
1446
1447 /// The version of the benchmark. This is set to the version of the OS-specific
1448 /// CIS document the benchmark is defined in.
1449 pub version: std::string::String,
1450
1451 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1452}
1453
1454impl ComplianceVersion {
1455 pub fn new() -> Self {
1456 std::default::Default::default()
1457 }
1458
1459 /// Sets the value of [cpe_uri][crate::model::ComplianceVersion::cpe_uri].
1460 ///
1461 /// # Example
1462 /// ```ignore,no_run
1463 /// # use google_cloud_grafeas_v1::model::ComplianceVersion;
1464 /// let x = ComplianceVersion::new().set_cpe_uri("example");
1465 /// ```
1466 pub fn set_cpe_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1467 self.cpe_uri = v.into();
1468 self
1469 }
1470
1471 /// Sets the value of [benchmark_document][crate::model::ComplianceVersion::benchmark_document].
1472 ///
1473 /// # Example
1474 /// ```ignore,no_run
1475 /// # use google_cloud_grafeas_v1::model::ComplianceVersion;
1476 /// let x = ComplianceVersion::new().set_benchmark_document("example");
1477 /// ```
1478 pub fn set_benchmark_document<T: std::convert::Into<std::string::String>>(
1479 mut self,
1480 v: T,
1481 ) -> Self {
1482 self.benchmark_document = v.into();
1483 self
1484 }
1485
1486 /// Sets the value of [version][crate::model::ComplianceVersion::version].
1487 ///
1488 /// # Example
1489 /// ```ignore,no_run
1490 /// # use google_cloud_grafeas_v1::model::ComplianceVersion;
1491 /// let x = ComplianceVersion::new().set_version("example");
1492 /// ```
1493 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1494 self.version = v.into();
1495 self
1496 }
1497}
1498
1499impl wkt::message::Message for ComplianceVersion {
1500 fn typename() -> &'static str {
1501 "type.googleapis.com/grafeas.v1.ComplianceVersion"
1502 }
1503}
1504
1505/// An indication that the compliance checks in the associated ComplianceNote
1506/// were not satisfied for particular resources or a specified reason.
1507#[derive(Clone, Default, PartialEq)]
1508#[non_exhaustive]
1509pub struct ComplianceOccurrence {
1510 pub non_compliant_files: std::vec::Vec<crate::model::NonCompliantFile>,
1511
1512 pub non_compliance_reason: std::string::String,
1513
1514 /// The OS and config version the benchmark was run on.
1515 pub version: std::option::Option<crate::model::ComplianceVersion>,
1516
1517 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1518}
1519
1520impl ComplianceOccurrence {
1521 pub fn new() -> Self {
1522 std::default::Default::default()
1523 }
1524
1525 /// Sets the value of [non_compliant_files][crate::model::ComplianceOccurrence::non_compliant_files].
1526 ///
1527 /// # Example
1528 /// ```ignore,no_run
1529 /// # use google_cloud_grafeas_v1::model::ComplianceOccurrence;
1530 /// use google_cloud_grafeas_v1::model::NonCompliantFile;
1531 /// let x = ComplianceOccurrence::new()
1532 /// .set_non_compliant_files([
1533 /// NonCompliantFile::default()/* use setters */,
1534 /// NonCompliantFile::default()/* use (different) setters */,
1535 /// ]);
1536 /// ```
1537 pub fn set_non_compliant_files<T, V>(mut self, v: T) -> Self
1538 where
1539 T: std::iter::IntoIterator<Item = V>,
1540 V: std::convert::Into<crate::model::NonCompliantFile>,
1541 {
1542 use std::iter::Iterator;
1543 self.non_compliant_files = v.into_iter().map(|i| i.into()).collect();
1544 self
1545 }
1546
1547 /// Sets the value of [non_compliance_reason][crate::model::ComplianceOccurrence::non_compliance_reason].
1548 ///
1549 /// # Example
1550 /// ```ignore,no_run
1551 /// # use google_cloud_grafeas_v1::model::ComplianceOccurrence;
1552 /// let x = ComplianceOccurrence::new().set_non_compliance_reason("example");
1553 /// ```
1554 pub fn set_non_compliance_reason<T: std::convert::Into<std::string::String>>(
1555 mut self,
1556 v: T,
1557 ) -> Self {
1558 self.non_compliance_reason = v.into();
1559 self
1560 }
1561
1562 /// Sets the value of [version][crate::model::ComplianceOccurrence::version].
1563 ///
1564 /// # Example
1565 /// ```ignore,no_run
1566 /// # use google_cloud_grafeas_v1::model::ComplianceOccurrence;
1567 /// use google_cloud_grafeas_v1::model::ComplianceVersion;
1568 /// let x = ComplianceOccurrence::new().set_version(ComplianceVersion::default()/* use setters */);
1569 /// ```
1570 pub fn set_version<T>(mut self, v: T) -> Self
1571 where
1572 T: std::convert::Into<crate::model::ComplianceVersion>,
1573 {
1574 self.version = std::option::Option::Some(v.into());
1575 self
1576 }
1577
1578 /// Sets or clears the value of [version][crate::model::ComplianceOccurrence::version].
1579 ///
1580 /// # Example
1581 /// ```ignore,no_run
1582 /// # use google_cloud_grafeas_v1::model::ComplianceOccurrence;
1583 /// use google_cloud_grafeas_v1::model::ComplianceVersion;
1584 /// let x = ComplianceOccurrence::new().set_or_clear_version(Some(ComplianceVersion::default()/* use setters */));
1585 /// let x = ComplianceOccurrence::new().set_or_clear_version(None::<ComplianceVersion>);
1586 /// ```
1587 pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
1588 where
1589 T: std::convert::Into<crate::model::ComplianceVersion>,
1590 {
1591 self.version = v.map(|x| x.into());
1592 self
1593 }
1594}
1595
1596impl wkt::message::Message for ComplianceOccurrence {
1597 fn typename() -> &'static str {
1598 "type.googleapis.com/grafeas.v1.ComplianceOccurrence"
1599 }
1600}
1601
1602/// Details about files that caused a compliance check to fail.
1603#[derive(Clone, Default, PartialEq)]
1604#[non_exhaustive]
1605pub struct NonCompliantFile {
1606 /// Empty if `display_command` is set.
1607 pub path: std::string::String,
1608
1609 /// Command to display the non-compliant files.
1610 pub display_command: std::string::String,
1611
1612 /// Explains why a file is non compliant for a CIS check.
1613 pub reason: std::string::String,
1614
1615 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1616}
1617
1618impl NonCompliantFile {
1619 pub fn new() -> Self {
1620 std::default::Default::default()
1621 }
1622
1623 /// Sets the value of [path][crate::model::NonCompliantFile::path].
1624 ///
1625 /// # Example
1626 /// ```ignore,no_run
1627 /// # use google_cloud_grafeas_v1::model::NonCompliantFile;
1628 /// let x = NonCompliantFile::new().set_path("example");
1629 /// ```
1630 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1631 self.path = v.into();
1632 self
1633 }
1634
1635 /// Sets the value of [display_command][crate::model::NonCompliantFile::display_command].
1636 ///
1637 /// # Example
1638 /// ```ignore,no_run
1639 /// # use google_cloud_grafeas_v1::model::NonCompliantFile;
1640 /// let x = NonCompliantFile::new().set_display_command("example");
1641 /// ```
1642 pub fn set_display_command<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1643 self.display_command = v.into();
1644 self
1645 }
1646
1647 /// Sets the value of [reason][crate::model::NonCompliantFile::reason].
1648 ///
1649 /// # Example
1650 /// ```ignore,no_run
1651 /// # use google_cloud_grafeas_v1::model::NonCompliantFile;
1652 /// let x = NonCompliantFile::new().set_reason("example");
1653 /// ```
1654 pub fn set_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1655 self.reason = v.into();
1656 self
1657 }
1658}
1659
1660impl wkt::message::Message for NonCompliantFile {
1661 fn typename() -> &'static str {
1662 "type.googleapis.com/grafeas.v1.NonCompliantFile"
1663 }
1664}
1665
1666/// Common Vulnerability Scoring System version 3.
1667/// For details, see <https://www.first.org/cvss/specification-document>
1668#[derive(Clone, Default, PartialEq)]
1669#[non_exhaustive]
1670pub struct CVSSv3 {
1671 /// The base score is a function of the base metric scores.
1672 pub base_score: f32,
1673
1674 pub exploitability_score: f32,
1675
1676 pub impact_score: f32,
1677
1678 /// Base Metrics
1679 /// Represents the intrinsic characteristics of a vulnerability that are
1680 /// constant over time and across user environments.
1681 pub attack_vector: crate::model::cvs_sv_3::AttackVector,
1682
1683 pub attack_complexity: crate::model::cvs_sv_3::AttackComplexity,
1684
1685 pub privileges_required: crate::model::cvs_sv_3::PrivilegesRequired,
1686
1687 pub user_interaction: crate::model::cvs_sv_3::UserInteraction,
1688
1689 pub scope: crate::model::cvs_sv_3::Scope,
1690
1691 pub confidentiality_impact: crate::model::cvs_sv_3::Impact,
1692
1693 pub integrity_impact: crate::model::cvs_sv_3::Impact,
1694
1695 pub availability_impact: crate::model::cvs_sv_3::Impact,
1696
1697 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1698}
1699
1700impl CVSSv3 {
1701 pub fn new() -> Self {
1702 std::default::Default::default()
1703 }
1704
1705 /// Sets the value of [base_score][crate::model::CVSSv3::base_score].
1706 ///
1707 /// # Example
1708 /// ```ignore,no_run
1709 /// # use google_cloud_grafeas_v1::model::CVSSv3;
1710 /// let x = CVSSv3::new().set_base_score(42.0);
1711 /// ```
1712 pub fn set_base_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1713 self.base_score = v.into();
1714 self
1715 }
1716
1717 /// Sets the value of [exploitability_score][crate::model::CVSSv3::exploitability_score].
1718 ///
1719 /// # Example
1720 /// ```ignore,no_run
1721 /// # use google_cloud_grafeas_v1::model::CVSSv3;
1722 /// let x = CVSSv3::new().set_exploitability_score(42.0);
1723 /// ```
1724 pub fn set_exploitability_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1725 self.exploitability_score = v.into();
1726 self
1727 }
1728
1729 /// Sets the value of [impact_score][crate::model::CVSSv3::impact_score].
1730 ///
1731 /// # Example
1732 /// ```ignore,no_run
1733 /// # use google_cloud_grafeas_v1::model::CVSSv3;
1734 /// let x = CVSSv3::new().set_impact_score(42.0);
1735 /// ```
1736 pub fn set_impact_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1737 self.impact_score = v.into();
1738 self
1739 }
1740
1741 /// Sets the value of [attack_vector][crate::model::CVSSv3::attack_vector].
1742 ///
1743 /// # Example
1744 /// ```ignore,no_run
1745 /// # use google_cloud_grafeas_v1::model::CVSSv3;
1746 /// use google_cloud_grafeas_v1::model::cvs_sv_3::AttackVector;
1747 /// let x0 = CVSSv3::new().set_attack_vector(AttackVector::Network);
1748 /// let x1 = CVSSv3::new().set_attack_vector(AttackVector::Adjacent);
1749 /// let x2 = CVSSv3::new().set_attack_vector(AttackVector::Local);
1750 /// ```
1751 pub fn set_attack_vector<T: std::convert::Into<crate::model::cvs_sv_3::AttackVector>>(
1752 mut self,
1753 v: T,
1754 ) -> Self {
1755 self.attack_vector = v.into();
1756 self
1757 }
1758
1759 /// Sets the value of [attack_complexity][crate::model::CVSSv3::attack_complexity].
1760 ///
1761 /// # Example
1762 /// ```ignore,no_run
1763 /// # use google_cloud_grafeas_v1::model::CVSSv3;
1764 /// use google_cloud_grafeas_v1::model::cvs_sv_3::AttackComplexity;
1765 /// let x0 = CVSSv3::new().set_attack_complexity(AttackComplexity::Low);
1766 /// let x1 = CVSSv3::new().set_attack_complexity(AttackComplexity::High);
1767 /// ```
1768 pub fn set_attack_complexity<
1769 T: std::convert::Into<crate::model::cvs_sv_3::AttackComplexity>,
1770 >(
1771 mut self,
1772 v: T,
1773 ) -> Self {
1774 self.attack_complexity = v.into();
1775 self
1776 }
1777
1778 /// Sets the value of [privileges_required][crate::model::CVSSv3::privileges_required].
1779 ///
1780 /// # Example
1781 /// ```ignore,no_run
1782 /// # use google_cloud_grafeas_v1::model::CVSSv3;
1783 /// use google_cloud_grafeas_v1::model::cvs_sv_3::PrivilegesRequired;
1784 /// let x0 = CVSSv3::new().set_privileges_required(PrivilegesRequired::None);
1785 /// let x1 = CVSSv3::new().set_privileges_required(PrivilegesRequired::Low);
1786 /// let x2 = CVSSv3::new().set_privileges_required(PrivilegesRequired::High);
1787 /// ```
1788 pub fn set_privileges_required<
1789 T: std::convert::Into<crate::model::cvs_sv_3::PrivilegesRequired>,
1790 >(
1791 mut self,
1792 v: T,
1793 ) -> Self {
1794 self.privileges_required = v.into();
1795 self
1796 }
1797
1798 /// Sets the value of [user_interaction][crate::model::CVSSv3::user_interaction].
1799 ///
1800 /// # Example
1801 /// ```ignore,no_run
1802 /// # use google_cloud_grafeas_v1::model::CVSSv3;
1803 /// use google_cloud_grafeas_v1::model::cvs_sv_3::UserInteraction;
1804 /// let x0 = CVSSv3::new().set_user_interaction(UserInteraction::None);
1805 /// let x1 = CVSSv3::new().set_user_interaction(UserInteraction::Required);
1806 /// ```
1807 pub fn set_user_interaction<T: std::convert::Into<crate::model::cvs_sv_3::UserInteraction>>(
1808 mut self,
1809 v: T,
1810 ) -> Self {
1811 self.user_interaction = v.into();
1812 self
1813 }
1814
1815 /// Sets the value of [scope][crate::model::CVSSv3::scope].
1816 ///
1817 /// # Example
1818 /// ```ignore,no_run
1819 /// # use google_cloud_grafeas_v1::model::CVSSv3;
1820 /// use google_cloud_grafeas_v1::model::cvs_sv_3::Scope;
1821 /// let x0 = CVSSv3::new().set_scope(Scope::Unchanged);
1822 /// let x1 = CVSSv3::new().set_scope(Scope::Changed);
1823 /// ```
1824 pub fn set_scope<T: std::convert::Into<crate::model::cvs_sv_3::Scope>>(mut self, v: T) -> Self {
1825 self.scope = v.into();
1826 self
1827 }
1828
1829 /// Sets the value of [confidentiality_impact][crate::model::CVSSv3::confidentiality_impact].
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::Impact;
1835 /// let x0 = CVSSv3::new().set_confidentiality_impact(Impact::High);
1836 /// let x1 = CVSSv3::new().set_confidentiality_impact(Impact::Low);
1837 /// let x2 = CVSSv3::new().set_confidentiality_impact(Impact::None);
1838 /// ```
1839 pub fn set_confidentiality_impact<T: std::convert::Into<crate::model::cvs_sv_3::Impact>>(
1840 mut self,
1841 v: T,
1842 ) -> Self {
1843 self.confidentiality_impact = v.into();
1844 self
1845 }
1846
1847 /// Sets the value of [integrity_impact][crate::model::CVSSv3::integrity_impact].
1848 ///
1849 /// # Example
1850 /// ```ignore,no_run
1851 /// # use google_cloud_grafeas_v1::model::CVSSv3;
1852 /// use google_cloud_grafeas_v1::model::cvs_sv_3::Impact;
1853 /// let x0 = CVSSv3::new().set_integrity_impact(Impact::High);
1854 /// let x1 = CVSSv3::new().set_integrity_impact(Impact::Low);
1855 /// let x2 = CVSSv3::new().set_integrity_impact(Impact::None);
1856 /// ```
1857 pub fn set_integrity_impact<T: std::convert::Into<crate::model::cvs_sv_3::Impact>>(
1858 mut self,
1859 v: T,
1860 ) -> Self {
1861 self.integrity_impact = v.into();
1862 self
1863 }
1864
1865 /// Sets the value of [availability_impact][crate::model::CVSSv3::availability_impact].
1866 ///
1867 /// # Example
1868 /// ```ignore,no_run
1869 /// # use google_cloud_grafeas_v1::model::CVSSv3;
1870 /// use google_cloud_grafeas_v1::model::cvs_sv_3::Impact;
1871 /// let x0 = CVSSv3::new().set_availability_impact(Impact::High);
1872 /// let x1 = CVSSv3::new().set_availability_impact(Impact::Low);
1873 /// let x2 = CVSSv3::new().set_availability_impact(Impact::None);
1874 /// ```
1875 pub fn set_availability_impact<T: std::convert::Into<crate::model::cvs_sv_3::Impact>>(
1876 mut self,
1877 v: T,
1878 ) -> Self {
1879 self.availability_impact = v.into();
1880 self
1881 }
1882}
1883
1884impl wkt::message::Message for CVSSv3 {
1885 fn typename() -> &'static str {
1886 "type.googleapis.com/grafeas.v1.CVSSv3"
1887 }
1888}
1889
1890/// Defines additional types related to [CVSSv3].
1891pub mod cvs_sv_3 {
1892 #[allow(unused_imports)]
1893 use super::*;
1894
1895 ///
1896 /// # Working with unknown values
1897 ///
1898 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1899 /// additional enum variants at any time. Adding new variants is not considered
1900 /// a breaking change. Applications should write their code in anticipation of:
1901 ///
1902 /// - New values appearing in future releases of the client library, **and**
1903 /// - New values received dynamically, without application changes.
1904 ///
1905 /// Please consult the [Working with enums] section in the user guide for some
1906 /// guidelines.
1907 ///
1908 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1909 #[derive(Clone, Debug, PartialEq)]
1910 #[non_exhaustive]
1911 pub enum AttackVector {
1912 Unspecified,
1913 Network,
1914 Adjacent,
1915 Local,
1916 Physical,
1917 /// If set, the enum was initialized with an unknown value.
1918 ///
1919 /// Applications can examine the value using [AttackVector::value] or
1920 /// [AttackVector::name].
1921 UnknownValue(attack_vector::UnknownValue),
1922 }
1923
1924 #[doc(hidden)]
1925 pub mod attack_vector {
1926 #[allow(unused_imports)]
1927 use super::*;
1928 #[derive(Clone, Debug, PartialEq)]
1929 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1930 }
1931
1932 impl AttackVector {
1933 /// Gets the enum value.
1934 ///
1935 /// Returns `None` if the enum contains an unknown value deserialized from
1936 /// the string representation of enums.
1937 pub fn value(&self) -> std::option::Option<i32> {
1938 match self {
1939 Self::Unspecified => std::option::Option::Some(0),
1940 Self::Network => std::option::Option::Some(1),
1941 Self::Adjacent => std::option::Option::Some(2),
1942 Self::Local => std::option::Option::Some(3),
1943 Self::Physical => std::option::Option::Some(4),
1944 Self::UnknownValue(u) => u.0.value(),
1945 }
1946 }
1947
1948 /// Gets the enum value as a string.
1949 ///
1950 /// Returns `None` if the enum contains an unknown value deserialized from
1951 /// the integer representation of enums.
1952 pub fn name(&self) -> std::option::Option<&str> {
1953 match self {
1954 Self::Unspecified => std::option::Option::Some("ATTACK_VECTOR_UNSPECIFIED"),
1955 Self::Network => std::option::Option::Some("ATTACK_VECTOR_NETWORK"),
1956 Self::Adjacent => std::option::Option::Some("ATTACK_VECTOR_ADJACENT"),
1957 Self::Local => std::option::Option::Some("ATTACK_VECTOR_LOCAL"),
1958 Self::Physical => std::option::Option::Some("ATTACK_VECTOR_PHYSICAL"),
1959 Self::UnknownValue(u) => u.0.name(),
1960 }
1961 }
1962 }
1963
1964 impl std::default::Default for AttackVector {
1965 fn default() -> Self {
1966 use std::convert::From;
1967 Self::from(0)
1968 }
1969 }
1970
1971 impl std::fmt::Display for AttackVector {
1972 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1973 wkt::internal::display_enum(f, self.name(), self.value())
1974 }
1975 }
1976
1977 impl std::convert::From<i32> for AttackVector {
1978 fn from(value: i32) -> Self {
1979 match value {
1980 0 => Self::Unspecified,
1981 1 => Self::Network,
1982 2 => Self::Adjacent,
1983 3 => Self::Local,
1984 4 => Self::Physical,
1985 _ => Self::UnknownValue(attack_vector::UnknownValue(
1986 wkt::internal::UnknownEnumValue::Integer(value),
1987 )),
1988 }
1989 }
1990 }
1991
1992 impl std::convert::From<&str> for AttackVector {
1993 fn from(value: &str) -> Self {
1994 use std::string::ToString;
1995 match value {
1996 "ATTACK_VECTOR_UNSPECIFIED" => Self::Unspecified,
1997 "ATTACK_VECTOR_NETWORK" => Self::Network,
1998 "ATTACK_VECTOR_ADJACENT" => Self::Adjacent,
1999 "ATTACK_VECTOR_LOCAL" => Self::Local,
2000 "ATTACK_VECTOR_PHYSICAL" => Self::Physical,
2001 _ => Self::UnknownValue(attack_vector::UnknownValue(
2002 wkt::internal::UnknownEnumValue::String(value.to_string()),
2003 )),
2004 }
2005 }
2006 }
2007
2008 impl serde::ser::Serialize for AttackVector {
2009 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2010 where
2011 S: serde::Serializer,
2012 {
2013 match self {
2014 Self::Unspecified => serializer.serialize_i32(0),
2015 Self::Network => serializer.serialize_i32(1),
2016 Self::Adjacent => serializer.serialize_i32(2),
2017 Self::Local => serializer.serialize_i32(3),
2018 Self::Physical => serializer.serialize_i32(4),
2019 Self::UnknownValue(u) => u.0.serialize(serializer),
2020 }
2021 }
2022 }
2023
2024 impl<'de> serde::de::Deserialize<'de> for AttackVector {
2025 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2026 where
2027 D: serde::Deserializer<'de>,
2028 {
2029 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttackVector>::new(
2030 ".grafeas.v1.CVSSv3.AttackVector",
2031 ))
2032 }
2033 }
2034
2035 ///
2036 /// # Working with unknown values
2037 ///
2038 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2039 /// additional enum variants at any time. Adding new variants is not considered
2040 /// a breaking change. Applications should write their code in anticipation of:
2041 ///
2042 /// - New values appearing in future releases of the client library, **and**
2043 /// - New values received dynamically, without application changes.
2044 ///
2045 /// Please consult the [Working with enums] section in the user guide for some
2046 /// guidelines.
2047 ///
2048 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2049 #[derive(Clone, Debug, PartialEq)]
2050 #[non_exhaustive]
2051 pub enum AttackComplexity {
2052 Unspecified,
2053 Low,
2054 High,
2055 /// If set, the enum was initialized with an unknown value.
2056 ///
2057 /// Applications can examine the value using [AttackComplexity::value] or
2058 /// [AttackComplexity::name].
2059 UnknownValue(attack_complexity::UnknownValue),
2060 }
2061
2062 #[doc(hidden)]
2063 pub mod attack_complexity {
2064 #[allow(unused_imports)]
2065 use super::*;
2066 #[derive(Clone, Debug, PartialEq)]
2067 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2068 }
2069
2070 impl AttackComplexity {
2071 /// Gets the enum value.
2072 ///
2073 /// Returns `None` if the enum contains an unknown value deserialized from
2074 /// the string representation of enums.
2075 pub fn value(&self) -> std::option::Option<i32> {
2076 match self {
2077 Self::Unspecified => std::option::Option::Some(0),
2078 Self::Low => std::option::Option::Some(1),
2079 Self::High => std::option::Option::Some(2),
2080 Self::UnknownValue(u) => u.0.value(),
2081 }
2082 }
2083
2084 /// Gets the enum value as a string.
2085 ///
2086 /// Returns `None` if the enum contains an unknown value deserialized from
2087 /// the integer representation of enums.
2088 pub fn name(&self) -> std::option::Option<&str> {
2089 match self {
2090 Self::Unspecified => std::option::Option::Some("ATTACK_COMPLEXITY_UNSPECIFIED"),
2091 Self::Low => std::option::Option::Some("ATTACK_COMPLEXITY_LOW"),
2092 Self::High => std::option::Option::Some("ATTACK_COMPLEXITY_HIGH"),
2093 Self::UnknownValue(u) => u.0.name(),
2094 }
2095 }
2096 }
2097
2098 impl std::default::Default for AttackComplexity {
2099 fn default() -> Self {
2100 use std::convert::From;
2101 Self::from(0)
2102 }
2103 }
2104
2105 impl std::fmt::Display for AttackComplexity {
2106 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2107 wkt::internal::display_enum(f, self.name(), self.value())
2108 }
2109 }
2110
2111 impl std::convert::From<i32> for AttackComplexity {
2112 fn from(value: i32) -> Self {
2113 match value {
2114 0 => Self::Unspecified,
2115 1 => Self::Low,
2116 2 => Self::High,
2117 _ => Self::UnknownValue(attack_complexity::UnknownValue(
2118 wkt::internal::UnknownEnumValue::Integer(value),
2119 )),
2120 }
2121 }
2122 }
2123
2124 impl std::convert::From<&str> for AttackComplexity {
2125 fn from(value: &str) -> Self {
2126 use std::string::ToString;
2127 match value {
2128 "ATTACK_COMPLEXITY_UNSPECIFIED" => Self::Unspecified,
2129 "ATTACK_COMPLEXITY_LOW" => Self::Low,
2130 "ATTACK_COMPLEXITY_HIGH" => Self::High,
2131 _ => Self::UnknownValue(attack_complexity::UnknownValue(
2132 wkt::internal::UnknownEnumValue::String(value.to_string()),
2133 )),
2134 }
2135 }
2136 }
2137
2138 impl serde::ser::Serialize for AttackComplexity {
2139 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2140 where
2141 S: serde::Serializer,
2142 {
2143 match self {
2144 Self::Unspecified => serializer.serialize_i32(0),
2145 Self::Low => serializer.serialize_i32(1),
2146 Self::High => serializer.serialize_i32(2),
2147 Self::UnknownValue(u) => u.0.serialize(serializer),
2148 }
2149 }
2150 }
2151
2152 impl<'de> serde::de::Deserialize<'de> for AttackComplexity {
2153 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2154 where
2155 D: serde::Deserializer<'de>,
2156 {
2157 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttackComplexity>::new(
2158 ".grafeas.v1.CVSSv3.AttackComplexity",
2159 ))
2160 }
2161 }
2162
2163 ///
2164 /// # Working with unknown values
2165 ///
2166 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2167 /// additional enum variants at any time. Adding new variants is not considered
2168 /// a breaking change. Applications should write their code in anticipation of:
2169 ///
2170 /// - New values appearing in future releases of the client library, **and**
2171 /// - New values received dynamically, without application changes.
2172 ///
2173 /// Please consult the [Working with enums] section in the user guide for some
2174 /// guidelines.
2175 ///
2176 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2177 #[derive(Clone, Debug, PartialEq)]
2178 #[non_exhaustive]
2179 pub enum PrivilegesRequired {
2180 Unspecified,
2181 None,
2182 Low,
2183 High,
2184 /// If set, the enum was initialized with an unknown value.
2185 ///
2186 /// Applications can examine the value using [PrivilegesRequired::value] or
2187 /// [PrivilegesRequired::name].
2188 UnknownValue(privileges_required::UnknownValue),
2189 }
2190
2191 #[doc(hidden)]
2192 pub mod privileges_required {
2193 #[allow(unused_imports)]
2194 use super::*;
2195 #[derive(Clone, Debug, PartialEq)]
2196 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2197 }
2198
2199 impl PrivilegesRequired {
2200 /// Gets the enum value.
2201 ///
2202 /// Returns `None` if the enum contains an unknown value deserialized from
2203 /// the string representation of enums.
2204 pub fn value(&self) -> std::option::Option<i32> {
2205 match self {
2206 Self::Unspecified => std::option::Option::Some(0),
2207 Self::None => std::option::Option::Some(1),
2208 Self::Low => std::option::Option::Some(2),
2209 Self::High => std::option::Option::Some(3),
2210 Self::UnknownValue(u) => u.0.value(),
2211 }
2212 }
2213
2214 /// Gets the enum value as a string.
2215 ///
2216 /// Returns `None` if the enum contains an unknown value deserialized from
2217 /// the integer representation of enums.
2218 pub fn name(&self) -> std::option::Option<&str> {
2219 match self {
2220 Self::Unspecified => std::option::Option::Some("PRIVILEGES_REQUIRED_UNSPECIFIED"),
2221 Self::None => std::option::Option::Some("PRIVILEGES_REQUIRED_NONE"),
2222 Self::Low => std::option::Option::Some("PRIVILEGES_REQUIRED_LOW"),
2223 Self::High => std::option::Option::Some("PRIVILEGES_REQUIRED_HIGH"),
2224 Self::UnknownValue(u) => u.0.name(),
2225 }
2226 }
2227 }
2228
2229 impl std::default::Default for PrivilegesRequired {
2230 fn default() -> Self {
2231 use std::convert::From;
2232 Self::from(0)
2233 }
2234 }
2235
2236 impl std::fmt::Display for PrivilegesRequired {
2237 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2238 wkt::internal::display_enum(f, self.name(), self.value())
2239 }
2240 }
2241
2242 impl std::convert::From<i32> for PrivilegesRequired {
2243 fn from(value: i32) -> Self {
2244 match value {
2245 0 => Self::Unspecified,
2246 1 => Self::None,
2247 2 => Self::Low,
2248 3 => Self::High,
2249 _ => Self::UnknownValue(privileges_required::UnknownValue(
2250 wkt::internal::UnknownEnumValue::Integer(value),
2251 )),
2252 }
2253 }
2254 }
2255
2256 impl std::convert::From<&str> for PrivilegesRequired {
2257 fn from(value: &str) -> Self {
2258 use std::string::ToString;
2259 match value {
2260 "PRIVILEGES_REQUIRED_UNSPECIFIED" => Self::Unspecified,
2261 "PRIVILEGES_REQUIRED_NONE" => Self::None,
2262 "PRIVILEGES_REQUIRED_LOW" => Self::Low,
2263 "PRIVILEGES_REQUIRED_HIGH" => Self::High,
2264 _ => Self::UnknownValue(privileges_required::UnknownValue(
2265 wkt::internal::UnknownEnumValue::String(value.to_string()),
2266 )),
2267 }
2268 }
2269 }
2270
2271 impl serde::ser::Serialize for PrivilegesRequired {
2272 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2273 where
2274 S: serde::Serializer,
2275 {
2276 match self {
2277 Self::Unspecified => serializer.serialize_i32(0),
2278 Self::None => serializer.serialize_i32(1),
2279 Self::Low => serializer.serialize_i32(2),
2280 Self::High => serializer.serialize_i32(3),
2281 Self::UnknownValue(u) => u.0.serialize(serializer),
2282 }
2283 }
2284 }
2285
2286 impl<'de> serde::de::Deserialize<'de> for PrivilegesRequired {
2287 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2288 where
2289 D: serde::Deserializer<'de>,
2290 {
2291 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PrivilegesRequired>::new(
2292 ".grafeas.v1.CVSSv3.PrivilegesRequired",
2293 ))
2294 }
2295 }
2296
2297 ///
2298 /// # Working with unknown values
2299 ///
2300 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2301 /// additional enum variants at any time. Adding new variants is not considered
2302 /// a breaking change. Applications should write their code in anticipation of:
2303 ///
2304 /// - New values appearing in future releases of the client library, **and**
2305 /// - New values received dynamically, without application changes.
2306 ///
2307 /// Please consult the [Working with enums] section in the user guide for some
2308 /// guidelines.
2309 ///
2310 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2311 #[derive(Clone, Debug, PartialEq)]
2312 #[non_exhaustive]
2313 pub enum UserInteraction {
2314 Unspecified,
2315 None,
2316 Required,
2317 /// If set, the enum was initialized with an unknown value.
2318 ///
2319 /// Applications can examine the value using [UserInteraction::value] or
2320 /// [UserInteraction::name].
2321 UnknownValue(user_interaction::UnknownValue),
2322 }
2323
2324 #[doc(hidden)]
2325 pub mod user_interaction {
2326 #[allow(unused_imports)]
2327 use super::*;
2328 #[derive(Clone, Debug, PartialEq)]
2329 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2330 }
2331
2332 impl UserInteraction {
2333 /// Gets the enum value.
2334 ///
2335 /// Returns `None` if the enum contains an unknown value deserialized from
2336 /// the string representation of enums.
2337 pub fn value(&self) -> std::option::Option<i32> {
2338 match self {
2339 Self::Unspecified => std::option::Option::Some(0),
2340 Self::None => std::option::Option::Some(1),
2341 Self::Required => std::option::Option::Some(2),
2342 Self::UnknownValue(u) => u.0.value(),
2343 }
2344 }
2345
2346 /// Gets the enum value as a string.
2347 ///
2348 /// Returns `None` if the enum contains an unknown value deserialized from
2349 /// the integer representation of enums.
2350 pub fn name(&self) -> std::option::Option<&str> {
2351 match self {
2352 Self::Unspecified => std::option::Option::Some("USER_INTERACTION_UNSPECIFIED"),
2353 Self::None => std::option::Option::Some("USER_INTERACTION_NONE"),
2354 Self::Required => std::option::Option::Some("USER_INTERACTION_REQUIRED"),
2355 Self::UnknownValue(u) => u.0.name(),
2356 }
2357 }
2358 }
2359
2360 impl std::default::Default for UserInteraction {
2361 fn default() -> Self {
2362 use std::convert::From;
2363 Self::from(0)
2364 }
2365 }
2366
2367 impl std::fmt::Display for UserInteraction {
2368 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2369 wkt::internal::display_enum(f, self.name(), self.value())
2370 }
2371 }
2372
2373 impl std::convert::From<i32> for UserInteraction {
2374 fn from(value: i32) -> Self {
2375 match value {
2376 0 => Self::Unspecified,
2377 1 => Self::None,
2378 2 => Self::Required,
2379 _ => Self::UnknownValue(user_interaction::UnknownValue(
2380 wkt::internal::UnknownEnumValue::Integer(value),
2381 )),
2382 }
2383 }
2384 }
2385
2386 impl std::convert::From<&str> for UserInteraction {
2387 fn from(value: &str) -> Self {
2388 use std::string::ToString;
2389 match value {
2390 "USER_INTERACTION_UNSPECIFIED" => Self::Unspecified,
2391 "USER_INTERACTION_NONE" => Self::None,
2392 "USER_INTERACTION_REQUIRED" => Self::Required,
2393 _ => Self::UnknownValue(user_interaction::UnknownValue(
2394 wkt::internal::UnknownEnumValue::String(value.to_string()),
2395 )),
2396 }
2397 }
2398 }
2399
2400 impl serde::ser::Serialize for UserInteraction {
2401 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2402 where
2403 S: serde::Serializer,
2404 {
2405 match self {
2406 Self::Unspecified => serializer.serialize_i32(0),
2407 Self::None => serializer.serialize_i32(1),
2408 Self::Required => serializer.serialize_i32(2),
2409 Self::UnknownValue(u) => u.0.serialize(serializer),
2410 }
2411 }
2412 }
2413
2414 impl<'de> serde::de::Deserialize<'de> for UserInteraction {
2415 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2416 where
2417 D: serde::Deserializer<'de>,
2418 {
2419 deserializer.deserialize_any(wkt::internal::EnumVisitor::<UserInteraction>::new(
2420 ".grafeas.v1.CVSSv3.UserInteraction",
2421 ))
2422 }
2423 }
2424
2425 ///
2426 /// # Working with unknown values
2427 ///
2428 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2429 /// additional enum variants at any time. Adding new variants is not considered
2430 /// a breaking change. Applications should write their code in anticipation of:
2431 ///
2432 /// - New values appearing in future releases of the client library, **and**
2433 /// - New values received dynamically, without application changes.
2434 ///
2435 /// Please consult the [Working with enums] section in the user guide for some
2436 /// guidelines.
2437 ///
2438 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2439 #[derive(Clone, Debug, PartialEq)]
2440 #[non_exhaustive]
2441 pub enum Scope {
2442 Unspecified,
2443 Unchanged,
2444 Changed,
2445 /// If set, the enum was initialized with an unknown value.
2446 ///
2447 /// Applications can examine the value using [Scope::value] or
2448 /// [Scope::name].
2449 UnknownValue(scope::UnknownValue),
2450 }
2451
2452 #[doc(hidden)]
2453 pub mod scope {
2454 #[allow(unused_imports)]
2455 use super::*;
2456 #[derive(Clone, Debug, PartialEq)]
2457 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2458 }
2459
2460 impl Scope {
2461 /// Gets the enum value.
2462 ///
2463 /// Returns `None` if the enum contains an unknown value deserialized from
2464 /// the string representation of enums.
2465 pub fn value(&self) -> std::option::Option<i32> {
2466 match self {
2467 Self::Unspecified => std::option::Option::Some(0),
2468 Self::Unchanged => std::option::Option::Some(1),
2469 Self::Changed => std::option::Option::Some(2),
2470 Self::UnknownValue(u) => u.0.value(),
2471 }
2472 }
2473
2474 /// Gets the enum value as a string.
2475 ///
2476 /// Returns `None` if the enum contains an unknown value deserialized from
2477 /// the integer representation of enums.
2478 pub fn name(&self) -> std::option::Option<&str> {
2479 match self {
2480 Self::Unspecified => std::option::Option::Some("SCOPE_UNSPECIFIED"),
2481 Self::Unchanged => std::option::Option::Some("SCOPE_UNCHANGED"),
2482 Self::Changed => std::option::Option::Some("SCOPE_CHANGED"),
2483 Self::UnknownValue(u) => u.0.name(),
2484 }
2485 }
2486 }
2487
2488 impl std::default::Default for Scope {
2489 fn default() -> Self {
2490 use std::convert::From;
2491 Self::from(0)
2492 }
2493 }
2494
2495 impl std::fmt::Display for Scope {
2496 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2497 wkt::internal::display_enum(f, self.name(), self.value())
2498 }
2499 }
2500
2501 impl std::convert::From<i32> for Scope {
2502 fn from(value: i32) -> Self {
2503 match value {
2504 0 => Self::Unspecified,
2505 1 => Self::Unchanged,
2506 2 => Self::Changed,
2507 _ => Self::UnknownValue(scope::UnknownValue(
2508 wkt::internal::UnknownEnumValue::Integer(value),
2509 )),
2510 }
2511 }
2512 }
2513
2514 impl std::convert::From<&str> for Scope {
2515 fn from(value: &str) -> Self {
2516 use std::string::ToString;
2517 match value {
2518 "SCOPE_UNSPECIFIED" => Self::Unspecified,
2519 "SCOPE_UNCHANGED" => Self::Unchanged,
2520 "SCOPE_CHANGED" => Self::Changed,
2521 _ => Self::UnknownValue(scope::UnknownValue(
2522 wkt::internal::UnknownEnumValue::String(value.to_string()),
2523 )),
2524 }
2525 }
2526 }
2527
2528 impl serde::ser::Serialize for Scope {
2529 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2530 where
2531 S: serde::Serializer,
2532 {
2533 match self {
2534 Self::Unspecified => serializer.serialize_i32(0),
2535 Self::Unchanged => serializer.serialize_i32(1),
2536 Self::Changed => serializer.serialize_i32(2),
2537 Self::UnknownValue(u) => u.0.serialize(serializer),
2538 }
2539 }
2540 }
2541
2542 impl<'de> serde::de::Deserialize<'de> for Scope {
2543 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2544 where
2545 D: serde::Deserializer<'de>,
2546 {
2547 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Scope>::new(
2548 ".grafeas.v1.CVSSv3.Scope",
2549 ))
2550 }
2551 }
2552
2553 ///
2554 /// # Working with unknown values
2555 ///
2556 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2557 /// additional enum variants at any time. Adding new variants is not considered
2558 /// a breaking change. Applications should write their code in anticipation of:
2559 ///
2560 /// - New values appearing in future releases of the client library, **and**
2561 /// - New values received dynamically, without application changes.
2562 ///
2563 /// Please consult the [Working with enums] section in the user guide for some
2564 /// guidelines.
2565 ///
2566 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2567 #[derive(Clone, Debug, PartialEq)]
2568 #[non_exhaustive]
2569 pub enum Impact {
2570 Unspecified,
2571 High,
2572 Low,
2573 None,
2574 /// If set, the enum was initialized with an unknown value.
2575 ///
2576 /// Applications can examine the value using [Impact::value] or
2577 /// [Impact::name].
2578 UnknownValue(impact::UnknownValue),
2579 }
2580
2581 #[doc(hidden)]
2582 pub mod impact {
2583 #[allow(unused_imports)]
2584 use super::*;
2585 #[derive(Clone, Debug, PartialEq)]
2586 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2587 }
2588
2589 impl Impact {
2590 /// Gets the enum value.
2591 ///
2592 /// Returns `None` if the enum contains an unknown value deserialized from
2593 /// the string representation of enums.
2594 pub fn value(&self) -> std::option::Option<i32> {
2595 match self {
2596 Self::Unspecified => std::option::Option::Some(0),
2597 Self::High => std::option::Option::Some(1),
2598 Self::Low => std::option::Option::Some(2),
2599 Self::None => std::option::Option::Some(3),
2600 Self::UnknownValue(u) => u.0.value(),
2601 }
2602 }
2603
2604 /// Gets the enum value as a string.
2605 ///
2606 /// Returns `None` if the enum contains an unknown value deserialized from
2607 /// the integer representation of enums.
2608 pub fn name(&self) -> std::option::Option<&str> {
2609 match self {
2610 Self::Unspecified => std::option::Option::Some("IMPACT_UNSPECIFIED"),
2611 Self::High => std::option::Option::Some("IMPACT_HIGH"),
2612 Self::Low => std::option::Option::Some("IMPACT_LOW"),
2613 Self::None => std::option::Option::Some("IMPACT_NONE"),
2614 Self::UnknownValue(u) => u.0.name(),
2615 }
2616 }
2617 }
2618
2619 impl std::default::Default for Impact {
2620 fn default() -> Self {
2621 use std::convert::From;
2622 Self::from(0)
2623 }
2624 }
2625
2626 impl std::fmt::Display for Impact {
2627 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2628 wkt::internal::display_enum(f, self.name(), self.value())
2629 }
2630 }
2631
2632 impl std::convert::From<i32> for Impact {
2633 fn from(value: i32) -> Self {
2634 match value {
2635 0 => Self::Unspecified,
2636 1 => Self::High,
2637 2 => Self::Low,
2638 3 => Self::None,
2639 _ => Self::UnknownValue(impact::UnknownValue(
2640 wkt::internal::UnknownEnumValue::Integer(value),
2641 )),
2642 }
2643 }
2644 }
2645
2646 impl std::convert::From<&str> for Impact {
2647 fn from(value: &str) -> Self {
2648 use std::string::ToString;
2649 match value {
2650 "IMPACT_UNSPECIFIED" => Self::Unspecified,
2651 "IMPACT_HIGH" => Self::High,
2652 "IMPACT_LOW" => Self::Low,
2653 "IMPACT_NONE" => Self::None,
2654 _ => Self::UnknownValue(impact::UnknownValue(
2655 wkt::internal::UnknownEnumValue::String(value.to_string()),
2656 )),
2657 }
2658 }
2659 }
2660
2661 impl serde::ser::Serialize for Impact {
2662 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2663 where
2664 S: serde::Serializer,
2665 {
2666 match self {
2667 Self::Unspecified => serializer.serialize_i32(0),
2668 Self::High => serializer.serialize_i32(1),
2669 Self::Low => serializer.serialize_i32(2),
2670 Self::None => serializer.serialize_i32(3),
2671 Self::UnknownValue(u) => u.0.serialize(serializer),
2672 }
2673 }
2674 }
2675
2676 impl<'de> serde::de::Deserialize<'de> for Impact {
2677 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2678 where
2679 D: serde::Deserializer<'de>,
2680 {
2681 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Impact>::new(
2682 ".grafeas.v1.CVSSv3.Impact",
2683 ))
2684 }
2685 }
2686}
2687
2688/// Common Vulnerability Scoring System.
2689/// For details, see <https://www.first.org/cvss/specification-document>
2690/// This is a message we will try to use for storing various versions of CVSS
2691/// rather than making a separate proto for storing a specific version.
2692#[derive(Clone, Default, PartialEq)]
2693#[non_exhaustive]
2694pub struct Cvss {
2695 /// The base score is a function of the base metric scores.
2696 pub base_score: f32,
2697
2698 pub exploitability_score: f32,
2699
2700 pub impact_score: f32,
2701
2702 /// Base Metrics
2703 /// Represents the intrinsic characteristics of a vulnerability that are
2704 /// constant over time and across user environments.
2705 pub attack_vector: crate::model::cvss::AttackVector,
2706
2707 pub attack_complexity: crate::model::cvss::AttackComplexity,
2708
2709 pub authentication: crate::model::cvss::Authentication,
2710
2711 pub privileges_required: crate::model::cvss::PrivilegesRequired,
2712
2713 pub user_interaction: crate::model::cvss::UserInteraction,
2714
2715 pub scope: crate::model::cvss::Scope,
2716
2717 pub confidentiality_impact: crate::model::cvss::Impact,
2718
2719 pub integrity_impact: crate::model::cvss::Impact,
2720
2721 pub availability_impact: crate::model::cvss::Impact,
2722
2723 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2724}
2725
2726impl Cvss {
2727 pub fn new() -> Self {
2728 std::default::Default::default()
2729 }
2730
2731 /// Sets the value of [base_score][crate::model::Cvss::base_score].
2732 ///
2733 /// # Example
2734 /// ```ignore,no_run
2735 /// # use google_cloud_grafeas_v1::model::Cvss;
2736 /// let x = Cvss::new().set_base_score(42.0);
2737 /// ```
2738 pub fn set_base_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
2739 self.base_score = v.into();
2740 self
2741 }
2742
2743 /// Sets the value of [exploitability_score][crate::model::Cvss::exploitability_score].
2744 ///
2745 /// # Example
2746 /// ```ignore,no_run
2747 /// # use google_cloud_grafeas_v1::model::Cvss;
2748 /// let x = Cvss::new().set_exploitability_score(42.0);
2749 /// ```
2750 pub fn set_exploitability_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
2751 self.exploitability_score = v.into();
2752 self
2753 }
2754
2755 /// Sets the value of [impact_score][crate::model::Cvss::impact_score].
2756 ///
2757 /// # Example
2758 /// ```ignore,no_run
2759 /// # use google_cloud_grafeas_v1::model::Cvss;
2760 /// let x = Cvss::new().set_impact_score(42.0);
2761 /// ```
2762 pub fn set_impact_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
2763 self.impact_score = v.into();
2764 self
2765 }
2766
2767 /// Sets the value of [attack_vector][crate::model::Cvss::attack_vector].
2768 ///
2769 /// # Example
2770 /// ```ignore,no_run
2771 /// # use google_cloud_grafeas_v1::model::Cvss;
2772 /// use google_cloud_grafeas_v1::model::cvss::AttackVector;
2773 /// let x0 = Cvss::new().set_attack_vector(AttackVector::Network);
2774 /// let x1 = Cvss::new().set_attack_vector(AttackVector::Adjacent);
2775 /// let x2 = Cvss::new().set_attack_vector(AttackVector::Local);
2776 /// ```
2777 pub fn set_attack_vector<T: std::convert::Into<crate::model::cvss::AttackVector>>(
2778 mut self,
2779 v: T,
2780 ) -> Self {
2781 self.attack_vector = v.into();
2782 self
2783 }
2784
2785 /// Sets the value of [attack_complexity][crate::model::Cvss::attack_complexity].
2786 ///
2787 /// # Example
2788 /// ```ignore,no_run
2789 /// # use google_cloud_grafeas_v1::model::Cvss;
2790 /// use google_cloud_grafeas_v1::model::cvss::AttackComplexity;
2791 /// let x0 = Cvss::new().set_attack_complexity(AttackComplexity::Low);
2792 /// let x1 = Cvss::new().set_attack_complexity(AttackComplexity::High);
2793 /// let x2 = Cvss::new().set_attack_complexity(AttackComplexity::Medium);
2794 /// ```
2795 pub fn set_attack_complexity<T: std::convert::Into<crate::model::cvss::AttackComplexity>>(
2796 mut self,
2797 v: T,
2798 ) -> Self {
2799 self.attack_complexity = v.into();
2800 self
2801 }
2802
2803 /// Sets the value of [authentication][crate::model::Cvss::authentication].
2804 ///
2805 /// # Example
2806 /// ```ignore,no_run
2807 /// # use google_cloud_grafeas_v1::model::Cvss;
2808 /// use google_cloud_grafeas_v1::model::cvss::Authentication;
2809 /// let x0 = Cvss::new().set_authentication(Authentication::Multiple);
2810 /// let x1 = Cvss::new().set_authentication(Authentication::Single);
2811 /// let x2 = Cvss::new().set_authentication(Authentication::None);
2812 /// ```
2813 pub fn set_authentication<T: std::convert::Into<crate::model::cvss::Authentication>>(
2814 mut self,
2815 v: T,
2816 ) -> Self {
2817 self.authentication = v.into();
2818 self
2819 }
2820
2821 /// Sets the value of [privileges_required][crate::model::Cvss::privileges_required].
2822 ///
2823 /// # Example
2824 /// ```ignore,no_run
2825 /// # use google_cloud_grafeas_v1::model::Cvss;
2826 /// use google_cloud_grafeas_v1::model::cvss::PrivilegesRequired;
2827 /// let x0 = Cvss::new().set_privileges_required(PrivilegesRequired::None);
2828 /// let x1 = Cvss::new().set_privileges_required(PrivilegesRequired::Low);
2829 /// let x2 = Cvss::new().set_privileges_required(PrivilegesRequired::High);
2830 /// ```
2831 pub fn set_privileges_required<
2832 T: std::convert::Into<crate::model::cvss::PrivilegesRequired>,
2833 >(
2834 mut self,
2835 v: T,
2836 ) -> Self {
2837 self.privileges_required = v.into();
2838 self
2839 }
2840
2841 /// Sets the value of [user_interaction][crate::model::Cvss::user_interaction].
2842 ///
2843 /// # Example
2844 /// ```ignore,no_run
2845 /// # use google_cloud_grafeas_v1::model::Cvss;
2846 /// use google_cloud_grafeas_v1::model::cvss::UserInteraction;
2847 /// let x0 = Cvss::new().set_user_interaction(UserInteraction::None);
2848 /// let x1 = Cvss::new().set_user_interaction(UserInteraction::Required);
2849 /// ```
2850 pub fn set_user_interaction<T: std::convert::Into<crate::model::cvss::UserInteraction>>(
2851 mut self,
2852 v: T,
2853 ) -> Self {
2854 self.user_interaction = v.into();
2855 self
2856 }
2857
2858 /// Sets the value of [scope][crate::model::Cvss::scope].
2859 ///
2860 /// # Example
2861 /// ```ignore,no_run
2862 /// # use google_cloud_grafeas_v1::model::Cvss;
2863 /// use google_cloud_grafeas_v1::model::cvss::Scope;
2864 /// let x0 = Cvss::new().set_scope(Scope::Unchanged);
2865 /// let x1 = Cvss::new().set_scope(Scope::Changed);
2866 /// ```
2867 pub fn set_scope<T: std::convert::Into<crate::model::cvss::Scope>>(mut self, v: T) -> Self {
2868 self.scope = v.into();
2869 self
2870 }
2871
2872 /// Sets the value of [confidentiality_impact][crate::model::Cvss::confidentiality_impact].
2873 ///
2874 /// # Example
2875 /// ```ignore,no_run
2876 /// # use google_cloud_grafeas_v1::model::Cvss;
2877 /// use google_cloud_grafeas_v1::model::cvss::Impact;
2878 /// let x0 = Cvss::new().set_confidentiality_impact(Impact::High);
2879 /// let x1 = Cvss::new().set_confidentiality_impact(Impact::Low);
2880 /// let x2 = Cvss::new().set_confidentiality_impact(Impact::None);
2881 /// ```
2882 pub fn set_confidentiality_impact<T: std::convert::Into<crate::model::cvss::Impact>>(
2883 mut self,
2884 v: T,
2885 ) -> Self {
2886 self.confidentiality_impact = v.into();
2887 self
2888 }
2889
2890 /// Sets the value of [integrity_impact][crate::model::Cvss::integrity_impact].
2891 ///
2892 /// # Example
2893 /// ```ignore,no_run
2894 /// # use google_cloud_grafeas_v1::model::Cvss;
2895 /// use google_cloud_grafeas_v1::model::cvss::Impact;
2896 /// let x0 = Cvss::new().set_integrity_impact(Impact::High);
2897 /// let x1 = Cvss::new().set_integrity_impact(Impact::Low);
2898 /// let x2 = Cvss::new().set_integrity_impact(Impact::None);
2899 /// ```
2900 pub fn set_integrity_impact<T: std::convert::Into<crate::model::cvss::Impact>>(
2901 mut self,
2902 v: T,
2903 ) -> Self {
2904 self.integrity_impact = v.into();
2905 self
2906 }
2907
2908 /// Sets the value of [availability_impact][crate::model::Cvss::availability_impact].
2909 ///
2910 /// # Example
2911 /// ```ignore,no_run
2912 /// # use google_cloud_grafeas_v1::model::Cvss;
2913 /// use google_cloud_grafeas_v1::model::cvss::Impact;
2914 /// let x0 = Cvss::new().set_availability_impact(Impact::High);
2915 /// let x1 = Cvss::new().set_availability_impact(Impact::Low);
2916 /// let x2 = Cvss::new().set_availability_impact(Impact::None);
2917 /// ```
2918 pub fn set_availability_impact<T: std::convert::Into<crate::model::cvss::Impact>>(
2919 mut self,
2920 v: T,
2921 ) -> Self {
2922 self.availability_impact = v.into();
2923 self
2924 }
2925}
2926
2927impl wkt::message::Message for Cvss {
2928 fn typename() -> &'static str {
2929 "type.googleapis.com/grafeas.v1.CVSS"
2930 }
2931}
2932
2933/// Defines additional types related to [Cvss].
2934pub mod cvss {
2935 #[allow(unused_imports)]
2936 use super::*;
2937
2938 ///
2939 /// # Working with unknown values
2940 ///
2941 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2942 /// additional enum variants at any time. Adding new variants is not considered
2943 /// a breaking change. Applications should write their code in anticipation of:
2944 ///
2945 /// - New values appearing in future releases of the client library, **and**
2946 /// - New values received dynamically, without application changes.
2947 ///
2948 /// Please consult the [Working with enums] section in the user guide for some
2949 /// guidelines.
2950 ///
2951 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2952 #[derive(Clone, Debug, PartialEq)]
2953 #[non_exhaustive]
2954 pub enum AttackVector {
2955 Unspecified,
2956 Network,
2957 Adjacent,
2958 Local,
2959 Physical,
2960 /// If set, the enum was initialized with an unknown value.
2961 ///
2962 /// Applications can examine the value using [AttackVector::value] or
2963 /// [AttackVector::name].
2964 UnknownValue(attack_vector::UnknownValue),
2965 }
2966
2967 #[doc(hidden)]
2968 pub mod attack_vector {
2969 #[allow(unused_imports)]
2970 use super::*;
2971 #[derive(Clone, Debug, PartialEq)]
2972 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2973 }
2974
2975 impl AttackVector {
2976 /// Gets the enum value.
2977 ///
2978 /// Returns `None` if the enum contains an unknown value deserialized from
2979 /// the string representation of enums.
2980 pub fn value(&self) -> std::option::Option<i32> {
2981 match self {
2982 Self::Unspecified => std::option::Option::Some(0),
2983 Self::Network => std::option::Option::Some(1),
2984 Self::Adjacent => std::option::Option::Some(2),
2985 Self::Local => std::option::Option::Some(3),
2986 Self::Physical => std::option::Option::Some(4),
2987 Self::UnknownValue(u) => u.0.value(),
2988 }
2989 }
2990
2991 /// Gets the enum value as a string.
2992 ///
2993 /// Returns `None` if the enum contains an unknown value deserialized from
2994 /// the integer representation of enums.
2995 pub fn name(&self) -> std::option::Option<&str> {
2996 match self {
2997 Self::Unspecified => std::option::Option::Some("ATTACK_VECTOR_UNSPECIFIED"),
2998 Self::Network => std::option::Option::Some("ATTACK_VECTOR_NETWORK"),
2999 Self::Adjacent => std::option::Option::Some("ATTACK_VECTOR_ADJACENT"),
3000 Self::Local => std::option::Option::Some("ATTACK_VECTOR_LOCAL"),
3001 Self::Physical => std::option::Option::Some("ATTACK_VECTOR_PHYSICAL"),
3002 Self::UnknownValue(u) => u.0.name(),
3003 }
3004 }
3005 }
3006
3007 impl std::default::Default for AttackVector {
3008 fn default() -> Self {
3009 use std::convert::From;
3010 Self::from(0)
3011 }
3012 }
3013
3014 impl std::fmt::Display for AttackVector {
3015 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3016 wkt::internal::display_enum(f, self.name(), self.value())
3017 }
3018 }
3019
3020 impl std::convert::From<i32> for AttackVector {
3021 fn from(value: i32) -> Self {
3022 match value {
3023 0 => Self::Unspecified,
3024 1 => Self::Network,
3025 2 => Self::Adjacent,
3026 3 => Self::Local,
3027 4 => Self::Physical,
3028 _ => Self::UnknownValue(attack_vector::UnknownValue(
3029 wkt::internal::UnknownEnumValue::Integer(value),
3030 )),
3031 }
3032 }
3033 }
3034
3035 impl std::convert::From<&str> for AttackVector {
3036 fn from(value: &str) -> Self {
3037 use std::string::ToString;
3038 match value {
3039 "ATTACK_VECTOR_UNSPECIFIED" => Self::Unspecified,
3040 "ATTACK_VECTOR_NETWORK" => Self::Network,
3041 "ATTACK_VECTOR_ADJACENT" => Self::Adjacent,
3042 "ATTACK_VECTOR_LOCAL" => Self::Local,
3043 "ATTACK_VECTOR_PHYSICAL" => Self::Physical,
3044 _ => Self::UnknownValue(attack_vector::UnknownValue(
3045 wkt::internal::UnknownEnumValue::String(value.to_string()),
3046 )),
3047 }
3048 }
3049 }
3050
3051 impl serde::ser::Serialize for AttackVector {
3052 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3053 where
3054 S: serde::Serializer,
3055 {
3056 match self {
3057 Self::Unspecified => serializer.serialize_i32(0),
3058 Self::Network => serializer.serialize_i32(1),
3059 Self::Adjacent => serializer.serialize_i32(2),
3060 Self::Local => serializer.serialize_i32(3),
3061 Self::Physical => serializer.serialize_i32(4),
3062 Self::UnknownValue(u) => u.0.serialize(serializer),
3063 }
3064 }
3065 }
3066
3067 impl<'de> serde::de::Deserialize<'de> for AttackVector {
3068 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3069 where
3070 D: serde::Deserializer<'de>,
3071 {
3072 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttackVector>::new(
3073 ".grafeas.v1.CVSS.AttackVector",
3074 ))
3075 }
3076 }
3077
3078 ///
3079 /// # Working with unknown values
3080 ///
3081 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3082 /// additional enum variants at any time. Adding new variants is not considered
3083 /// a breaking change. Applications should write their code in anticipation of:
3084 ///
3085 /// - New values appearing in future releases of the client library, **and**
3086 /// - New values received dynamically, without application changes.
3087 ///
3088 /// Please consult the [Working with enums] section in the user guide for some
3089 /// guidelines.
3090 ///
3091 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3092 #[derive(Clone, Debug, PartialEq)]
3093 #[non_exhaustive]
3094 pub enum AttackComplexity {
3095 Unspecified,
3096 Low,
3097 High,
3098 Medium,
3099 /// If set, the enum was initialized with an unknown value.
3100 ///
3101 /// Applications can examine the value using [AttackComplexity::value] or
3102 /// [AttackComplexity::name].
3103 UnknownValue(attack_complexity::UnknownValue),
3104 }
3105
3106 #[doc(hidden)]
3107 pub mod attack_complexity {
3108 #[allow(unused_imports)]
3109 use super::*;
3110 #[derive(Clone, Debug, PartialEq)]
3111 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3112 }
3113
3114 impl AttackComplexity {
3115 /// Gets the enum value.
3116 ///
3117 /// Returns `None` if the enum contains an unknown value deserialized from
3118 /// the string representation of enums.
3119 pub fn value(&self) -> std::option::Option<i32> {
3120 match self {
3121 Self::Unspecified => std::option::Option::Some(0),
3122 Self::Low => std::option::Option::Some(1),
3123 Self::High => std::option::Option::Some(2),
3124 Self::Medium => std::option::Option::Some(3),
3125 Self::UnknownValue(u) => u.0.value(),
3126 }
3127 }
3128
3129 /// Gets the enum value as a string.
3130 ///
3131 /// Returns `None` if the enum contains an unknown value deserialized from
3132 /// the integer representation of enums.
3133 pub fn name(&self) -> std::option::Option<&str> {
3134 match self {
3135 Self::Unspecified => std::option::Option::Some("ATTACK_COMPLEXITY_UNSPECIFIED"),
3136 Self::Low => std::option::Option::Some("ATTACK_COMPLEXITY_LOW"),
3137 Self::High => std::option::Option::Some("ATTACK_COMPLEXITY_HIGH"),
3138 Self::Medium => std::option::Option::Some("ATTACK_COMPLEXITY_MEDIUM"),
3139 Self::UnknownValue(u) => u.0.name(),
3140 }
3141 }
3142 }
3143
3144 impl std::default::Default for AttackComplexity {
3145 fn default() -> Self {
3146 use std::convert::From;
3147 Self::from(0)
3148 }
3149 }
3150
3151 impl std::fmt::Display for AttackComplexity {
3152 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3153 wkt::internal::display_enum(f, self.name(), self.value())
3154 }
3155 }
3156
3157 impl std::convert::From<i32> for AttackComplexity {
3158 fn from(value: i32) -> Self {
3159 match value {
3160 0 => Self::Unspecified,
3161 1 => Self::Low,
3162 2 => Self::High,
3163 3 => Self::Medium,
3164 _ => Self::UnknownValue(attack_complexity::UnknownValue(
3165 wkt::internal::UnknownEnumValue::Integer(value),
3166 )),
3167 }
3168 }
3169 }
3170
3171 impl std::convert::From<&str> for AttackComplexity {
3172 fn from(value: &str) -> Self {
3173 use std::string::ToString;
3174 match value {
3175 "ATTACK_COMPLEXITY_UNSPECIFIED" => Self::Unspecified,
3176 "ATTACK_COMPLEXITY_LOW" => Self::Low,
3177 "ATTACK_COMPLEXITY_HIGH" => Self::High,
3178 "ATTACK_COMPLEXITY_MEDIUM" => Self::Medium,
3179 _ => Self::UnknownValue(attack_complexity::UnknownValue(
3180 wkt::internal::UnknownEnumValue::String(value.to_string()),
3181 )),
3182 }
3183 }
3184 }
3185
3186 impl serde::ser::Serialize for AttackComplexity {
3187 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3188 where
3189 S: serde::Serializer,
3190 {
3191 match self {
3192 Self::Unspecified => serializer.serialize_i32(0),
3193 Self::Low => serializer.serialize_i32(1),
3194 Self::High => serializer.serialize_i32(2),
3195 Self::Medium => serializer.serialize_i32(3),
3196 Self::UnknownValue(u) => u.0.serialize(serializer),
3197 }
3198 }
3199 }
3200
3201 impl<'de> serde::de::Deserialize<'de> for AttackComplexity {
3202 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3203 where
3204 D: serde::Deserializer<'de>,
3205 {
3206 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttackComplexity>::new(
3207 ".grafeas.v1.CVSS.AttackComplexity",
3208 ))
3209 }
3210 }
3211
3212 ///
3213 /// # Working with unknown values
3214 ///
3215 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3216 /// additional enum variants at any time. Adding new variants is not considered
3217 /// a breaking change. Applications should write their code in anticipation of:
3218 ///
3219 /// - New values appearing in future releases of the client library, **and**
3220 /// - New values received dynamically, without application changes.
3221 ///
3222 /// Please consult the [Working with enums] section in the user guide for some
3223 /// guidelines.
3224 ///
3225 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3226 #[derive(Clone, Debug, PartialEq)]
3227 #[non_exhaustive]
3228 pub enum Authentication {
3229 Unspecified,
3230 Multiple,
3231 Single,
3232 None,
3233 /// If set, the enum was initialized with an unknown value.
3234 ///
3235 /// Applications can examine the value using [Authentication::value] or
3236 /// [Authentication::name].
3237 UnknownValue(authentication::UnknownValue),
3238 }
3239
3240 #[doc(hidden)]
3241 pub mod authentication {
3242 #[allow(unused_imports)]
3243 use super::*;
3244 #[derive(Clone, Debug, PartialEq)]
3245 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3246 }
3247
3248 impl Authentication {
3249 /// Gets the enum value.
3250 ///
3251 /// Returns `None` if the enum contains an unknown value deserialized from
3252 /// the string representation of enums.
3253 pub fn value(&self) -> std::option::Option<i32> {
3254 match self {
3255 Self::Unspecified => std::option::Option::Some(0),
3256 Self::Multiple => std::option::Option::Some(1),
3257 Self::Single => std::option::Option::Some(2),
3258 Self::None => std::option::Option::Some(3),
3259 Self::UnknownValue(u) => u.0.value(),
3260 }
3261 }
3262
3263 /// Gets the enum value as a string.
3264 ///
3265 /// Returns `None` if the enum contains an unknown value deserialized from
3266 /// the integer representation of enums.
3267 pub fn name(&self) -> std::option::Option<&str> {
3268 match self {
3269 Self::Unspecified => std::option::Option::Some("AUTHENTICATION_UNSPECIFIED"),
3270 Self::Multiple => std::option::Option::Some("AUTHENTICATION_MULTIPLE"),
3271 Self::Single => std::option::Option::Some("AUTHENTICATION_SINGLE"),
3272 Self::None => std::option::Option::Some("AUTHENTICATION_NONE"),
3273 Self::UnknownValue(u) => u.0.name(),
3274 }
3275 }
3276 }
3277
3278 impl std::default::Default for Authentication {
3279 fn default() -> Self {
3280 use std::convert::From;
3281 Self::from(0)
3282 }
3283 }
3284
3285 impl std::fmt::Display for Authentication {
3286 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3287 wkt::internal::display_enum(f, self.name(), self.value())
3288 }
3289 }
3290
3291 impl std::convert::From<i32> for Authentication {
3292 fn from(value: i32) -> Self {
3293 match value {
3294 0 => Self::Unspecified,
3295 1 => Self::Multiple,
3296 2 => Self::Single,
3297 3 => Self::None,
3298 _ => Self::UnknownValue(authentication::UnknownValue(
3299 wkt::internal::UnknownEnumValue::Integer(value),
3300 )),
3301 }
3302 }
3303 }
3304
3305 impl std::convert::From<&str> for Authentication {
3306 fn from(value: &str) -> Self {
3307 use std::string::ToString;
3308 match value {
3309 "AUTHENTICATION_UNSPECIFIED" => Self::Unspecified,
3310 "AUTHENTICATION_MULTIPLE" => Self::Multiple,
3311 "AUTHENTICATION_SINGLE" => Self::Single,
3312 "AUTHENTICATION_NONE" => Self::None,
3313 _ => Self::UnknownValue(authentication::UnknownValue(
3314 wkt::internal::UnknownEnumValue::String(value.to_string()),
3315 )),
3316 }
3317 }
3318 }
3319
3320 impl serde::ser::Serialize for Authentication {
3321 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3322 where
3323 S: serde::Serializer,
3324 {
3325 match self {
3326 Self::Unspecified => serializer.serialize_i32(0),
3327 Self::Multiple => serializer.serialize_i32(1),
3328 Self::Single => serializer.serialize_i32(2),
3329 Self::None => serializer.serialize_i32(3),
3330 Self::UnknownValue(u) => u.0.serialize(serializer),
3331 }
3332 }
3333 }
3334
3335 impl<'de> serde::de::Deserialize<'de> for Authentication {
3336 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3337 where
3338 D: serde::Deserializer<'de>,
3339 {
3340 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Authentication>::new(
3341 ".grafeas.v1.CVSS.Authentication",
3342 ))
3343 }
3344 }
3345
3346 ///
3347 /// # Working with unknown values
3348 ///
3349 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3350 /// additional enum variants at any time. Adding new variants is not considered
3351 /// a breaking change. Applications should write their code in anticipation of:
3352 ///
3353 /// - New values appearing in future releases of the client library, **and**
3354 /// - New values received dynamically, without application changes.
3355 ///
3356 /// Please consult the [Working with enums] section in the user guide for some
3357 /// guidelines.
3358 ///
3359 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3360 #[derive(Clone, Debug, PartialEq)]
3361 #[non_exhaustive]
3362 pub enum PrivilegesRequired {
3363 Unspecified,
3364 None,
3365 Low,
3366 High,
3367 /// If set, the enum was initialized with an unknown value.
3368 ///
3369 /// Applications can examine the value using [PrivilegesRequired::value] or
3370 /// [PrivilegesRequired::name].
3371 UnknownValue(privileges_required::UnknownValue),
3372 }
3373
3374 #[doc(hidden)]
3375 pub mod privileges_required {
3376 #[allow(unused_imports)]
3377 use super::*;
3378 #[derive(Clone, Debug, PartialEq)]
3379 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3380 }
3381
3382 impl PrivilegesRequired {
3383 /// Gets the enum value.
3384 ///
3385 /// Returns `None` if the enum contains an unknown value deserialized from
3386 /// the string representation of enums.
3387 pub fn value(&self) -> std::option::Option<i32> {
3388 match self {
3389 Self::Unspecified => std::option::Option::Some(0),
3390 Self::None => std::option::Option::Some(1),
3391 Self::Low => std::option::Option::Some(2),
3392 Self::High => std::option::Option::Some(3),
3393 Self::UnknownValue(u) => u.0.value(),
3394 }
3395 }
3396
3397 /// Gets the enum value as a string.
3398 ///
3399 /// Returns `None` if the enum contains an unknown value deserialized from
3400 /// the integer representation of enums.
3401 pub fn name(&self) -> std::option::Option<&str> {
3402 match self {
3403 Self::Unspecified => std::option::Option::Some("PRIVILEGES_REQUIRED_UNSPECIFIED"),
3404 Self::None => std::option::Option::Some("PRIVILEGES_REQUIRED_NONE"),
3405 Self::Low => std::option::Option::Some("PRIVILEGES_REQUIRED_LOW"),
3406 Self::High => std::option::Option::Some("PRIVILEGES_REQUIRED_HIGH"),
3407 Self::UnknownValue(u) => u.0.name(),
3408 }
3409 }
3410 }
3411
3412 impl std::default::Default for PrivilegesRequired {
3413 fn default() -> Self {
3414 use std::convert::From;
3415 Self::from(0)
3416 }
3417 }
3418
3419 impl std::fmt::Display for PrivilegesRequired {
3420 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3421 wkt::internal::display_enum(f, self.name(), self.value())
3422 }
3423 }
3424
3425 impl std::convert::From<i32> for PrivilegesRequired {
3426 fn from(value: i32) -> Self {
3427 match value {
3428 0 => Self::Unspecified,
3429 1 => Self::None,
3430 2 => Self::Low,
3431 3 => Self::High,
3432 _ => Self::UnknownValue(privileges_required::UnknownValue(
3433 wkt::internal::UnknownEnumValue::Integer(value),
3434 )),
3435 }
3436 }
3437 }
3438
3439 impl std::convert::From<&str> for PrivilegesRequired {
3440 fn from(value: &str) -> Self {
3441 use std::string::ToString;
3442 match value {
3443 "PRIVILEGES_REQUIRED_UNSPECIFIED" => Self::Unspecified,
3444 "PRIVILEGES_REQUIRED_NONE" => Self::None,
3445 "PRIVILEGES_REQUIRED_LOW" => Self::Low,
3446 "PRIVILEGES_REQUIRED_HIGH" => Self::High,
3447 _ => Self::UnknownValue(privileges_required::UnknownValue(
3448 wkt::internal::UnknownEnumValue::String(value.to_string()),
3449 )),
3450 }
3451 }
3452 }
3453
3454 impl serde::ser::Serialize for PrivilegesRequired {
3455 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3456 where
3457 S: serde::Serializer,
3458 {
3459 match self {
3460 Self::Unspecified => serializer.serialize_i32(0),
3461 Self::None => serializer.serialize_i32(1),
3462 Self::Low => serializer.serialize_i32(2),
3463 Self::High => serializer.serialize_i32(3),
3464 Self::UnknownValue(u) => u.0.serialize(serializer),
3465 }
3466 }
3467 }
3468
3469 impl<'de> serde::de::Deserialize<'de> for PrivilegesRequired {
3470 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3471 where
3472 D: serde::Deserializer<'de>,
3473 {
3474 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PrivilegesRequired>::new(
3475 ".grafeas.v1.CVSS.PrivilegesRequired",
3476 ))
3477 }
3478 }
3479
3480 ///
3481 /// # Working with unknown values
3482 ///
3483 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3484 /// additional enum variants at any time. Adding new variants is not considered
3485 /// a breaking change. Applications should write their code in anticipation of:
3486 ///
3487 /// - New values appearing in future releases of the client library, **and**
3488 /// - New values received dynamically, without application changes.
3489 ///
3490 /// Please consult the [Working with enums] section in the user guide for some
3491 /// guidelines.
3492 ///
3493 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3494 #[derive(Clone, Debug, PartialEq)]
3495 #[non_exhaustive]
3496 pub enum UserInteraction {
3497 Unspecified,
3498 None,
3499 Required,
3500 /// If set, the enum was initialized with an unknown value.
3501 ///
3502 /// Applications can examine the value using [UserInteraction::value] or
3503 /// [UserInteraction::name].
3504 UnknownValue(user_interaction::UnknownValue),
3505 }
3506
3507 #[doc(hidden)]
3508 pub mod user_interaction {
3509 #[allow(unused_imports)]
3510 use super::*;
3511 #[derive(Clone, Debug, PartialEq)]
3512 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3513 }
3514
3515 impl UserInteraction {
3516 /// Gets the enum value.
3517 ///
3518 /// Returns `None` if the enum contains an unknown value deserialized from
3519 /// the string representation of enums.
3520 pub fn value(&self) -> std::option::Option<i32> {
3521 match self {
3522 Self::Unspecified => std::option::Option::Some(0),
3523 Self::None => std::option::Option::Some(1),
3524 Self::Required => std::option::Option::Some(2),
3525 Self::UnknownValue(u) => u.0.value(),
3526 }
3527 }
3528
3529 /// Gets the enum value as a string.
3530 ///
3531 /// Returns `None` if the enum contains an unknown value deserialized from
3532 /// the integer representation of enums.
3533 pub fn name(&self) -> std::option::Option<&str> {
3534 match self {
3535 Self::Unspecified => std::option::Option::Some("USER_INTERACTION_UNSPECIFIED"),
3536 Self::None => std::option::Option::Some("USER_INTERACTION_NONE"),
3537 Self::Required => std::option::Option::Some("USER_INTERACTION_REQUIRED"),
3538 Self::UnknownValue(u) => u.0.name(),
3539 }
3540 }
3541 }
3542
3543 impl std::default::Default for UserInteraction {
3544 fn default() -> Self {
3545 use std::convert::From;
3546 Self::from(0)
3547 }
3548 }
3549
3550 impl std::fmt::Display for UserInteraction {
3551 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3552 wkt::internal::display_enum(f, self.name(), self.value())
3553 }
3554 }
3555
3556 impl std::convert::From<i32> for UserInteraction {
3557 fn from(value: i32) -> Self {
3558 match value {
3559 0 => Self::Unspecified,
3560 1 => Self::None,
3561 2 => Self::Required,
3562 _ => Self::UnknownValue(user_interaction::UnknownValue(
3563 wkt::internal::UnknownEnumValue::Integer(value),
3564 )),
3565 }
3566 }
3567 }
3568
3569 impl std::convert::From<&str> for UserInteraction {
3570 fn from(value: &str) -> Self {
3571 use std::string::ToString;
3572 match value {
3573 "USER_INTERACTION_UNSPECIFIED" => Self::Unspecified,
3574 "USER_INTERACTION_NONE" => Self::None,
3575 "USER_INTERACTION_REQUIRED" => Self::Required,
3576 _ => Self::UnknownValue(user_interaction::UnknownValue(
3577 wkt::internal::UnknownEnumValue::String(value.to_string()),
3578 )),
3579 }
3580 }
3581 }
3582
3583 impl serde::ser::Serialize for UserInteraction {
3584 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3585 where
3586 S: serde::Serializer,
3587 {
3588 match self {
3589 Self::Unspecified => serializer.serialize_i32(0),
3590 Self::None => serializer.serialize_i32(1),
3591 Self::Required => serializer.serialize_i32(2),
3592 Self::UnknownValue(u) => u.0.serialize(serializer),
3593 }
3594 }
3595 }
3596
3597 impl<'de> serde::de::Deserialize<'de> for UserInteraction {
3598 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3599 where
3600 D: serde::Deserializer<'de>,
3601 {
3602 deserializer.deserialize_any(wkt::internal::EnumVisitor::<UserInteraction>::new(
3603 ".grafeas.v1.CVSS.UserInteraction",
3604 ))
3605 }
3606 }
3607
3608 ///
3609 /// # Working with unknown values
3610 ///
3611 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3612 /// additional enum variants at any time. Adding new variants is not considered
3613 /// a breaking change. Applications should write their code in anticipation of:
3614 ///
3615 /// - New values appearing in future releases of the client library, **and**
3616 /// - New values received dynamically, without application changes.
3617 ///
3618 /// Please consult the [Working with enums] section in the user guide for some
3619 /// guidelines.
3620 ///
3621 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3622 #[derive(Clone, Debug, PartialEq)]
3623 #[non_exhaustive]
3624 pub enum Scope {
3625 Unspecified,
3626 Unchanged,
3627 Changed,
3628 /// If set, the enum was initialized with an unknown value.
3629 ///
3630 /// Applications can examine the value using [Scope::value] or
3631 /// [Scope::name].
3632 UnknownValue(scope::UnknownValue),
3633 }
3634
3635 #[doc(hidden)]
3636 pub mod scope {
3637 #[allow(unused_imports)]
3638 use super::*;
3639 #[derive(Clone, Debug, PartialEq)]
3640 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3641 }
3642
3643 impl Scope {
3644 /// Gets the enum value.
3645 ///
3646 /// Returns `None` if the enum contains an unknown value deserialized from
3647 /// the string representation of enums.
3648 pub fn value(&self) -> std::option::Option<i32> {
3649 match self {
3650 Self::Unspecified => std::option::Option::Some(0),
3651 Self::Unchanged => std::option::Option::Some(1),
3652 Self::Changed => std::option::Option::Some(2),
3653 Self::UnknownValue(u) => u.0.value(),
3654 }
3655 }
3656
3657 /// Gets the enum value as a string.
3658 ///
3659 /// Returns `None` if the enum contains an unknown value deserialized from
3660 /// the integer representation of enums.
3661 pub fn name(&self) -> std::option::Option<&str> {
3662 match self {
3663 Self::Unspecified => std::option::Option::Some("SCOPE_UNSPECIFIED"),
3664 Self::Unchanged => std::option::Option::Some("SCOPE_UNCHANGED"),
3665 Self::Changed => std::option::Option::Some("SCOPE_CHANGED"),
3666 Self::UnknownValue(u) => u.0.name(),
3667 }
3668 }
3669 }
3670
3671 impl std::default::Default for Scope {
3672 fn default() -> Self {
3673 use std::convert::From;
3674 Self::from(0)
3675 }
3676 }
3677
3678 impl std::fmt::Display for Scope {
3679 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3680 wkt::internal::display_enum(f, self.name(), self.value())
3681 }
3682 }
3683
3684 impl std::convert::From<i32> for Scope {
3685 fn from(value: i32) -> Self {
3686 match value {
3687 0 => Self::Unspecified,
3688 1 => Self::Unchanged,
3689 2 => Self::Changed,
3690 _ => Self::UnknownValue(scope::UnknownValue(
3691 wkt::internal::UnknownEnumValue::Integer(value),
3692 )),
3693 }
3694 }
3695 }
3696
3697 impl std::convert::From<&str> for Scope {
3698 fn from(value: &str) -> Self {
3699 use std::string::ToString;
3700 match value {
3701 "SCOPE_UNSPECIFIED" => Self::Unspecified,
3702 "SCOPE_UNCHANGED" => Self::Unchanged,
3703 "SCOPE_CHANGED" => Self::Changed,
3704 _ => Self::UnknownValue(scope::UnknownValue(
3705 wkt::internal::UnknownEnumValue::String(value.to_string()),
3706 )),
3707 }
3708 }
3709 }
3710
3711 impl serde::ser::Serialize for Scope {
3712 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3713 where
3714 S: serde::Serializer,
3715 {
3716 match self {
3717 Self::Unspecified => serializer.serialize_i32(0),
3718 Self::Unchanged => serializer.serialize_i32(1),
3719 Self::Changed => serializer.serialize_i32(2),
3720 Self::UnknownValue(u) => u.0.serialize(serializer),
3721 }
3722 }
3723 }
3724
3725 impl<'de> serde::de::Deserialize<'de> for Scope {
3726 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3727 where
3728 D: serde::Deserializer<'de>,
3729 {
3730 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Scope>::new(
3731 ".grafeas.v1.CVSS.Scope",
3732 ))
3733 }
3734 }
3735
3736 ///
3737 /// # Working with unknown values
3738 ///
3739 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3740 /// additional enum variants at any time. Adding new variants is not considered
3741 /// a breaking change. Applications should write their code in anticipation of:
3742 ///
3743 /// - New values appearing in future releases of the client library, **and**
3744 /// - New values received dynamically, without application changes.
3745 ///
3746 /// Please consult the [Working with enums] section in the user guide for some
3747 /// guidelines.
3748 ///
3749 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3750 #[derive(Clone, Debug, PartialEq)]
3751 #[non_exhaustive]
3752 pub enum Impact {
3753 Unspecified,
3754 High,
3755 Low,
3756 None,
3757 Partial,
3758 Complete,
3759 /// If set, the enum was initialized with an unknown value.
3760 ///
3761 /// Applications can examine the value using [Impact::value] or
3762 /// [Impact::name].
3763 UnknownValue(impact::UnknownValue),
3764 }
3765
3766 #[doc(hidden)]
3767 pub mod impact {
3768 #[allow(unused_imports)]
3769 use super::*;
3770 #[derive(Clone, Debug, PartialEq)]
3771 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3772 }
3773
3774 impl Impact {
3775 /// Gets the enum value.
3776 ///
3777 /// Returns `None` if the enum contains an unknown value deserialized from
3778 /// the string representation of enums.
3779 pub fn value(&self) -> std::option::Option<i32> {
3780 match self {
3781 Self::Unspecified => std::option::Option::Some(0),
3782 Self::High => std::option::Option::Some(1),
3783 Self::Low => std::option::Option::Some(2),
3784 Self::None => std::option::Option::Some(3),
3785 Self::Partial => std::option::Option::Some(4),
3786 Self::Complete => std::option::Option::Some(5),
3787 Self::UnknownValue(u) => u.0.value(),
3788 }
3789 }
3790
3791 /// Gets the enum value as a string.
3792 ///
3793 /// Returns `None` if the enum contains an unknown value deserialized from
3794 /// the integer representation of enums.
3795 pub fn name(&self) -> std::option::Option<&str> {
3796 match self {
3797 Self::Unspecified => std::option::Option::Some("IMPACT_UNSPECIFIED"),
3798 Self::High => std::option::Option::Some("IMPACT_HIGH"),
3799 Self::Low => std::option::Option::Some("IMPACT_LOW"),
3800 Self::None => std::option::Option::Some("IMPACT_NONE"),
3801 Self::Partial => std::option::Option::Some("IMPACT_PARTIAL"),
3802 Self::Complete => std::option::Option::Some("IMPACT_COMPLETE"),
3803 Self::UnknownValue(u) => u.0.name(),
3804 }
3805 }
3806 }
3807
3808 impl std::default::Default for Impact {
3809 fn default() -> Self {
3810 use std::convert::From;
3811 Self::from(0)
3812 }
3813 }
3814
3815 impl std::fmt::Display for Impact {
3816 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3817 wkt::internal::display_enum(f, self.name(), self.value())
3818 }
3819 }
3820
3821 impl std::convert::From<i32> for Impact {
3822 fn from(value: i32) -> Self {
3823 match value {
3824 0 => Self::Unspecified,
3825 1 => Self::High,
3826 2 => Self::Low,
3827 3 => Self::None,
3828 4 => Self::Partial,
3829 5 => Self::Complete,
3830 _ => Self::UnknownValue(impact::UnknownValue(
3831 wkt::internal::UnknownEnumValue::Integer(value),
3832 )),
3833 }
3834 }
3835 }
3836
3837 impl std::convert::From<&str> for Impact {
3838 fn from(value: &str) -> Self {
3839 use std::string::ToString;
3840 match value {
3841 "IMPACT_UNSPECIFIED" => Self::Unspecified,
3842 "IMPACT_HIGH" => Self::High,
3843 "IMPACT_LOW" => Self::Low,
3844 "IMPACT_NONE" => Self::None,
3845 "IMPACT_PARTIAL" => Self::Partial,
3846 "IMPACT_COMPLETE" => Self::Complete,
3847 _ => Self::UnknownValue(impact::UnknownValue(
3848 wkt::internal::UnknownEnumValue::String(value.to_string()),
3849 )),
3850 }
3851 }
3852 }
3853
3854 impl serde::ser::Serialize for Impact {
3855 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3856 where
3857 S: serde::Serializer,
3858 {
3859 match self {
3860 Self::Unspecified => serializer.serialize_i32(0),
3861 Self::High => serializer.serialize_i32(1),
3862 Self::Low => serializer.serialize_i32(2),
3863 Self::None => serializer.serialize_i32(3),
3864 Self::Partial => serializer.serialize_i32(4),
3865 Self::Complete => serializer.serialize_i32(5),
3866 Self::UnknownValue(u) => u.0.serialize(serializer),
3867 }
3868 }
3869 }
3870
3871 impl<'de> serde::de::Deserialize<'de> for Impact {
3872 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3873 where
3874 D: serde::Deserializer<'de>,
3875 {
3876 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Impact>::new(
3877 ".grafeas.v1.CVSS.Impact",
3878 ))
3879 }
3880 }
3881}
3882
3883/// An artifact that can be deployed in some runtime.
3884#[derive(Clone, Default, PartialEq)]
3885#[non_exhaustive]
3886pub struct DeploymentNote {
3887 /// Required. Resource URI for the artifact being deployed.
3888 pub resource_uri: std::vec::Vec<std::string::String>,
3889
3890 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3891}
3892
3893impl DeploymentNote {
3894 pub fn new() -> Self {
3895 std::default::Default::default()
3896 }
3897
3898 /// Sets the value of [resource_uri][crate::model::DeploymentNote::resource_uri].
3899 ///
3900 /// # Example
3901 /// ```ignore,no_run
3902 /// # use google_cloud_grafeas_v1::model::DeploymentNote;
3903 /// let x = DeploymentNote::new().set_resource_uri(["a", "b", "c"]);
3904 /// ```
3905 pub fn set_resource_uri<T, V>(mut self, v: T) -> Self
3906 where
3907 T: std::iter::IntoIterator<Item = V>,
3908 V: std::convert::Into<std::string::String>,
3909 {
3910 use std::iter::Iterator;
3911 self.resource_uri = v.into_iter().map(|i| i.into()).collect();
3912 self
3913 }
3914}
3915
3916impl wkt::message::Message for DeploymentNote {
3917 fn typename() -> &'static str {
3918 "type.googleapis.com/grafeas.v1.DeploymentNote"
3919 }
3920}
3921
3922/// The period during which some deployable was active in a runtime.
3923#[derive(Clone, Default, PartialEq)]
3924#[non_exhaustive]
3925pub struct DeploymentOccurrence {
3926 /// Identity of the user that triggered this deployment.
3927 pub user_email: std::string::String,
3928
3929 /// Required. Beginning of the lifetime of this deployment.
3930 pub deploy_time: std::option::Option<wkt::Timestamp>,
3931
3932 /// End of the lifetime of this deployment.
3933 pub undeploy_time: std::option::Option<wkt::Timestamp>,
3934
3935 /// Configuration used to create this deployment.
3936 pub config: std::string::String,
3937
3938 /// Address of the runtime element hosting this deployment.
3939 pub address: std::string::String,
3940
3941 /// Output only. Resource URI for the artifact being deployed taken from
3942 /// the deployable field with the same name.
3943 pub resource_uri: std::vec::Vec<std::string::String>,
3944
3945 /// Platform hosting this deployment.
3946 pub platform: crate::model::deployment_occurrence::Platform,
3947
3948 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3949}
3950
3951impl DeploymentOccurrence {
3952 pub fn new() -> Self {
3953 std::default::Default::default()
3954 }
3955
3956 /// Sets the value of [user_email][crate::model::DeploymentOccurrence::user_email].
3957 ///
3958 /// # Example
3959 /// ```ignore,no_run
3960 /// # use google_cloud_grafeas_v1::model::DeploymentOccurrence;
3961 /// let x = DeploymentOccurrence::new().set_user_email("example");
3962 /// ```
3963 pub fn set_user_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3964 self.user_email = v.into();
3965 self
3966 }
3967
3968 /// Sets the value of [deploy_time][crate::model::DeploymentOccurrence::deploy_time].
3969 ///
3970 /// # Example
3971 /// ```ignore,no_run
3972 /// # use google_cloud_grafeas_v1::model::DeploymentOccurrence;
3973 /// use wkt::Timestamp;
3974 /// let x = DeploymentOccurrence::new().set_deploy_time(Timestamp::default()/* use setters */);
3975 /// ```
3976 pub fn set_deploy_time<T>(mut self, v: T) -> Self
3977 where
3978 T: std::convert::Into<wkt::Timestamp>,
3979 {
3980 self.deploy_time = std::option::Option::Some(v.into());
3981 self
3982 }
3983
3984 /// Sets or clears the value of [deploy_time][crate::model::DeploymentOccurrence::deploy_time].
3985 ///
3986 /// # Example
3987 /// ```ignore,no_run
3988 /// # use google_cloud_grafeas_v1::model::DeploymentOccurrence;
3989 /// use wkt::Timestamp;
3990 /// let x = DeploymentOccurrence::new().set_or_clear_deploy_time(Some(Timestamp::default()/* use setters */));
3991 /// let x = DeploymentOccurrence::new().set_or_clear_deploy_time(None::<Timestamp>);
3992 /// ```
3993 pub fn set_or_clear_deploy_time<T>(mut self, v: std::option::Option<T>) -> Self
3994 where
3995 T: std::convert::Into<wkt::Timestamp>,
3996 {
3997 self.deploy_time = v.map(|x| x.into());
3998 self
3999 }
4000
4001 /// Sets the value of [undeploy_time][crate::model::DeploymentOccurrence::undeploy_time].
4002 ///
4003 /// # Example
4004 /// ```ignore,no_run
4005 /// # use google_cloud_grafeas_v1::model::DeploymentOccurrence;
4006 /// use wkt::Timestamp;
4007 /// let x = DeploymentOccurrence::new().set_undeploy_time(Timestamp::default()/* use setters */);
4008 /// ```
4009 pub fn set_undeploy_time<T>(mut self, v: T) -> Self
4010 where
4011 T: std::convert::Into<wkt::Timestamp>,
4012 {
4013 self.undeploy_time = std::option::Option::Some(v.into());
4014 self
4015 }
4016
4017 /// Sets or clears the value of [undeploy_time][crate::model::DeploymentOccurrence::undeploy_time].
4018 ///
4019 /// # Example
4020 /// ```ignore,no_run
4021 /// # use google_cloud_grafeas_v1::model::DeploymentOccurrence;
4022 /// use wkt::Timestamp;
4023 /// let x = DeploymentOccurrence::new().set_or_clear_undeploy_time(Some(Timestamp::default()/* use setters */));
4024 /// let x = DeploymentOccurrence::new().set_or_clear_undeploy_time(None::<Timestamp>);
4025 /// ```
4026 pub fn set_or_clear_undeploy_time<T>(mut self, v: std::option::Option<T>) -> Self
4027 where
4028 T: std::convert::Into<wkt::Timestamp>,
4029 {
4030 self.undeploy_time = v.map(|x| x.into());
4031 self
4032 }
4033
4034 /// Sets the value of [config][crate::model::DeploymentOccurrence::config].
4035 ///
4036 /// # Example
4037 /// ```ignore,no_run
4038 /// # use google_cloud_grafeas_v1::model::DeploymentOccurrence;
4039 /// let x = DeploymentOccurrence::new().set_config("example");
4040 /// ```
4041 pub fn set_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4042 self.config = v.into();
4043 self
4044 }
4045
4046 /// Sets the value of [address][crate::model::DeploymentOccurrence::address].
4047 ///
4048 /// # Example
4049 /// ```ignore,no_run
4050 /// # use google_cloud_grafeas_v1::model::DeploymentOccurrence;
4051 /// let x = DeploymentOccurrence::new().set_address("example");
4052 /// ```
4053 pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4054 self.address = v.into();
4055 self
4056 }
4057
4058 /// Sets the value of [resource_uri][crate::model::DeploymentOccurrence::resource_uri].
4059 ///
4060 /// # Example
4061 /// ```ignore,no_run
4062 /// # use google_cloud_grafeas_v1::model::DeploymentOccurrence;
4063 /// let x = DeploymentOccurrence::new().set_resource_uri(["a", "b", "c"]);
4064 /// ```
4065 pub fn set_resource_uri<T, V>(mut self, v: T) -> Self
4066 where
4067 T: std::iter::IntoIterator<Item = V>,
4068 V: std::convert::Into<std::string::String>,
4069 {
4070 use std::iter::Iterator;
4071 self.resource_uri = v.into_iter().map(|i| i.into()).collect();
4072 self
4073 }
4074
4075 /// Sets the value of [platform][crate::model::DeploymentOccurrence::platform].
4076 ///
4077 /// # Example
4078 /// ```ignore,no_run
4079 /// # use google_cloud_grafeas_v1::model::DeploymentOccurrence;
4080 /// use google_cloud_grafeas_v1::model::deployment_occurrence::Platform;
4081 /// let x0 = DeploymentOccurrence::new().set_platform(Platform::Gke);
4082 /// let x1 = DeploymentOccurrence::new().set_platform(Platform::Flex);
4083 /// let x2 = DeploymentOccurrence::new().set_platform(Platform::Custom);
4084 /// ```
4085 pub fn set_platform<T: std::convert::Into<crate::model::deployment_occurrence::Platform>>(
4086 mut self,
4087 v: T,
4088 ) -> Self {
4089 self.platform = v.into();
4090 self
4091 }
4092}
4093
4094impl wkt::message::Message for DeploymentOccurrence {
4095 fn typename() -> &'static str {
4096 "type.googleapis.com/grafeas.v1.DeploymentOccurrence"
4097 }
4098}
4099
4100/// Defines additional types related to [DeploymentOccurrence].
4101pub mod deployment_occurrence {
4102 #[allow(unused_imports)]
4103 use super::*;
4104
4105 /// Types of platforms.
4106 ///
4107 /// # Working with unknown values
4108 ///
4109 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4110 /// additional enum variants at any time. Adding new variants is not considered
4111 /// a breaking change. Applications should write their code in anticipation of:
4112 ///
4113 /// - New values appearing in future releases of the client library, **and**
4114 /// - New values received dynamically, without application changes.
4115 ///
4116 /// Please consult the [Working with enums] section in the user guide for some
4117 /// guidelines.
4118 ///
4119 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4120 #[derive(Clone, Debug, PartialEq)]
4121 #[non_exhaustive]
4122 pub enum Platform {
4123 /// Unknown.
4124 Unspecified,
4125 /// Google Container Engine.
4126 Gke,
4127 /// Google App Engine: Flexible Environment.
4128 Flex,
4129 /// Custom user-defined platform.
4130 Custom,
4131 /// If set, the enum was initialized with an unknown value.
4132 ///
4133 /// Applications can examine the value using [Platform::value] or
4134 /// [Platform::name].
4135 UnknownValue(platform::UnknownValue),
4136 }
4137
4138 #[doc(hidden)]
4139 pub mod platform {
4140 #[allow(unused_imports)]
4141 use super::*;
4142 #[derive(Clone, Debug, PartialEq)]
4143 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4144 }
4145
4146 impl Platform {
4147 /// Gets the enum value.
4148 ///
4149 /// Returns `None` if the enum contains an unknown value deserialized from
4150 /// the string representation of enums.
4151 pub fn value(&self) -> std::option::Option<i32> {
4152 match self {
4153 Self::Unspecified => std::option::Option::Some(0),
4154 Self::Gke => std::option::Option::Some(1),
4155 Self::Flex => std::option::Option::Some(2),
4156 Self::Custom => std::option::Option::Some(3),
4157 Self::UnknownValue(u) => u.0.value(),
4158 }
4159 }
4160
4161 /// Gets the enum value as a string.
4162 ///
4163 /// Returns `None` if the enum contains an unknown value deserialized from
4164 /// the integer representation of enums.
4165 pub fn name(&self) -> std::option::Option<&str> {
4166 match self {
4167 Self::Unspecified => std::option::Option::Some("PLATFORM_UNSPECIFIED"),
4168 Self::Gke => std::option::Option::Some("GKE"),
4169 Self::Flex => std::option::Option::Some("FLEX"),
4170 Self::Custom => std::option::Option::Some("CUSTOM"),
4171 Self::UnknownValue(u) => u.0.name(),
4172 }
4173 }
4174 }
4175
4176 impl std::default::Default for Platform {
4177 fn default() -> Self {
4178 use std::convert::From;
4179 Self::from(0)
4180 }
4181 }
4182
4183 impl std::fmt::Display for Platform {
4184 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4185 wkt::internal::display_enum(f, self.name(), self.value())
4186 }
4187 }
4188
4189 impl std::convert::From<i32> for Platform {
4190 fn from(value: i32) -> Self {
4191 match value {
4192 0 => Self::Unspecified,
4193 1 => Self::Gke,
4194 2 => Self::Flex,
4195 3 => Self::Custom,
4196 _ => Self::UnknownValue(platform::UnknownValue(
4197 wkt::internal::UnknownEnumValue::Integer(value),
4198 )),
4199 }
4200 }
4201 }
4202
4203 impl std::convert::From<&str> for Platform {
4204 fn from(value: &str) -> Self {
4205 use std::string::ToString;
4206 match value {
4207 "PLATFORM_UNSPECIFIED" => Self::Unspecified,
4208 "GKE" => Self::Gke,
4209 "FLEX" => Self::Flex,
4210 "CUSTOM" => Self::Custom,
4211 _ => Self::UnknownValue(platform::UnknownValue(
4212 wkt::internal::UnknownEnumValue::String(value.to_string()),
4213 )),
4214 }
4215 }
4216 }
4217
4218 impl serde::ser::Serialize for Platform {
4219 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4220 where
4221 S: serde::Serializer,
4222 {
4223 match self {
4224 Self::Unspecified => serializer.serialize_i32(0),
4225 Self::Gke => serializer.serialize_i32(1),
4226 Self::Flex => serializer.serialize_i32(2),
4227 Self::Custom => serializer.serialize_i32(3),
4228 Self::UnknownValue(u) => u.0.serialize(serializer),
4229 }
4230 }
4231 }
4232
4233 impl<'de> serde::de::Deserialize<'de> for Platform {
4234 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4235 where
4236 D: serde::Deserializer<'de>,
4237 {
4238 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Platform>::new(
4239 ".grafeas.v1.DeploymentOccurrence.Platform",
4240 ))
4241 }
4242 }
4243}
4244
4245/// A note that indicates a type of analysis a provider would perform. This note
4246/// exists in a provider's project. A `Discovery` occurrence is created in a
4247/// consumer's project at the start of analysis.
4248#[derive(Clone, Default, PartialEq)]
4249#[non_exhaustive]
4250pub struct DiscoveryNote {
4251 /// Required. Immutable. The kind of analysis that is handled by this
4252 /// discovery.
4253 pub analysis_kind: crate::model::NoteKind,
4254
4255 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4256}
4257
4258impl DiscoveryNote {
4259 pub fn new() -> Self {
4260 std::default::Default::default()
4261 }
4262
4263 /// Sets the value of [analysis_kind][crate::model::DiscoveryNote::analysis_kind].
4264 ///
4265 /// # Example
4266 /// ```ignore,no_run
4267 /// # use google_cloud_grafeas_v1::model::DiscoveryNote;
4268 /// use google_cloud_grafeas_v1::model::NoteKind;
4269 /// let x0 = DiscoveryNote::new().set_analysis_kind(NoteKind::Vulnerability);
4270 /// let x1 = DiscoveryNote::new().set_analysis_kind(NoteKind::Build);
4271 /// let x2 = DiscoveryNote::new().set_analysis_kind(NoteKind::Image);
4272 /// ```
4273 pub fn set_analysis_kind<T: std::convert::Into<crate::model::NoteKind>>(
4274 mut self,
4275 v: T,
4276 ) -> Self {
4277 self.analysis_kind = v.into();
4278 self
4279 }
4280}
4281
4282impl wkt::message::Message for DiscoveryNote {
4283 fn typename() -> &'static str {
4284 "type.googleapis.com/grafeas.v1.DiscoveryNote"
4285 }
4286}
4287
4288/// Provides information about the analysis status of a discovered resource.
4289#[derive(Clone, Default, PartialEq)]
4290#[non_exhaustive]
4291pub struct DiscoveryOccurrence {
4292 /// Whether the resource is continuously analyzed.
4293 pub continuous_analysis: crate::model::discovery_occurrence::ContinuousAnalysis,
4294
4295 /// The status of discovery for the resource.
4296 pub analysis_status: crate::model::discovery_occurrence::AnalysisStatus,
4297
4298 pub analysis_completed:
4299 std::option::Option<crate::model::discovery_occurrence::AnalysisCompleted>,
4300
4301 /// Indicates any errors encountered during analysis of a resource. There
4302 /// could be 0 or more of these errors.
4303 pub analysis_error: std::vec::Vec<google_cloud_rpc::model::Status>,
4304
4305 /// When an error is encountered this will contain a LocalizedMessage under
4306 /// details to show to the user. The LocalizedMessage is output only and
4307 /// populated by the API.
4308 pub analysis_status_error: std::option::Option<google_cloud_rpc::model::Status>,
4309
4310 /// The CPE of the resource being scanned.
4311 pub cpe: std::string::String,
4312
4313 /// The last time this resource was scanned.
4314 pub last_scan_time: std::option::Option<wkt::Timestamp>,
4315
4316 /// The time occurrences related to this discovery occurrence were archived.
4317 pub archive_time: std::option::Option<wkt::Timestamp>,
4318
4319 /// The status of an SBOM generation.
4320 pub sbom_status: std::option::Option<crate::model::discovery_occurrence::SBOMStatus>,
4321
4322 /// The status of an vulnerability attestation generation.
4323 pub vulnerability_attestation:
4324 std::option::Option<crate::model::discovery_occurrence::VulnerabilityAttestation>,
4325
4326 /// Files that make up the resource described by the occurrence.
4327 pub files: std::vec::Vec<crate::model::discovery_occurrence::File>,
4328
4329 /// The last time vulnerability scan results changed.
4330 pub last_vulnerability_update_time: std::option::Option<wkt::Timestamp>,
4331
4332 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4333}
4334
4335impl DiscoveryOccurrence {
4336 pub fn new() -> Self {
4337 std::default::Default::default()
4338 }
4339
4340 /// Sets the value of [continuous_analysis][crate::model::DiscoveryOccurrence::continuous_analysis].
4341 ///
4342 /// # Example
4343 /// ```ignore,no_run
4344 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4345 /// use google_cloud_grafeas_v1::model::discovery_occurrence::ContinuousAnalysis;
4346 /// let x0 = DiscoveryOccurrence::new().set_continuous_analysis(ContinuousAnalysis::Active);
4347 /// let x1 = DiscoveryOccurrence::new().set_continuous_analysis(ContinuousAnalysis::Inactive);
4348 /// ```
4349 pub fn set_continuous_analysis<
4350 T: std::convert::Into<crate::model::discovery_occurrence::ContinuousAnalysis>,
4351 >(
4352 mut self,
4353 v: T,
4354 ) -> Self {
4355 self.continuous_analysis = v.into();
4356 self
4357 }
4358
4359 /// Sets the value of [analysis_status][crate::model::DiscoveryOccurrence::analysis_status].
4360 ///
4361 /// # Example
4362 /// ```ignore,no_run
4363 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4364 /// use google_cloud_grafeas_v1::model::discovery_occurrence::AnalysisStatus;
4365 /// let x0 = DiscoveryOccurrence::new().set_analysis_status(AnalysisStatus::Pending);
4366 /// let x1 = DiscoveryOccurrence::new().set_analysis_status(AnalysisStatus::Scanning);
4367 /// let x2 = DiscoveryOccurrence::new().set_analysis_status(AnalysisStatus::FinishedSuccess);
4368 /// ```
4369 pub fn set_analysis_status<
4370 T: std::convert::Into<crate::model::discovery_occurrence::AnalysisStatus>,
4371 >(
4372 mut self,
4373 v: T,
4374 ) -> Self {
4375 self.analysis_status = v.into();
4376 self
4377 }
4378
4379 /// Sets the value of [analysis_completed][crate::model::DiscoveryOccurrence::analysis_completed].
4380 ///
4381 /// # Example
4382 /// ```ignore,no_run
4383 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4384 /// use google_cloud_grafeas_v1::model::discovery_occurrence::AnalysisCompleted;
4385 /// let x = DiscoveryOccurrence::new().set_analysis_completed(AnalysisCompleted::default()/* use setters */);
4386 /// ```
4387 pub fn set_analysis_completed<T>(mut self, v: T) -> Self
4388 where
4389 T: std::convert::Into<crate::model::discovery_occurrence::AnalysisCompleted>,
4390 {
4391 self.analysis_completed = std::option::Option::Some(v.into());
4392 self
4393 }
4394
4395 /// Sets or clears the value of [analysis_completed][crate::model::DiscoveryOccurrence::analysis_completed].
4396 ///
4397 /// # Example
4398 /// ```ignore,no_run
4399 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4400 /// use google_cloud_grafeas_v1::model::discovery_occurrence::AnalysisCompleted;
4401 /// let x = DiscoveryOccurrence::new().set_or_clear_analysis_completed(Some(AnalysisCompleted::default()/* use setters */));
4402 /// let x = DiscoveryOccurrence::new().set_or_clear_analysis_completed(None::<AnalysisCompleted>);
4403 /// ```
4404 pub fn set_or_clear_analysis_completed<T>(mut self, v: std::option::Option<T>) -> Self
4405 where
4406 T: std::convert::Into<crate::model::discovery_occurrence::AnalysisCompleted>,
4407 {
4408 self.analysis_completed = v.map(|x| x.into());
4409 self
4410 }
4411
4412 /// Sets the value of [analysis_error][crate::model::DiscoveryOccurrence::analysis_error].
4413 ///
4414 /// # Example
4415 /// ```ignore,no_run
4416 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4417 /// use google_cloud_rpc::model::Status;
4418 /// let x = DiscoveryOccurrence::new()
4419 /// .set_analysis_error([
4420 /// Status::default()/* use setters */,
4421 /// Status::default()/* use (different) setters */,
4422 /// ]);
4423 /// ```
4424 pub fn set_analysis_error<T, V>(mut self, v: T) -> Self
4425 where
4426 T: std::iter::IntoIterator<Item = V>,
4427 V: std::convert::Into<google_cloud_rpc::model::Status>,
4428 {
4429 use std::iter::Iterator;
4430 self.analysis_error = v.into_iter().map(|i| i.into()).collect();
4431 self
4432 }
4433
4434 /// Sets the value of [analysis_status_error][crate::model::DiscoveryOccurrence::analysis_status_error].
4435 ///
4436 /// # Example
4437 /// ```ignore,no_run
4438 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4439 /// use google_cloud_rpc::model::Status;
4440 /// let x = DiscoveryOccurrence::new().set_analysis_status_error(Status::default()/* use setters */);
4441 /// ```
4442 pub fn set_analysis_status_error<T>(mut self, v: T) -> Self
4443 where
4444 T: std::convert::Into<google_cloud_rpc::model::Status>,
4445 {
4446 self.analysis_status_error = std::option::Option::Some(v.into());
4447 self
4448 }
4449
4450 /// Sets or clears the value of [analysis_status_error][crate::model::DiscoveryOccurrence::analysis_status_error].
4451 ///
4452 /// # Example
4453 /// ```ignore,no_run
4454 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4455 /// use google_cloud_rpc::model::Status;
4456 /// let x = DiscoveryOccurrence::new().set_or_clear_analysis_status_error(Some(Status::default()/* use setters */));
4457 /// let x = DiscoveryOccurrence::new().set_or_clear_analysis_status_error(None::<Status>);
4458 /// ```
4459 pub fn set_or_clear_analysis_status_error<T>(mut self, v: std::option::Option<T>) -> Self
4460 where
4461 T: std::convert::Into<google_cloud_rpc::model::Status>,
4462 {
4463 self.analysis_status_error = v.map(|x| x.into());
4464 self
4465 }
4466
4467 /// Sets the value of [cpe][crate::model::DiscoveryOccurrence::cpe].
4468 ///
4469 /// # Example
4470 /// ```ignore,no_run
4471 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4472 /// let x = DiscoveryOccurrence::new().set_cpe("example");
4473 /// ```
4474 pub fn set_cpe<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4475 self.cpe = v.into();
4476 self
4477 }
4478
4479 /// Sets the value of [last_scan_time][crate::model::DiscoveryOccurrence::last_scan_time].
4480 ///
4481 /// # Example
4482 /// ```ignore,no_run
4483 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4484 /// use wkt::Timestamp;
4485 /// let x = DiscoveryOccurrence::new().set_last_scan_time(Timestamp::default()/* use setters */);
4486 /// ```
4487 pub fn set_last_scan_time<T>(mut self, v: T) -> Self
4488 where
4489 T: std::convert::Into<wkt::Timestamp>,
4490 {
4491 self.last_scan_time = std::option::Option::Some(v.into());
4492 self
4493 }
4494
4495 /// Sets or clears the value of [last_scan_time][crate::model::DiscoveryOccurrence::last_scan_time].
4496 ///
4497 /// # Example
4498 /// ```ignore,no_run
4499 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4500 /// use wkt::Timestamp;
4501 /// let x = DiscoveryOccurrence::new().set_or_clear_last_scan_time(Some(Timestamp::default()/* use setters */));
4502 /// let x = DiscoveryOccurrence::new().set_or_clear_last_scan_time(None::<Timestamp>);
4503 /// ```
4504 pub fn set_or_clear_last_scan_time<T>(mut self, v: std::option::Option<T>) -> Self
4505 where
4506 T: std::convert::Into<wkt::Timestamp>,
4507 {
4508 self.last_scan_time = v.map(|x| x.into());
4509 self
4510 }
4511
4512 /// Sets the value of [archive_time][crate::model::DiscoveryOccurrence::archive_time].
4513 ///
4514 /// # Example
4515 /// ```ignore,no_run
4516 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4517 /// use wkt::Timestamp;
4518 /// let x = DiscoveryOccurrence::new().set_archive_time(Timestamp::default()/* use setters */);
4519 /// ```
4520 pub fn set_archive_time<T>(mut self, v: T) -> Self
4521 where
4522 T: std::convert::Into<wkt::Timestamp>,
4523 {
4524 self.archive_time = std::option::Option::Some(v.into());
4525 self
4526 }
4527
4528 /// Sets or clears the value of [archive_time][crate::model::DiscoveryOccurrence::archive_time].
4529 ///
4530 /// # Example
4531 /// ```ignore,no_run
4532 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4533 /// use wkt::Timestamp;
4534 /// let x = DiscoveryOccurrence::new().set_or_clear_archive_time(Some(Timestamp::default()/* use setters */));
4535 /// let x = DiscoveryOccurrence::new().set_or_clear_archive_time(None::<Timestamp>);
4536 /// ```
4537 pub fn set_or_clear_archive_time<T>(mut self, v: std::option::Option<T>) -> Self
4538 where
4539 T: std::convert::Into<wkt::Timestamp>,
4540 {
4541 self.archive_time = v.map(|x| x.into());
4542 self
4543 }
4544
4545 /// Sets the value of [sbom_status][crate::model::DiscoveryOccurrence::sbom_status].
4546 ///
4547 /// # Example
4548 /// ```ignore,no_run
4549 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4550 /// use google_cloud_grafeas_v1::model::discovery_occurrence::SBOMStatus;
4551 /// let x = DiscoveryOccurrence::new().set_sbom_status(SBOMStatus::default()/* use setters */);
4552 /// ```
4553 pub fn set_sbom_status<T>(mut self, v: T) -> Self
4554 where
4555 T: std::convert::Into<crate::model::discovery_occurrence::SBOMStatus>,
4556 {
4557 self.sbom_status = std::option::Option::Some(v.into());
4558 self
4559 }
4560
4561 /// Sets or clears the value of [sbom_status][crate::model::DiscoveryOccurrence::sbom_status].
4562 ///
4563 /// # Example
4564 /// ```ignore,no_run
4565 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4566 /// use google_cloud_grafeas_v1::model::discovery_occurrence::SBOMStatus;
4567 /// let x = DiscoveryOccurrence::new().set_or_clear_sbom_status(Some(SBOMStatus::default()/* use setters */));
4568 /// let x = DiscoveryOccurrence::new().set_or_clear_sbom_status(None::<SBOMStatus>);
4569 /// ```
4570 pub fn set_or_clear_sbom_status<T>(mut self, v: std::option::Option<T>) -> Self
4571 where
4572 T: std::convert::Into<crate::model::discovery_occurrence::SBOMStatus>,
4573 {
4574 self.sbom_status = v.map(|x| x.into());
4575 self
4576 }
4577
4578 /// Sets the value of [vulnerability_attestation][crate::model::DiscoveryOccurrence::vulnerability_attestation].
4579 ///
4580 /// # Example
4581 /// ```ignore,no_run
4582 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4583 /// use google_cloud_grafeas_v1::model::discovery_occurrence::VulnerabilityAttestation;
4584 /// let x = DiscoveryOccurrence::new().set_vulnerability_attestation(VulnerabilityAttestation::default()/* use setters */);
4585 /// ```
4586 pub fn set_vulnerability_attestation<T>(mut self, v: T) -> Self
4587 where
4588 T: std::convert::Into<crate::model::discovery_occurrence::VulnerabilityAttestation>,
4589 {
4590 self.vulnerability_attestation = std::option::Option::Some(v.into());
4591 self
4592 }
4593
4594 /// Sets or clears the value of [vulnerability_attestation][crate::model::DiscoveryOccurrence::vulnerability_attestation].
4595 ///
4596 /// # Example
4597 /// ```ignore,no_run
4598 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4599 /// use google_cloud_grafeas_v1::model::discovery_occurrence::VulnerabilityAttestation;
4600 /// let x = DiscoveryOccurrence::new().set_or_clear_vulnerability_attestation(Some(VulnerabilityAttestation::default()/* use setters */));
4601 /// let x = DiscoveryOccurrence::new().set_or_clear_vulnerability_attestation(None::<VulnerabilityAttestation>);
4602 /// ```
4603 pub fn set_or_clear_vulnerability_attestation<T>(mut self, v: std::option::Option<T>) -> Self
4604 where
4605 T: std::convert::Into<crate::model::discovery_occurrence::VulnerabilityAttestation>,
4606 {
4607 self.vulnerability_attestation = v.map(|x| x.into());
4608 self
4609 }
4610
4611 /// Sets the value of [files][crate::model::DiscoveryOccurrence::files].
4612 ///
4613 /// # Example
4614 /// ```ignore,no_run
4615 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4616 /// use google_cloud_grafeas_v1::model::discovery_occurrence::File;
4617 /// let x = DiscoveryOccurrence::new()
4618 /// .set_files([
4619 /// File::default()/* use setters */,
4620 /// File::default()/* use (different) setters */,
4621 /// ]);
4622 /// ```
4623 pub fn set_files<T, V>(mut self, v: T) -> Self
4624 where
4625 T: std::iter::IntoIterator<Item = V>,
4626 V: std::convert::Into<crate::model::discovery_occurrence::File>,
4627 {
4628 use std::iter::Iterator;
4629 self.files = v.into_iter().map(|i| i.into()).collect();
4630 self
4631 }
4632
4633 /// Sets the value of [last_vulnerability_update_time][crate::model::DiscoveryOccurrence::last_vulnerability_update_time].
4634 ///
4635 /// # Example
4636 /// ```ignore,no_run
4637 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4638 /// use wkt::Timestamp;
4639 /// let x = DiscoveryOccurrence::new().set_last_vulnerability_update_time(Timestamp::default()/* use setters */);
4640 /// ```
4641 pub fn set_last_vulnerability_update_time<T>(mut self, v: T) -> Self
4642 where
4643 T: std::convert::Into<wkt::Timestamp>,
4644 {
4645 self.last_vulnerability_update_time = std::option::Option::Some(v.into());
4646 self
4647 }
4648
4649 /// Sets or clears the value of [last_vulnerability_update_time][crate::model::DiscoveryOccurrence::last_vulnerability_update_time].
4650 ///
4651 /// # Example
4652 /// ```ignore,no_run
4653 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4654 /// use wkt::Timestamp;
4655 /// let x = DiscoveryOccurrence::new().set_or_clear_last_vulnerability_update_time(Some(Timestamp::default()/* use setters */));
4656 /// let x = DiscoveryOccurrence::new().set_or_clear_last_vulnerability_update_time(None::<Timestamp>);
4657 /// ```
4658 pub fn set_or_clear_last_vulnerability_update_time<T>(
4659 mut self,
4660 v: std::option::Option<T>,
4661 ) -> Self
4662 where
4663 T: std::convert::Into<wkt::Timestamp>,
4664 {
4665 self.last_vulnerability_update_time = v.map(|x| x.into());
4666 self
4667 }
4668}
4669
4670impl wkt::message::Message for DiscoveryOccurrence {
4671 fn typename() -> &'static str {
4672 "type.googleapis.com/grafeas.v1.DiscoveryOccurrence"
4673 }
4674}
4675
4676/// Defines additional types related to [DiscoveryOccurrence].
4677pub mod discovery_occurrence {
4678 #[allow(unused_imports)]
4679 use super::*;
4680
4681 /// Indicates which analysis completed successfully. Multiple types of
4682 /// analysis can be performed on a single resource.
4683 #[derive(Clone, Default, PartialEq)]
4684 #[non_exhaustive]
4685 pub struct AnalysisCompleted {
4686 pub analysis_type: std::vec::Vec<std::string::String>,
4687
4688 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4689 }
4690
4691 impl AnalysisCompleted {
4692 pub fn new() -> Self {
4693 std::default::Default::default()
4694 }
4695
4696 /// Sets the value of [analysis_type][crate::model::discovery_occurrence::AnalysisCompleted::analysis_type].
4697 ///
4698 /// # Example
4699 /// ```ignore,no_run
4700 /// # use google_cloud_grafeas_v1::model::discovery_occurrence::AnalysisCompleted;
4701 /// let x = AnalysisCompleted::new().set_analysis_type(["a", "b", "c"]);
4702 /// ```
4703 pub fn set_analysis_type<T, V>(mut self, v: T) -> Self
4704 where
4705 T: std::iter::IntoIterator<Item = V>,
4706 V: std::convert::Into<std::string::String>,
4707 {
4708 use std::iter::Iterator;
4709 self.analysis_type = v.into_iter().map(|i| i.into()).collect();
4710 self
4711 }
4712 }
4713
4714 impl wkt::message::Message for AnalysisCompleted {
4715 fn typename() -> &'static str {
4716 "type.googleapis.com/grafeas.v1.DiscoveryOccurrence.AnalysisCompleted"
4717 }
4718 }
4719
4720 /// The status of an SBOM generation.
4721 #[derive(Clone, Default, PartialEq)]
4722 #[non_exhaustive]
4723 pub struct SBOMStatus {
4724 /// The progress of the SBOM generation.
4725 pub sbom_state: crate::model::discovery_occurrence::sbom_status::SBOMState,
4726
4727 /// If there was an error generating an SBOM, this will indicate what that
4728 /// error was.
4729 pub error: std::string::String,
4730
4731 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4732 }
4733
4734 impl SBOMStatus {
4735 pub fn new() -> Self {
4736 std::default::Default::default()
4737 }
4738
4739 /// Sets the value of [sbom_state][crate::model::discovery_occurrence::SBOMStatus::sbom_state].
4740 ///
4741 /// # Example
4742 /// ```ignore,no_run
4743 /// # use google_cloud_grafeas_v1::model::discovery_occurrence::SBOMStatus;
4744 /// use google_cloud_grafeas_v1::model::discovery_occurrence::sbom_status::SBOMState;
4745 /// let x0 = SBOMStatus::new().set_sbom_state(SBOMState::Pending);
4746 /// let x1 = SBOMStatus::new().set_sbom_state(SBOMState::Complete);
4747 /// ```
4748 pub fn set_sbom_state<
4749 T: std::convert::Into<crate::model::discovery_occurrence::sbom_status::SBOMState>,
4750 >(
4751 mut self,
4752 v: T,
4753 ) -> Self {
4754 self.sbom_state = v.into();
4755 self
4756 }
4757
4758 /// Sets the value of [error][crate::model::discovery_occurrence::SBOMStatus::error].
4759 ///
4760 /// # Example
4761 /// ```ignore,no_run
4762 /// # use google_cloud_grafeas_v1::model::discovery_occurrence::SBOMStatus;
4763 /// let x = SBOMStatus::new().set_error("example");
4764 /// ```
4765 pub fn set_error<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4766 self.error = v.into();
4767 self
4768 }
4769 }
4770
4771 impl wkt::message::Message for SBOMStatus {
4772 fn typename() -> &'static str {
4773 "type.googleapis.com/grafeas.v1.DiscoveryOccurrence.SBOMStatus"
4774 }
4775 }
4776
4777 /// Defines additional types related to [SBOMStatus].
4778 pub mod sbom_status {
4779 #[allow(unused_imports)]
4780 use super::*;
4781
4782 /// An enum indicating the progress of the SBOM generation.
4783 ///
4784 /// # Working with unknown values
4785 ///
4786 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4787 /// additional enum variants at any time. Adding new variants is not considered
4788 /// a breaking change. Applications should write their code in anticipation of:
4789 ///
4790 /// - New values appearing in future releases of the client library, **and**
4791 /// - New values received dynamically, without application changes.
4792 ///
4793 /// Please consult the [Working with enums] section in the user guide for some
4794 /// guidelines.
4795 ///
4796 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4797 #[derive(Clone, Debug, PartialEq)]
4798 #[non_exhaustive]
4799 pub enum SBOMState {
4800 /// Default unknown state.
4801 Unspecified,
4802 /// SBOM scanning is pending.
4803 Pending,
4804 /// SBOM scanning has completed.
4805 Complete,
4806 /// If set, the enum was initialized with an unknown value.
4807 ///
4808 /// Applications can examine the value using [SBOMState::value] or
4809 /// [SBOMState::name].
4810 UnknownValue(sbom_state::UnknownValue),
4811 }
4812
4813 #[doc(hidden)]
4814 pub mod sbom_state {
4815 #[allow(unused_imports)]
4816 use super::*;
4817 #[derive(Clone, Debug, PartialEq)]
4818 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4819 }
4820
4821 impl SBOMState {
4822 /// Gets the enum value.
4823 ///
4824 /// Returns `None` if the enum contains an unknown value deserialized from
4825 /// the string representation of enums.
4826 pub fn value(&self) -> std::option::Option<i32> {
4827 match self {
4828 Self::Unspecified => std::option::Option::Some(0),
4829 Self::Pending => std::option::Option::Some(1),
4830 Self::Complete => std::option::Option::Some(2),
4831 Self::UnknownValue(u) => u.0.value(),
4832 }
4833 }
4834
4835 /// Gets the enum value as a string.
4836 ///
4837 /// Returns `None` if the enum contains an unknown value deserialized from
4838 /// the integer representation of enums.
4839 pub fn name(&self) -> std::option::Option<&str> {
4840 match self {
4841 Self::Unspecified => std::option::Option::Some("SBOM_STATE_UNSPECIFIED"),
4842 Self::Pending => std::option::Option::Some("PENDING"),
4843 Self::Complete => std::option::Option::Some("COMPLETE"),
4844 Self::UnknownValue(u) => u.0.name(),
4845 }
4846 }
4847 }
4848
4849 impl std::default::Default for SBOMState {
4850 fn default() -> Self {
4851 use std::convert::From;
4852 Self::from(0)
4853 }
4854 }
4855
4856 impl std::fmt::Display for SBOMState {
4857 fn fmt(
4858 &self,
4859 f: &mut std::fmt::Formatter<'_>,
4860 ) -> std::result::Result<(), std::fmt::Error> {
4861 wkt::internal::display_enum(f, self.name(), self.value())
4862 }
4863 }
4864
4865 impl std::convert::From<i32> for SBOMState {
4866 fn from(value: i32) -> Self {
4867 match value {
4868 0 => Self::Unspecified,
4869 1 => Self::Pending,
4870 2 => Self::Complete,
4871 _ => Self::UnknownValue(sbom_state::UnknownValue(
4872 wkt::internal::UnknownEnumValue::Integer(value),
4873 )),
4874 }
4875 }
4876 }
4877
4878 impl std::convert::From<&str> for SBOMState {
4879 fn from(value: &str) -> Self {
4880 use std::string::ToString;
4881 match value {
4882 "SBOM_STATE_UNSPECIFIED" => Self::Unspecified,
4883 "PENDING" => Self::Pending,
4884 "COMPLETE" => Self::Complete,
4885 _ => Self::UnknownValue(sbom_state::UnknownValue(
4886 wkt::internal::UnknownEnumValue::String(value.to_string()),
4887 )),
4888 }
4889 }
4890 }
4891
4892 impl serde::ser::Serialize for SBOMState {
4893 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4894 where
4895 S: serde::Serializer,
4896 {
4897 match self {
4898 Self::Unspecified => serializer.serialize_i32(0),
4899 Self::Pending => serializer.serialize_i32(1),
4900 Self::Complete => serializer.serialize_i32(2),
4901 Self::UnknownValue(u) => u.0.serialize(serializer),
4902 }
4903 }
4904 }
4905
4906 impl<'de> serde::de::Deserialize<'de> for SBOMState {
4907 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4908 where
4909 D: serde::Deserializer<'de>,
4910 {
4911 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SBOMState>::new(
4912 ".grafeas.v1.DiscoveryOccurrence.SBOMStatus.SBOMState",
4913 ))
4914 }
4915 }
4916 }
4917
4918 /// The status of an vulnerability attestation generation.
4919 #[derive(Clone, Default, PartialEq)]
4920 #[non_exhaustive]
4921 pub struct VulnerabilityAttestation {
4922
4923 /// The last time we attempted to generate an attestation.
4924 pub last_attempt_time: std::option::Option<wkt::Timestamp>,
4925
4926 /// The success/failure state of the latest attestation attempt.
4927 pub state: crate::model::discovery_occurrence::vulnerability_attestation::VulnerabilityAttestationState,
4928
4929 /// If failure, the error reason for why the attestation generation failed.
4930 pub error: std::string::String,
4931
4932 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4933 }
4934
4935 impl VulnerabilityAttestation {
4936 pub fn new() -> Self {
4937 std::default::Default::default()
4938 }
4939
4940 /// Sets the value of [last_attempt_time][crate::model::discovery_occurrence::VulnerabilityAttestation::last_attempt_time].
4941 ///
4942 /// # Example
4943 /// ```ignore,no_run
4944 /// # use google_cloud_grafeas_v1::model::discovery_occurrence::VulnerabilityAttestation;
4945 /// use wkt::Timestamp;
4946 /// let x = VulnerabilityAttestation::new().set_last_attempt_time(Timestamp::default()/* use setters */);
4947 /// ```
4948 pub fn set_last_attempt_time<T>(mut self, v: T) -> Self
4949 where
4950 T: std::convert::Into<wkt::Timestamp>,
4951 {
4952 self.last_attempt_time = std::option::Option::Some(v.into());
4953 self
4954 }
4955
4956 /// Sets or clears the value of [last_attempt_time][crate::model::discovery_occurrence::VulnerabilityAttestation::last_attempt_time].
4957 ///
4958 /// # Example
4959 /// ```ignore,no_run
4960 /// # use google_cloud_grafeas_v1::model::discovery_occurrence::VulnerabilityAttestation;
4961 /// use wkt::Timestamp;
4962 /// let x = VulnerabilityAttestation::new().set_or_clear_last_attempt_time(Some(Timestamp::default()/* use setters */));
4963 /// let x = VulnerabilityAttestation::new().set_or_clear_last_attempt_time(None::<Timestamp>);
4964 /// ```
4965 pub fn set_or_clear_last_attempt_time<T>(mut self, v: std::option::Option<T>) -> Self
4966 where
4967 T: std::convert::Into<wkt::Timestamp>,
4968 {
4969 self.last_attempt_time = v.map(|x| x.into());
4970 self
4971 }
4972
4973 /// Sets the value of [state][crate::model::discovery_occurrence::VulnerabilityAttestation::state].
4974 ///
4975 /// # Example
4976 /// ```ignore,no_run
4977 /// # use google_cloud_grafeas_v1::model::discovery_occurrence::VulnerabilityAttestation;
4978 /// use google_cloud_grafeas_v1::model::discovery_occurrence::vulnerability_attestation::VulnerabilityAttestationState;
4979 /// let x0 = VulnerabilityAttestation::new().set_state(VulnerabilityAttestationState::Success);
4980 /// let x1 = VulnerabilityAttestation::new().set_state(VulnerabilityAttestationState::Failure);
4981 /// ```
4982 pub fn set_state<T: std::convert::Into<crate::model::discovery_occurrence::vulnerability_attestation::VulnerabilityAttestationState>>(mut self, v: T) -> Self{
4983 self.state = v.into();
4984 self
4985 }
4986
4987 /// Sets the value of [error][crate::model::discovery_occurrence::VulnerabilityAttestation::error].
4988 ///
4989 /// # Example
4990 /// ```ignore,no_run
4991 /// # use google_cloud_grafeas_v1::model::discovery_occurrence::VulnerabilityAttestation;
4992 /// let x = VulnerabilityAttestation::new().set_error("example");
4993 /// ```
4994 pub fn set_error<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4995 self.error = v.into();
4996 self
4997 }
4998 }
4999
5000 impl wkt::message::Message for VulnerabilityAttestation {
5001 fn typename() -> &'static str {
5002 "type.googleapis.com/grafeas.v1.DiscoveryOccurrence.VulnerabilityAttestation"
5003 }
5004 }
5005
5006 /// Defines additional types related to [VulnerabilityAttestation].
5007 pub mod vulnerability_attestation {
5008 #[allow(unused_imports)]
5009 use super::*;
5010
5011 /// An enum indicating the state of the attestation generation.
5012 ///
5013 /// # Working with unknown values
5014 ///
5015 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5016 /// additional enum variants at any time. Adding new variants is not considered
5017 /// a breaking change. Applications should write their code in anticipation of:
5018 ///
5019 /// - New values appearing in future releases of the client library, **and**
5020 /// - New values received dynamically, without application changes.
5021 ///
5022 /// Please consult the [Working with enums] section in the user guide for some
5023 /// guidelines.
5024 ///
5025 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5026 #[derive(Clone, Debug, PartialEq)]
5027 #[non_exhaustive]
5028 pub enum VulnerabilityAttestationState {
5029 /// Default unknown state.
5030 Unspecified,
5031 /// Attestation was successfully generated and stored.
5032 Success,
5033 /// Attestation was unsuccessfully generated and stored.
5034 Failure,
5035 /// If set, the enum was initialized with an unknown value.
5036 ///
5037 /// Applications can examine the value using [VulnerabilityAttestationState::value] or
5038 /// [VulnerabilityAttestationState::name].
5039 UnknownValue(vulnerability_attestation_state::UnknownValue),
5040 }
5041
5042 #[doc(hidden)]
5043 pub mod vulnerability_attestation_state {
5044 #[allow(unused_imports)]
5045 use super::*;
5046 #[derive(Clone, Debug, PartialEq)]
5047 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5048 }
5049
5050 impl VulnerabilityAttestationState {
5051 /// Gets the enum value.
5052 ///
5053 /// Returns `None` if the enum contains an unknown value deserialized from
5054 /// the string representation of enums.
5055 pub fn value(&self) -> std::option::Option<i32> {
5056 match self {
5057 Self::Unspecified => std::option::Option::Some(0),
5058 Self::Success => std::option::Option::Some(1),
5059 Self::Failure => std::option::Option::Some(2),
5060 Self::UnknownValue(u) => u.0.value(),
5061 }
5062 }
5063
5064 /// Gets the enum value as a string.
5065 ///
5066 /// Returns `None` if the enum contains an unknown value deserialized from
5067 /// the integer representation of enums.
5068 pub fn name(&self) -> std::option::Option<&str> {
5069 match self {
5070 Self::Unspecified => {
5071 std::option::Option::Some("VULNERABILITY_ATTESTATION_STATE_UNSPECIFIED")
5072 }
5073 Self::Success => std::option::Option::Some("SUCCESS"),
5074 Self::Failure => std::option::Option::Some("FAILURE"),
5075 Self::UnknownValue(u) => u.0.name(),
5076 }
5077 }
5078 }
5079
5080 impl std::default::Default for VulnerabilityAttestationState {
5081 fn default() -> Self {
5082 use std::convert::From;
5083 Self::from(0)
5084 }
5085 }
5086
5087 impl std::fmt::Display for VulnerabilityAttestationState {
5088 fn fmt(
5089 &self,
5090 f: &mut std::fmt::Formatter<'_>,
5091 ) -> std::result::Result<(), std::fmt::Error> {
5092 wkt::internal::display_enum(f, self.name(), self.value())
5093 }
5094 }
5095
5096 impl std::convert::From<i32> for VulnerabilityAttestationState {
5097 fn from(value: i32) -> Self {
5098 match value {
5099 0 => Self::Unspecified,
5100 1 => Self::Success,
5101 2 => Self::Failure,
5102 _ => Self::UnknownValue(vulnerability_attestation_state::UnknownValue(
5103 wkt::internal::UnknownEnumValue::Integer(value),
5104 )),
5105 }
5106 }
5107 }
5108
5109 impl std::convert::From<&str> for VulnerabilityAttestationState {
5110 fn from(value: &str) -> Self {
5111 use std::string::ToString;
5112 match value {
5113 "VULNERABILITY_ATTESTATION_STATE_UNSPECIFIED" => Self::Unspecified,
5114 "SUCCESS" => Self::Success,
5115 "FAILURE" => Self::Failure,
5116 _ => Self::UnknownValue(vulnerability_attestation_state::UnknownValue(
5117 wkt::internal::UnknownEnumValue::String(value.to_string()),
5118 )),
5119 }
5120 }
5121 }
5122
5123 impl serde::ser::Serialize for VulnerabilityAttestationState {
5124 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5125 where
5126 S: serde::Serializer,
5127 {
5128 match self {
5129 Self::Unspecified => serializer.serialize_i32(0),
5130 Self::Success => serializer.serialize_i32(1),
5131 Self::Failure => serializer.serialize_i32(2),
5132 Self::UnknownValue(u) => u.0.serialize(serializer),
5133 }
5134 }
5135 }
5136
5137 impl<'de> serde::de::Deserialize<'de> for VulnerabilityAttestationState {
5138 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5139 where
5140 D: serde::Deserializer<'de>,
5141 {
5142 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VulnerabilityAttestationState>::new(
5143 ".grafeas.v1.DiscoveryOccurrence.VulnerabilityAttestation.VulnerabilityAttestationState"))
5144 }
5145 }
5146 }
5147
5148 #[derive(Clone, Default, PartialEq)]
5149 #[non_exhaustive]
5150 pub struct File {
5151 pub name: std::string::String,
5152
5153 pub digest: std::collections::HashMap<std::string::String, std::string::String>,
5154
5155 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5156 }
5157
5158 impl File {
5159 pub fn new() -> Self {
5160 std::default::Default::default()
5161 }
5162
5163 /// Sets the value of [name][crate::model::discovery_occurrence::File::name].
5164 ///
5165 /// # Example
5166 /// ```ignore,no_run
5167 /// # use google_cloud_grafeas_v1::model::discovery_occurrence::File;
5168 /// let x = File::new().set_name("example");
5169 /// ```
5170 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5171 self.name = v.into();
5172 self
5173 }
5174
5175 /// Sets the value of [digest][crate::model::discovery_occurrence::File::digest].
5176 ///
5177 /// # Example
5178 /// ```ignore,no_run
5179 /// # use google_cloud_grafeas_v1::model::discovery_occurrence::File;
5180 /// let x = File::new().set_digest([
5181 /// ("key0", "abc"),
5182 /// ("key1", "xyz"),
5183 /// ]);
5184 /// ```
5185 pub fn set_digest<T, K, V>(mut self, v: T) -> Self
5186 where
5187 T: std::iter::IntoIterator<Item = (K, V)>,
5188 K: std::convert::Into<std::string::String>,
5189 V: std::convert::Into<std::string::String>,
5190 {
5191 use std::iter::Iterator;
5192 self.digest = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5193 self
5194 }
5195 }
5196
5197 impl wkt::message::Message for File {
5198 fn typename() -> &'static str {
5199 "type.googleapis.com/grafeas.v1.DiscoveryOccurrence.File"
5200 }
5201 }
5202
5203 /// Whether the resource is continuously analyzed.
5204 ///
5205 /// # Working with unknown values
5206 ///
5207 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5208 /// additional enum variants at any time. Adding new variants is not considered
5209 /// a breaking change. Applications should write their code in anticipation of:
5210 ///
5211 /// - New values appearing in future releases of the client library, **and**
5212 /// - New values received dynamically, without application changes.
5213 ///
5214 /// Please consult the [Working with enums] section in the user guide for some
5215 /// guidelines.
5216 ///
5217 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5218 #[derive(Clone, Debug, PartialEq)]
5219 #[non_exhaustive]
5220 pub enum ContinuousAnalysis {
5221 /// Unknown.
5222 Unspecified,
5223 /// The resource is continuously analyzed.
5224 Active,
5225 /// The resource is ignored for continuous analysis.
5226 Inactive,
5227 /// If set, the enum was initialized with an unknown value.
5228 ///
5229 /// Applications can examine the value using [ContinuousAnalysis::value] or
5230 /// [ContinuousAnalysis::name].
5231 UnknownValue(continuous_analysis::UnknownValue),
5232 }
5233
5234 #[doc(hidden)]
5235 pub mod continuous_analysis {
5236 #[allow(unused_imports)]
5237 use super::*;
5238 #[derive(Clone, Debug, PartialEq)]
5239 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5240 }
5241
5242 impl ContinuousAnalysis {
5243 /// Gets the enum value.
5244 ///
5245 /// Returns `None` if the enum contains an unknown value deserialized from
5246 /// the string representation of enums.
5247 pub fn value(&self) -> std::option::Option<i32> {
5248 match self {
5249 Self::Unspecified => std::option::Option::Some(0),
5250 Self::Active => std::option::Option::Some(1),
5251 Self::Inactive => std::option::Option::Some(2),
5252 Self::UnknownValue(u) => u.0.value(),
5253 }
5254 }
5255
5256 /// Gets the enum value as a string.
5257 ///
5258 /// Returns `None` if the enum contains an unknown value deserialized from
5259 /// the integer representation of enums.
5260 pub fn name(&self) -> std::option::Option<&str> {
5261 match self {
5262 Self::Unspecified => std::option::Option::Some("CONTINUOUS_ANALYSIS_UNSPECIFIED"),
5263 Self::Active => std::option::Option::Some("ACTIVE"),
5264 Self::Inactive => std::option::Option::Some("INACTIVE"),
5265 Self::UnknownValue(u) => u.0.name(),
5266 }
5267 }
5268 }
5269
5270 impl std::default::Default for ContinuousAnalysis {
5271 fn default() -> Self {
5272 use std::convert::From;
5273 Self::from(0)
5274 }
5275 }
5276
5277 impl std::fmt::Display for ContinuousAnalysis {
5278 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5279 wkt::internal::display_enum(f, self.name(), self.value())
5280 }
5281 }
5282
5283 impl std::convert::From<i32> for ContinuousAnalysis {
5284 fn from(value: i32) -> Self {
5285 match value {
5286 0 => Self::Unspecified,
5287 1 => Self::Active,
5288 2 => Self::Inactive,
5289 _ => Self::UnknownValue(continuous_analysis::UnknownValue(
5290 wkt::internal::UnknownEnumValue::Integer(value),
5291 )),
5292 }
5293 }
5294 }
5295
5296 impl std::convert::From<&str> for ContinuousAnalysis {
5297 fn from(value: &str) -> Self {
5298 use std::string::ToString;
5299 match value {
5300 "CONTINUOUS_ANALYSIS_UNSPECIFIED" => Self::Unspecified,
5301 "ACTIVE" => Self::Active,
5302 "INACTIVE" => Self::Inactive,
5303 _ => Self::UnknownValue(continuous_analysis::UnknownValue(
5304 wkt::internal::UnknownEnumValue::String(value.to_string()),
5305 )),
5306 }
5307 }
5308 }
5309
5310 impl serde::ser::Serialize for ContinuousAnalysis {
5311 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5312 where
5313 S: serde::Serializer,
5314 {
5315 match self {
5316 Self::Unspecified => serializer.serialize_i32(0),
5317 Self::Active => serializer.serialize_i32(1),
5318 Self::Inactive => serializer.serialize_i32(2),
5319 Self::UnknownValue(u) => u.0.serialize(serializer),
5320 }
5321 }
5322 }
5323
5324 impl<'de> serde::de::Deserialize<'de> for ContinuousAnalysis {
5325 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5326 where
5327 D: serde::Deserializer<'de>,
5328 {
5329 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ContinuousAnalysis>::new(
5330 ".grafeas.v1.DiscoveryOccurrence.ContinuousAnalysis",
5331 ))
5332 }
5333 }
5334
5335 /// Analysis status for a resource. Currently for initial analysis only (not
5336 /// updated in continuous analysis).
5337 ///
5338 /// # Working with unknown values
5339 ///
5340 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5341 /// additional enum variants at any time. Adding new variants is not considered
5342 /// a breaking change. Applications should write their code in anticipation of:
5343 ///
5344 /// - New values appearing in future releases of the client library, **and**
5345 /// - New values received dynamically, without application changes.
5346 ///
5347 /// Please consult the [Working with enums] section in the user guide for some
5348 /// guidelines.
5349 ///
5350 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5351 #[derive(Clone, Debug, PartialEq)]
5352 #[non_exhaustive]
5353 pub enum AnalysisStatus {
5354 /// Unknown.
5355 Unspecified,
5356 /// Resource is known but no action has been taken yet.
5357 Pending,
5358 /// Resource is being analyzed.
5359 Scanning,
5360 /// Analysis has finished successfully.
5361 FinishedSuccess,
5362 /// Analysis has completed.
5363 Complete,
5364 /// Analysis has finished unsuccessfully, the analysis itself is in a bad
5365 /// state.
5366 FinishedFailed,
5367 /// The resource is known not to be supported.
5368 FinishedUnsupported,
5369 /// If set, the enum was initialized with an unknown value.
5370 ///
5371 /// Applications can examine the value using [AnalysisStatus::value] or
5372 /// [AnalysisStatus::name].
5373 UnknownValue(analysis_status::UnknownValue),
5374 }
5375
5376 #[doc(hidden)]
5377 pub mod analysis_status {
5378 #[allow(unused_imports)]
5379 use super::*;
5380 #[derive(Clone, Debug, PartialEq)]
5381 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5382 }
5383
5384 impl AnalysisStatus {
5385 /// Gets the enum value.
5386 ///
5387 /// Returns `None` if the enum contains an unknown value deserialized from
5388 /// the string representation of enums.
5389 pub fn value(&self) -> std::option::Option<i32> {
5390 match self {
5391 Self::Unspecified => std::option::Option::Some(0),
5392 Self::Pending => std::option::Option::Some(1),
5393 Self::Scanning => std::option::Option::Some(2),
5394 Self::FinishedSuccess => std::option::Option::Some(3),
5395 Self::Complete => std::option::Option::Some(3),
5396 Self::FinishedFailed => std::option::Option::Some(4),
5397 Self::FinishedUnsupported => std::option::Option::Some(5),
5398 Self::UnknownValue(u) => u.0.value(),
5399 }
5400 }
5401
5402 /// Gets the enum value as a string.
5403 ///
5404 /// Returns `None` if the enum contains an unknown value deserialized from
5405 /// the integer representation of enums.
5406 pub fn name(&self) -> std::option::Option<&str> {
5407 match self {
5408 Self::Unspecified => std::option::Option::Some("ANALYSIS_STATUS_UNSPECIFIED"),
5409 Self::Pending => std::option::Option::Some("PENDING"),
5410 Self::Scanning => std::option::Option::Some("SCANNING"),
5411 Self::FinishedSuccess => std::option::Option::Some("FINISHED_SUCCESS"),
5412 Self::Complete => std::option::Option::Some("COMPLETE"),
5413 Self::FinishedFailed => std::option::Option::Some("FINISHED_FAILED"),
5414 Self::FinishedUnsupported => std::option::Option::Some("FINISHED_UNSUPPORTED"),
5415 Self::UnknownValue(u) => u.0.name(),
5416 }
5417 }
5418 }
5419
5420 impl std::default::Default for AnalysisStatus {
5421 fn default() -> Self {
5422 use std::convert::From;
5423 Self::from(0)
5424 }
5425 }
5426
5427 impl std::fmt::Display for AnalysisStatus {
5428 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5429 wkt::internal::display_enum(f, self.name(), self.value())
5430 }
5431 }
5432
5433 impl std::convert::From<i32> for AnalysisStatus {
5434 fn from(value: i32) -> Self {
5435 match value {
5436 0 => Self::Unspecified,
5437 1 => Self::Pending,
5438 2 => Self::Scanning,
5439 3 => Self::Complete,
5440 4 => Self::FinishedFailed,
5441 5 => Self::FinishedUnsupported,
5442 _ => Self::UnknownValue(analysis_status::UnknownValue(
5443 wkt::internal::UnknownEnumValue::Integer(value),
5444 )),
5445 }
5446 }
5447 }
5448
5449 impl std::convert::From<&str> for AnalysisStatus {
5450 fn from(value: &str) -> Self {
5451 use std::string::ToString;
5452 match value {
5453 "ANALYSIS_STATUS_UNSPECIFIED" => Self::Unspecified,
5454 "PENDING" => Self::Pending,
5455 "SCANNING" => Self::Scanning,
5456 "FINISHED_SUCCESS" => Self::FinishedSuccess,
5457 "COMPLETE" => Self::Complete,
5458 "FINISHED_FAILED" => Self::FinishedFailed,
5459 "FINISHED_UNSUPPORTED" => Self::FinishedUnsupported,
5460 _ => Self::UnknownValue(analysis_status::UnknownValue(
5461 wkt::internal::UnknownEnumValue::String(value.to_string()),
5462 )),
5463 }
5464 }
5465 }
5466
5467 impl serde::ser::Serialize for AnalysisStatus {
5468 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5469 where
5470 S: serde::Serializer,
5471 {
5472 match self {
5473 Self::Unspecified => serializer.serialize_i32(0),
5474 Self::Pending => serializer.serialize_i32(1),
5475 Self::Scanning => serializer.serialize_i32(2),
5476 Self::FinishedSuccess => serializer.serialize_i32(3),
5477 Self::Complete => serializer.serialize_i32(3),
5478 Self::FinishedFailed => serializer.serialize_i32(4),
5479 Self::FinishedUnsupported => serializer.serialize_i32(5),
5480 Self::UnknownValue(u) => u.0.serialize(serializer),
5481 }
5482 }
5483 }
5484
5485 impl<'de> serde::de::Deserialize<'de> for AnalysisStatus {
5486 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5487 where
5488 D: serde::Deserializer<'de>,
5489 {
5490 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AnalysisStatus>::new(
5491 ".grafeas.v1.DiscoveryOccurrence.AnalysisStatus",
5492 ))
5493 }
5494 }
5495}
5496
5497#[derive(Clone, Default, PartialEq)]
5498#[non_exhaustive]
5499pub struct DSSEAttestationNote {
5500 /// DSSEHint hints at the purpose of the attestation authority.
5501 pub hint: std::option::Option<crate::model::dsse_attestation_note::DSSEHint>,
5502
5503 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5504}
5505
5506impl DSSEAttestationNote {
5507 pub fn new() -> Self {
5508 std::default::Default::default()
5509 }
5510
5511 /// Sets the value of [hint][crate::model::DSSEAttestationNote::hint].
5512 ///
5513 /// # Example
5514 /// ```ignore,no_run
5515 /// # use google_cloud_grafeas_v1::model::DSSEAttestationNote;
5516 /// use google_cloud_grafeas_v1::model::dsse_attestation_note::DSSEHint;
5517 /// let x = DSSEAttestationNote::new().set_hint(DSSEHint::default()/* use setters */);
5518 /// ```
5519 pub fn set_hint<T>(mut self, v: T) -> Self
5520 where
5521 T: std::convert::Into<crate::model::dsse_attestation_note::DSSEHint>,
5522 {
5523 self.hint = std::option::Option::Some(v.into());
5524 self
5525 }
5526
5527 /// Sets or clears the value of [hint][crate::model::DSSEAttestationNote::hint].
5528 ///
5529 /// # Example
5530 /// ```ignore,no_run
5531 /// # use google_cloud_grafeas_v1::model::DSSEAttestationNote;
5532 /// use google_cloud_grafeas_v1::model::dsse_attestation_note::DSSEHint;
5533 /// let x = DSSEAttestationNote::new().set_or_clear_hint(Some(DSSEHint::default()/* use setters */));
5534 /// let x = DSSEAttestationNote::new().set_or_clear_hint(None::<DSSEHint>);
5535 /// ```
5536 pub fn set_or_clear_hint<T>(mut self, v: std::option::Option<T>) -> Self
5537 where
5538 T: std::convert::Into<crate::model::dsse_attestation_note::DSSEHint>,
5539 {
5540 self.hint = v.map(|x| x.into());
5541 self
5542 }
5543}
5544
5545impl wkt::message::Message for DSSEAttestationNote {
5546 fn typename() -> &'static str {
5547 "type.googleapis.com/grafeas.v1.DSSEAttestationNote"
5548 }
5549}
5550
5551/// Defines additional types related to [DSSEAttestationNote].
5552pub mod dsse_attestation_note {
5553 #[allow(unused_imports)]
5554 use super::*;
5555
5556 /// This submessage provides human-readable hints about the purpose of the
5557 /// authority. Because the name of a note acts as its resource reference, it is
5558 /// important to disambiguate the canonical name of the Note (which might be a
5559 /// UUID for security purposes) from "readable" names more suitable for debug
5560 /// output. Note that these hints should not be used to look up authorities in
5561 /// security sensitive contexts, such as when looking up attestations to
5562 /// verify.
5563 #[derive(Clone, Default, PartialEq)]
5564 #[non_exhaustive]
5565 pub struct DSSEHint {
5566 /// Required. The human readable name of this attestation authority, for
5567 /// example "cloudbuild-prod".
5568 pub human_readable_name: std::string::String,
5569
5570 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5571 }
5572
5573 impl DSSEHint {
5574 pub fn new() -> Self {
5575 std::default::Default::default()
5576 }
5577
5578 /// Sets the value of [human_readable_name][crate::model::dsse_attestation_note::DSSEHint::human_readable_name].
5579 ///
5580 /// # Example
5581 /// ```ignore,no_run
5582 /// # use google_cloud_grafeas_v1::model::dsse_attestation_note::DSSEHint;
5583 /// let x = DSSEHint::new().set_human_readable_name("example");
5584 /// ```
5585 pub fn set_human_readable_name<T: std::convert::Into<std::string::String>>(
5586 mut self,
5587 v: T,
5588 ) -> Self {
5589 self.human_readable_name = v.into();
5590 self
5591 }
5592 }
5593
5594 impl wkt::message::Message for DSSEHint {
5595 fn typename() -> &'static str {
5596 "type.googleapis.com/grafeas.v1.DSSEAttestationNote.DSSEHint"
5597 }
5598 }
5599}
5600
5601/// Deprecated. Prefer to use a regular Occurrence, and populate the
5602/// Envelope at the top level of the Occurrence.
5603#[derive(Clone, Default, PartialEq)]
5604#[non_exhaustive]
5605pub struct DSSEAttestationOccurrence {
5606 /// If doing something security critical, make sure to verify the signatures in
5607 /// this metadata.
5608 pub envelope: std::option::Option<crate::model::Envelope>,
5609
5610 pub decoded_payload:
5611 std::option::Option<crate::model::dsse_attestation_occurrence::DecodedPayload>,
5612
5613 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5614}
5615
5616impl DSSEAttestationOccurrence {
5617 pub fn new() -> Self {
5618 std::default::Default::default()
5619 }
5620
5621 /// Sets the value of [envelope][crate::model::DSSEAttestationOccurrence::envelope].
5622 ///
5623 /// # Example
5624 /// ```ignore,no_run
5625 /// # use google_cloud_grafeas_v1::model::DSSEAttestationOccurrence;
5626 /// use google_cloud_grafeas_v1::model::Envelope;
5627 /// let x = DSSEAttestationOccurrence::new().set_envelope(Envelope::default()/* use setters */);
5628 /// ```
5629 pub fn set_envelope<T>(mut self, v: T) -> Self
5630 where
5631 T: std::convert::Into<crate::model::Envelope>,
5632 {
5633 self.envelope = std::option::Option::Some(v.into());
5634 self
5635 }
5636
5637 /// Sets or clears the value of [envelope][crate::model::DSSEAttestationOccurrence::envelope].
5638 ///
5639 /// # Example
5640 /// ```ignore,no_run
5641 /// # use google_cloud_grafeas_v1::model::DSSEAttestationOccurrence;
5642 /// use google_cloud_grafeas_v1::model::Envelope;
5643 /// let x = DSSEAttestationOccurrence::new().set_or_clear_envelope(Some(Envelope::default()/* use setters */));
5644 /// let x = DSSEAttestationOccurrence::new().set_or_clear_envelope(None::<Envelope>);
5645 /// ```
5646 pub fn set_or_clear_envelope<T>(mut self, v: std::option::Option<T>) -> Self
5647 where
5648 T: std::convert::Into<crate::model::Envelope>,
5649 {
5650 self.envelope = v.map(|x| x.into());
5651 self
5652 }
5653
5654 /// Sets the value of [decoded_payload][crate::model::DSSEAttestationOccurrence::decoded_payload].
5655 ///
5656 /// Note that all the setters affecting `decoded_payload` are mutually
5657 /// exclusive.
5658 ///
5659 /// # Example
5660 /// ```ignore,no_run
5661 /// # use google_cloud_grafeas_v1::model::DSSEAttestationOccurrence;
5662 /// use google_cloud_grafeas_v1::model::InTotoStatement;
5663 /// let x = DSSEAttestationOccurrence::new().set_decoded_payload(Some(
5664 /// google_cloud_grafeas_v1::model::dsse_attestation_occurrence::DecodedPayload::Statement(InTotoStatement::default().into())));
5665 /// ```
5666 pub fn set_decoded_payload<
5667 T: std::convert::Into<
5668 std::option::Option<crate::model::dsse_attestation_occurrence::DecodedPayload>,
5669 >,
5670 >(
5671 mut self,
5672 v: T,
5673 ) -> Self {
5674 self.decoded_payload = v.into();
5675 self
5676 }
5677
5678 /// The value of [decoded_payload][crate::model::DSSEAttestationOccurrence::decoded_payload]
5679 /// if it holds a `Statement`, `None` if the field is not set or
5680 /// holds a different branch.
5681 pub fn statement(
5682 &self,
5683 ) -> std::option::Option<&std::boxed::Box<crate::model::InTotoStatement>> {
5684 #[allow(unreachable_patterns)]
5685 self.decoded_payload.as_ref().and_then(|v| match v {
5686 crate::model::dsse_attestation_occurrence::DecodedPayload::Statement(v) => {
5687 std::option::Option::Some(v)
5688 }
5689 _ => std::option::Option::None,
5690 })
5691 }
5692
5693 /// Sets the value of [decoded_payload][crate::model::DSSEAttestationOccurrence::decoded_payload]
5694 /// to hold a `Statement`.
5695 ///
5696 /// Note that all the setters affecting `decoded_payload` are
5697 /// mutually exclusive.
5698 ///
5699 /// # Example
5700 /// ```ignore,no_run
5701 /// # use google_cloud_grafeas_v1::model::DSSEAttestationOccurrence;
5702 /// use google_cloud_grafeas_v1::model::InTotoStatement;
5703 /// let x = DSSEAttestationOccurrence::new().set_statement(InTotoStatement::default()/* use setters */);
5704 /// assert!(x.statement().is_some());
5705 /// ```
5706 pub fn set_statement<T: std::convert::Into<std::boxed::Box<crate::model::InTotoStatement>>>(
5707 mut self,
5708 v: T,
5709 ) -> Self {
5710 self.decoded_payload = std::option::Option::Some(
5711 crate::model::dsse_attestation_occurrence::DecodedPayload::Statement(v.into()),
5712 );
5713 self
5714 }
5715}
5716
5717impl wkt::message::Message for DSSEAttestationOccurrence {
5718 fn typename() -> &'static str {
5719 "type.googleapis.com/grafeas.v1.DSSEAttestationOccurrence"
5720 }
5721}
5722
5723/// Defines additional types related to [DSSEAttestationOccurrence].
5724pub mod dsse_attestation_occurrence {
5725 #[allow(unused_imports)]
5726 use super::*;
5727
5728 #[derive(Clone, Debug, PartialEq)]
5729 #[non_exhaustive]
5730 pub enum DecodedPayload {
5731 Statement(std::boxed::Box<crate::model::InTotoStatement>),
5732 }
5733}
5734
5735/// An instance of an analysis type that has been found on a resource.
5736#[derive(Clone, Default, PartialEq)]
5737#[non_exhaustive]
5738pub struct Occurrence {
5739 /// Output only. The name of the occurrence in the form of
5740 /// `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
5741 pub name: std::string::String,
5742
5743 /// Required. Immutable. A URI that represents the resource for which the
5744 /// occurrence applies. For example,
5745 /// `<https://gcr.io/project/image@sha256:123abc>` for a Docker image.
5746 pub resource_uri: std::string::String,
5747
5748 /// Required. Immutable. The analysis note associated with this occurrence, in
5749 /// the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. This field can be
5750 /// used as a filter in list requests.
5751 pub note_name: std::string::String,
5752
5753 /// Output only. This explicitly denotes which of the occurrence details are
5754 /// specified. This field can be used as a filter in list requests.
5755 pub kind: crate::model::NoteKind,
5756
5757 /// A description of actions that can be taken to remedy the note.
5758 pub remediation: std::string::String,
5759
5760 /// Output only. The time this occurrence was created.
5761 pub create_time: std::option::Option<wkt::Timestamp>,
5762
5763 /// Output only. The time this occurrence was last updated.
5764 pub update_time: std::option::Option<wkt::Timestamp>,
5765
5766 /// <https://github.com/secure-systems-lab/dsse>
5767 pub envelope: std::option::Option<crate::model::Envelope>,
5768
5769 /// Required. Immutable. Describes the details of the note kind found on this
5770 /// resource.
5771 pub details: std::option::Option<crate::model::occurrence::Details>,
5772
5773 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5774}
5775
5776impl Occurrence {
5777 pub fn new() -> Self {
5778 std::default::Default::default()
5779 }
5780
5781 /// Sets the value of [name][crate::model::Occurrence::name].
5782 ///
5783 /// # Example
5784 /// ```ignore,no_run
5785 /// # use google_cloud_grafeas_v1::model::Occurrence;
5786 /// let x = Occurrence::new().set_name("example");
5787 /// ```
5788 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5789 self.name = v.into();
5790 self
5791 }
5792
5793 /// Sets the value of [resource_uri][crate::model::Occurrence::resource_uri].
5794 ///
5795 /// # Example
5796 /// ```ignore,no_run
5797 /// # use google_cloud_grafeas_v1::model::Occurrence;
5798 /// let x = Occurrence::new().set_resource_uri("example");
5799 /// ```
5800 pub fn set_resource_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5801 self.resource_uri = v.into();
5802 self
5803 }
5804
5805 /// Sets the value of [note_name][crate::model::Occurrence::note_name].
5806 ///
5807 /// # Example
5808 /// ```ignore,no_run
5809 /// # use google_cloud_grafeas_v1::model::Occurrence;
5810 /// let x = Occurrence::new().set_note_name("example");
5811 /// ```
5812 pub fn set_note_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5813 self.note_name = v.into();
5814 self
5815 }
5816
5817 /// Sets the value of [kind][crate::model::Occurrence::kind].
5818 ///
5819 /// # Example
5820 /// ```ignore,no_run
5821 /// # use google_cloud_grafeas_v1::model::Occurrence;
5822 /// use google_cloud_grafeas_v1::model::NoteKind;
5823 /// let x0 = Occurrence::new().set_kind(NoteKind::Vulnerability);
5824 /// let x1 = Occurrence::new().set_kind(NoteKind::Build);
5825 /// let x2 = Occurrence::new().set_kind(NoteKind::Image);
5826 /// ```
5827 pub fn set_kind<T: std::convert::Into<crate::model::NoteKind>>(mut self, v: T) -> Self {
5828 self.kind = v.into();
5829 self
5830 }
5831
5832 /// Sets the value of [remediation][crate::model::Occurrence::remediation].
5833 ///
5834 /// # Example
5835 /// ```ignore,no_run
5836 /// # use google_cloud_grafeas_v1::model::Occurrence;
5837 /// let x = Occurrence::new().set_remediation("example");
5838 /// ```
5839 pub fn set_remediation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5840 self.remediation = v.into();
5841 self
5842 }
5843
5844 /// Sets the value of [create_time][crate::model::Occurrence::create_time].
5845 ///
5846 /// # Example
5847 /// ```ignore,no_run
5848 /// # use google_cloud_grafeas_v1::model::Occurrence;
5849 /// use wkt::Timestamp;
5850 /// let x = Occurrence::new().set_create_time(Timestamp::default()/* use setters */);
5851 /// ```
5852 pub fn set_create_time<T>(mut self, v: T) -> Self
5853 where
5854 T: std::convert::Into<wkt::Timestamp>,
5855 {
5856 self.create_time = std::option::Option::Some(v.into());
5857 self
5858 }
5859
5860 /// Sets or clears the value of [create_time][crate::model::Occurrence::create_time].
5861 ///
5862 /// # Example
5863 /// ```ignore,no_run
5864 /// # use google_cloud_grafeas_v1::model::Occurrence;
5865 /// use wkt::Timestamp;
5866 /// let x = Occurrence::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5867 /// let x = Occurrence::new().set_or_clear_create_time(None::<Timestamp>);
5868 /// ```
5869 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5870 where
5871 T: std::convert::Into<wkt::Timestamp>,
5872 {
5873 self.create_time = v.map(|x| x.into());
5874 self
5875 }
5876
5877 /// Sets the value of [update_time][crate::model::Occurrence::update_time].
5878 ///
5879 /// # Example
5880 /// ```ignore,no_run
5881 /// # use google_cloud_grafeas_v1::model::Occurrence;
5882 /// use wkt::Timestamp;
5883 /// let x = Occurrence::new().set_update_time(Timestamp::default()/* use setters */);
5884 /// ```
5885 pub fn set_update_time<T>(mut self, v: T) -> Self
5886 where
5887 T: std::convert::Into<wkt::Timestamp>,
5888 {
5889 self.update_time = std::option::Option::Some(v.into());
5890 self
5891 }
5892
5893 /// Sets or clears the value of [update_time][crate::model::Occurrence::update_time].
5894 ///
5895 /// # Example
5896 /// ```ignore,no_run
5897 /// # use google_cloud_grafeas_v1::model::Occurrence;
5898 /// use wkt::Timestamp;
5899 /// let x = Occurrence::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
5900 /// let x = Occurrence::new().set_or_clear_update_time(None::<Timestamp>);
5901 /// ```
5902 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5903 where
5904 T: std::convert::Into<wkt::Timestamp>,
5905 {
5906 self.update_time = v.map(|x| x.into());
5907 self
5908 }
5909
5910 /// Sets the value of [envelope][crate::model::Occurrence::envelope].
5911 ///
5912 /// # Example
5913 /// ```ignore,no_run
5914 /// # use google_cloud_grafeas_v1::model::Occurrence;
5915 /// use google_cloud_grafeas_v1::model::Envelope;
5916 /// let x = Occurrence::new().set_envelope(Envelope::default()/* use setters */);
5917 /// ```
5918 pub fn set_envelope<T>(mut self, v: T) -> Self
5919 where
5920 T: std::convert::Into<crate::model::Envelope>,
5921 {
5922 self.envelope = std::option::Option::Some(v.into());
5923 self
5924 }
5925
5926 /// Sets or clears the value of [envelope][crate::model::Occurrence::envelope].
5927 ///
5928 /// # Example
5929 /// ```ignore,no_run
5930 /// # use google_cloud_grafeas_v1::model::Occurrence;
5931 /// use google_cloud_grafeas_v1::model::Envelope;
5932 /// let x = Occurrence::new().set_or_clear_envelope(Some(Envelope::default()/* use setters */));
5933 /// let x = Occurrence::new().set_or_clear_envelope(None::<Envelope>);
5934 /// ```
5935 pub fn set_or_clear_envelope<T>(mut self, v: std::option::Option<T>) -> Self
5936 where
5937 T: std::convert::Into<crate::model::Envelope>,
5938 {
5939 self.envelope = v.map(|x| x.into());
5940 self
5941 }
5942
5943 /// Sets the value of [details][crate::model::Occurrence::details].
5944 ///
5945 /// Note that all the setters affecting `details` are mutually
5946 /// exclusive.
5947 ///
5948 /// # Example
5949 /// ```ignore,no_run
5950 /// # use google_cloud_grafeas_v1::model::Occurrence;
5951 /// use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
5952 /// let x = Occurrence::new().set_details(Some(
5953 /// google_cloud_grafeas_v1::model::occurrence::Details::Vulnerability(VulnerabilityOccurrence::default().into())));
5954 /// ```
5955 pub fn set_details<
5956 T: std::convert::Into<std::option::Option<crate::model::occurrence::Details>>,
5957 >(
5958 mut self,
5959 v: T,
5960 ) -> Self {
5961 self.details = v.into();
5962 self
5963 }
5964
5965 /// The value of [details][crate::model::Occurrence::details]
5966 /// if it holds a `Vulnerability`, `None` if the field is not set or
5967 /// holds a different branch.
5968 pub fn vulnerability(
5969 &self,
5970 ) -> std::option::Option<&std::boxed::Box<crate::model::VulnerabilityOccurrence>> {
5971 #[allow(unreachable_patterns)]
5972 self.details.as_ref().and_then(|v| match v {
5973 crate::model::occurrence::Details::Vulnerability(v) => std::option::Option::Some(v),
5974 _ => std::option::Option::None,
5975 })
5976 }
5977
5978 /// Sets the value of [details][crate::model::Occurrence::details]
5979 /// to hold a `Vulnerability`.
5980 ///
5981 /// Note that all the setters affecting `details` are
5982 /// mutually exclusive.
5983 ///
5984 /// # Example
5985 /// ```ignore,no_run
5986 /// # use google_cloud_grafeas_v1::model::Occurrence;
5987 /// use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
5988 /// let x = Occurrence::new().set_vulnerability(VulnerabilityOccurrence::default()/* use setters */);
5989 /// assert!(x.vulnerability().is_some());
5990 /// assert!(x.build().is_none());
5991 /// assert!(x.image().is_none());
5992 /// assert!(x.package().is_none());
5993 /// assert!(x.deployment().is_none());
5994 /// assert!(x.discovery().is_none());
5995 /// assert!(x.attestation().is_none());
5996 /// assert!(x.upgrade().is_none());
5997 /// assert!(x.compliance().is_none());
5998 /// assert!(x.dsse_attestation().is_none());
5999 /// assert!(x.sbom_reference().is_none());
6000 /// assert!(x.secret().is_none());
6001 /// ```
6002 pub fn set_vulnerability<
6003 T: std::convert::Into<std::boxed::Box<crate::model::VulnerabilityOccurrence>>,
6004 >(
6005 mut self,
6006 v: T,
6007 ) -> Self {
6008 self.details =
6009 std::option::Option::Some(crate::model::occurrence::Details::Vulnerability(v.into()));
6010 self
6011 }
6012
6013 /// The value of [details][crate::model::Occurrence::details]
6014 /// if it holds a `Build`, `None` if the field is not set or
6015 /// holds a different branch.
6016 pub fn build(&self) -> std::option::Option<&std::boxed::Box<crate::model::BuildOccurrence>> {
6017 #[allow(unreachable_patterns)]
6018 self.details.as_ref().and_then(|v| match v {
6019 crate::model::occurrence::Details::Build(v) => std::option::Option::Some(v),
6020 _ => std::option::Option::None,
6021 })
6022 }
6023
6024 /// Sets the value of [details][crate::model::Occurrence::details]
6025 /// to hold a `Build`.
6026 ///
6027 /// Note that all the setters affecting `details` are
6028 /// mutually exclusive.
6029 ///
6030 /// # Example
6031 /// ```ignore,no_run
6032 /// # use google_cloud_grafeas_v1::model::Occurrence;
6033 /// use google_cloud_grafeas_v1::model::BuildOccurrence;
6034 /// let x = Occurrence::new().set_build(BuildOccurrence::default()/* use setters */);
6035 /// assert!(x.build().is_some());
6036 /// assert!(x.vulnerability().is_none());
6037 /// assert!(x.image().is_none());
6038 /// assert!(x.package().is_none());
6039 /// assert!(x.deployment().is_none());
6040 /// assert!(x.discovery().is_none());
6041 /// assert!(x.attestation().is_none());
6042 /// assert!(x.upgrade().is_none());
6043 /// assert!(x.compliance().is_none());
6044 /// assert!(x.dsse_attestation().is_none());
6045 /// assert!(x.sbom_reference().is_none());
6046 /// assert!(x.secret().is_none());
6047 /// ```
6048 pub fn set_build<T: std::convert::Into<std::boxed::Box<crate::model::BuildOccurrence>>>(
6049 mut self,
6050 v: T,
6051 ) -> Self {
6052 self.details =
6053 std::option::Option::Some(crate::model::occurrence::Details::Build(v.into()));
6054 self
6055 }
6056
6057 /// The value of [details][crate::model::Occurrence::details]
6058 /// if it holds a `Image`, `None` if the field is not set or
6059 /// holds a different branch.
6060 pub fn image(&self) -> std::option::Option<&std::boxed::Box<crate::model::ImageOccurrence>> {
6061 #[allow(unreachable_patterns)]
6062 self.details.as_ref().and_then(|v| match v {
6063 crate::model::occurrence::Details::Image(v) => std::option::Option::Some(v),
6064 _ => std::option::Option::None,
6065 })
6066 }
6067
6068 /// Sets the value of [details][crate::model::Occurrence::details]
6069 /// to hold a `Image`.
6070 ///
6071 /// Note that all the setters affecting `details` are
6072 /// mutually exclusive.
6073 ///
6074 /// # Example
6075 /// ```ignore,no_run
6076 /// # use google_cloud_grafeas_v1::model::Occurrence;
6077 /// use google_cloud_grafeas_v1::model::ImageOccurrence;
6078 /// let x = Occurrence::new().set_image(ImageOccurrence::default()/* use setters */);
6079 /// assert!(x.image().is_some());
6080 /// assert!(x.vulnerability().is_none());
6081 /// assert!(x.build().is_none());
6082 /// assert!(x.package().is_none());
6083 /// assert!(x.deployment().is_none());
6084 /// assert!(x.discovery().is_none());
6085 /// assert!(x.attestation().is_none());
6086 /// assert!(x.upgrade().is_none());
6087 /// assert!(x.compliance().is_none());
6088 /// assert!(x.dsse_attestation().is_none());
6089 /// assert!(x.sbom_reference().is_none());
6090 /// assert!(x.secret().is_none());
6091 /// ```
6092 pub fn set_image<T: std::convert::Into<std::boxed::Box<crate::model::ImageOccurrence>>>(
6093 mut self,
6094 v: T,
6095 ) -> Self {
6096 self.details =
6097 std::option::Option::Some(crate::model::occurrence::Details::Image(v.into()));
6098 self
6099 }
6100
6101 /// The value of [details][crate::model::Occurrence::details]
6102 /// if it holds a `Package`, `None` if the field is not set or
6103 /// holds a different branch.
6104 pub fn package(
6105 &self,
6106 ) -> std::option::Option<&std::boxed::Box<crate::model::PackageOccurrence>> {
6107 #[allow(unreachable_patterns)]
6108 self.details.as_ref().and_then(|v| match v {
6109 crate::model::occurrence::Details::Package(v) => std::option::Option::Some(v),
6110 _ => std::option::Option::None,
6111 })
6112 }
6113
6114 /// Sets the value of [details][crate::model::Occurrence::details]
6115 /// to hold a `Package`.
6116 ///
6117 /// Note that all the setters affecting `details` are
6118 /// mutually exclusive.
6119 ///
6120 /// # Example
6121 /// ```ignore,no_run
6122 /// # use google_cloud_grafeas_v1::model::Occurrence;
6123 /// use google_cloud_grafeas_v1::model::PackageOccurrence;
6124 /// let x = Occurrence::new().set_package(PackageOccurrence::default()/* use setters */);
6125 /// assert!(x.package().is_some());
6126 /// assert!(x.vulnerability().is_none());
6127 /// assert!(x.build().is_none());
6128 /// assert!(x.image().is_none());
6129 /// assert!(x.deployment().is_none());
6130 /// assert!(x.discovery().is_none());
6131 /// assert!(x.attestation().is_none());
6132 /// assert!(x.upgrade().is_none());
6133 /// assert!(x.compliance().is_none());
6134 /// assert!(x.dsse_attestation().is_none());
6135 /// assert!(x.sbom_reference().is_none());
6136 /// assert!(x.secret().is_none());
6137 /// ```
6138 pub fn set_package<T: std::convert::Into<std::boxed::Box<crate::model::PackageOccurrence>>>(
6139 mut self,
6140 v: T,
6141 ) -> Self {
6142 self.details =
6143 std::option::Option::Some(crate::model::occurrence::Details::Package(v.into()));
6144 self
6145 }
6146
6147 /// The value of [details][crate::model::Occurrence::details]
6148 /// if it holds a `Deployment`, `None` if the field is not set or
6149 /// holds a different branch.
6150 pub fn deployment(
6151 &self,
6152 ) -> std::option::Option<&std::boxed::Box<crate::model::DeploymentOccurrence>> {
6153 #[allow(unreachable_patterns)]
6154 self.details.as_ref().and_then(|v| match v {
6155 crate::model::occurrence::Details::Deployment(v) => std::option::Option::Some(v),
6156 _ => std::option::Option::None,
6157 })
6158 }
6159
6160 /// Sets the value of [details][crate::model::Occurrence::details]
6161 /// to hold a `Deployment`.
6162 ///
6163 /// Note that all the setters affecting `details` are
6164 /// mutually exclusive.
6165 ///
6166 /// # Example
6167 /// ```ignore,no_run
6168 /// # use google_cloud_grafeas_v1::model::Occurrence;
6169 /// use google_cloud_grafeas_v1::model::DeploymentOccurrence;
6170 /// let x = Occurrence::new().set_deployment(DeploymentOccurrence::default()/* use setters */);
6171 /// assert!(x.deployment().is_some());
6172 /// assert!(x.vulnerability().is_none());
6173 /// assert!(x.build().is_none());
6174 /// assert!(x.image().is_none());
6175 /// assert!(x.package().is_none());
6176 /// assert!(x.discovery().is_none());
6177 /// assert!(x.attestation().is_none());
6178 /// assert!(x.upgrade().is_none());
6179 /// assert!(x.compliance().is_none());
6180 /// assert!(x.dsse_attestation().is_none());
6181 /// assert!(x.sbom_reference().is_none());
6182 /// assert!(x.secret().is_none());
6183 /// ```
6184 pub fn set_deployment<
6185 T: std::convert::Into<std::boxed::Box<crate::model::DeploymentOccurrence>>,
6186 >(
6187 mut self,
6188 v: T,
6189 ) -> Self {
6190 self.details =
6191 std::option::Option::Some(crate::model::occurrence::Details::Deployment(v.into()));
6192 self
6193 }
6194
6195 /// The value of [details][crate::model::Occurrence::details]
6196 /// if it holds a `Discovery`, `None` if the field is not set or
6197 /// holds a different branch.
6198 pub fn discovery(
6199 &self,
6200 ) -> std::option::Option<&std::boxed::Box<crate::model::DiscoveryOccurrence>> {
6201 #[allow(unreachable_patterns)]
6202 self.details.as_ref().and_then(|v| match v {
6203 crate::model::occurrence::Details::Discovery(v) => std::option::Option::Some(v),
6204 _ => std::option::Option::None,
6205 })
6206 }
6207
6208 /// Sets the value of [details][crate::model::Occurrence::details]
6209 /// to hold a `Discovery`.
6210 ///
6211 /// Note that all the setters affecting `details` are
6212 /// mutually exclusive.
6213 ///
6214 /// # Example
6215 /// ```ignore,no_run
6216 /// # use google_cloud_grafeas_v1::model::Occurrence;
6217 /// use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
6218 /// let x = Occurrence::new().set_discovery(DiscoveryOccurrence::default()/* use setters */);
6219 /// assert!(x.discovery().is_some());
6220 /// assert!(x.vulnerability().is_none());
6221 /// assert!(x.build().is_none());
6222 /// assert!(x.image().is_none());
6223 /// assert!(x.package().is_none());
6224 /// assert!(x.deployment().is_none());
6225 /// assert!(x.attestation().is_none());
6226 /// assert!(x.upgrade().is_none());
6227 /// assert!(x.compliance().is_none());
6228 /// assert!(x.dsse_attestation().is_none());
6229 /// assert!(x.sbom_reference().is_none());
6230 /// assert!(x.secret().is_none());
6231 /// ```
6232 pub fn set_discovery<
6233 T: std::convert::Into<std::boxed::Box<crate::model::DiscoveryOccurrence>>,
6234 >(
6235 mut self,
6236 v: T,
6237 ) -> Self {
6238 self.details =
6239 std::option::Option::Some(crate::model::occurrence::Details::Discovery(v.into()));
6240 self
6241 }
6242
6243 /// The value of [details][crate::model::Occurrence::details]
6244 /// if it holds a `Attestation`, `None` if the field is not set or
6245 /// holds a different branch.
6246 pub fn attestation(
6247 &self,
6248 ) -> std::option::Option<&std::boxed::Box<crate::model::AttestationOccurrence>> {
6249 #[allow(unreachable_patterns)]
6250 self.details.as_ref().and_then(|v| match v {
6251 crate::model::occurrence::Details::Attestation(v) => std::option::Option::Some(v),
6252 _ => std::option::Option::None,
6253 })
6254 }
6255
6256 /// Sets the value of [details][crate::model::Occurrence::details]
6257 /// to hold a `Attestation`.
6258 ///
6259 /// Note that all the setters affecting `details` are
6260 /// mutually exclusive.
6261 ///
6262 /// # Example
6263 /// ```ignore,no_run
6264 /// # use google_cloud_grafeas_v1::model::Occurrence;
6265 /// use google_cloud_grafeas_v1::model::AttestationOccurrence;
6266 /// let x = Occurrence::new().set_attestation(AttestationOccurrence::default()/* use setters */);
6267 /// assert!(x.attestation().is_some());
6268 /// assert!(x.vulnerability().is_none());
6269 /// assert!(x.build().is_none());
6270 /// assert!(x.image().is_none());
6271 /// assert!(x.package().is_none());
6272 /// assert!(x.deployment().is_none());
6273 /// assert!(x.discovery().is_none());
6274 /// assert!(x.upgrade().is_none());
6275 /// assert!(x.compliance().is_none());
6276 /// assert!(x.dsse_attestation().is_none());
6277 /// assert!(x.sbom_reference().is_none());
6278 /// assert!(x.secret().is_none());
6279 /// ```
6280 pub fn set_attestation<
6281 T: std::convert::Into<std::boxed::Box<crate::model::AttestationOccurrence>>,
6282 >(
6283 mut self,
6284 v: T,
6285 ) -> Self {
6286 self.details =
6287 std::option::Option::Some(crate::model::occurrence::Details::Attestation(v.into()));
6288 self
6289 }
6290
6291 /// The value of [details][crate::model::Occurrence::details]
6292 /// if it holds a `Upgrade`, `None` if the field is not set or
6293 /// holds a different branch.
6294 pub fn upgrade(
6295 &self,
6296 ) -> std::option::Option<&std::boxed::Box<crate::model::UpgradeOccurrence>> {
6297 #[allow(unreachable_patterns)]
6298 self.details.as_ref().and_then(|v| match v {
6299 crate::model::occurrence::Details::Upgrade(v) => std::option::Option::Some(v),
6300 _ => std::option::Option::None,
6301 })
6302 }
6303
6304 /// Sets the value of [details][crate::model::Occurrence::details]
6305 /// to hold a `Upgrade`.
6306 ///
6307 /// Note that all the setters affecting `details` are
6308 /// mutually exclusive.
6309 ///
6310 /// # Example
6311 /// ```ignore,no_run
6312 /// # use google_cloud_grafeas_v1::model::Occurrence;
6313 /// use google_cloud_grafeas_v1::model::UpgradeOccurrence;
6314 /// let x = Occurrence::new().set_upgrade(UpgradeOccurrence::default()/* use setters */);
6315 /// assert!(x.upgrade().is_some());
6316 /// assert!(x.vulnerability().is_none());
6317 /// assert!(x.build().is_none());
6318 /// assert!(x.image().is_none());
6319 /// assert!(x.package().is_none());
6320 /// assert!(x.deployment().is_none());
6321 /// assert!(x.discovery().is_none());
6322 /// assert!(x.attestation().is_none());
6323 /// assert!(x.compliance().is_none());
6324 /// assert!(x.dsse_attestation().is_none());
6325 /// assert!(x.sbom_reference().is_none());
6326 /// assert!(x.secret().is_none());
6327 /// ```
6328 pub fn set_upgrade<T: std::convert::Into<std::boxed::Box<crate::model::UpgradeOccurrence>>>(
6329 mut self,
6330 v: T,
6331 ) -> Self {
6332 self.details =
6333 std::option::Option::Some(crate::model::occurrence::Details::Upgrade(v.into()));
6334 self
6335 }
6336
6337 /// The value of [details][crate::model::Occurrence::details]
6338 /// if it holds a `Compliance`, `None` if the field is not set or
6339 /// holds a different branch.
6340 pub fn compliance(
6341 &self,
6342 ) -> std::option::Option<&std::boxed::Box<crate::model::ComplianceOccurrence>> {
6343 #[allow(unreachable_patterns)]
6344 self.details.as_ref().and_then(|v| match v {
6345 crate::model::occurrence::Details::Compliance(v) => std::option::Option::Some(v),
6346 _ => std::option::Option::None,
6347 })
6348 }
6349
6350 /// Sets the value of [details][crate::model::Occurrence::details]
6351 /// to hold a `Compliance`.
6352 ///
6353 /// Note that all the setters affecting `details` are
6354 /// mutually exclusive.
6355 ///
6356 /// # Example
6357 /// ```ignore,no_run
6358 /// # use google_cloud_grafeas_v1::model::Occurrence;
6359 /// use google_cloud_grafeas_v1::model::ComplianceOccurrence;
6360 /// let x = Occurrence::new().set_compliance(ComplianceOccurrence::default()/* use setters */);
6361 /// assert!(x.compliance().is_some());
6362 /// assert!(x.vulnerability().is_none());
6363 /// assert!(x.build().is_none());
6364 /// assert!(x.image().is_none());
6365 /// assert!(x.package().is_none());
6366 /// assert!(x.deployment().is_none());
6367 /// assert!(x.discovery().is_none());
6368 /// assert!(x.attestation().is_none());
6369 /// assert!(x.upgrade().is_none());
6370 /// assert!(x.dsse_attestation().is_none());
6371 /// assert!(x.sbom_reference().is_none());
6372 /// assert!(x.secret().is_none());
6373 /// ```
6374 pub fn set_compliance<
6375 T: std::convert::Into<std::boxed::Box<crate::model::ComplianceOccurrence>>,
6376 >(
6377 mut self,
6378 v: T,
6379 ) -> Self {
6380 self.details =
6381 std::option::Option::Some(crate::model::occurrence::Details::Compliance(v.into()));
6382 self
6383 }
6384
6385 /// The value of [details][crate::model::Occurrence::details]
6386 /// if it holds a `DsseAttestation`, `None` if the field is not set or
6387 /// holds a different branch.
6388 pub fn dsse_attestation(
6389 &self,
6390 ) -> std::option::Option<&std::boxed::Box<crate::model::DSSEAttestationOccurrence>> {
6391 #[allow(unreachable_patterns)]
6392 self.details.as_ref().and_then(|v| match v {
6393 crate::model::occurrence::Details::DsseAttestation(v) => std::option::Option::Some(v),
6394 _ => std::option::Option::None,
6395 })
6396 }
6397
6398 /// Sets the value of [details][crate::model::Occurrence::details]
6399 /// to hold a `DsseAttestation`.
6400 ///
6401 /// Note that all the setters affecting `details` are
6402 /// mutually exclusive.
6403 ///
6404 /// # Example
6405 /// ```ignore,no_run
6406 /// # use google_cloud_grafeas_v1::model::Occurrence;
6407 /// use google_cloud_grafeas_v1::model::DSSEAttestationOccurrence;
6408 /// let x = Occurrence::new().set_dsse_attestation(DSSEAttestationOccurrence::default()/* use setters */);
6409 /// assert!(x.dsse_attestation().is_some());
6410 /// assert!(x.vulnerability().is_none());
6411 /// assert!(x.build().is_none());
6412 /// assert!(x.image().is_none());
6413 /// assert!(x.package().is_none());
6414 /// assert!(x.deployment().is_none());
6415 /// assert!(x.discovery().is_none());
6416 /// assert!(x.attestation().is_none());
6417 /// assert!(x.upgrade().is_none());
6418 /// assert!(x.compliance().is_none());
6419 /// assert!(x.sbom_reference().is_none());
6420 /// assert!(x.secret().is_none());
6421 /// ```
6422 pub fn set_dsse_attestation<
6423 T: std::convert::Into<std::boxed::Box<crate::model::DSSEAttestationOccurrence>>,
6424 >(
6425 mut self,
6426 v: T,
6427 ) -> Self {
6428 self.details =
6429 std::option::Option::Some(crate::model::occurrence::Details::DsseAttestation(v.into()));
6430 self
6431 }
6432
6433 /// The value of [details][crate::model::Occurrence::details]
6434 /// if it holds a `SbomReference`, `None` if the field is not set or
6435 /// holds a different branch.
6436 pub fn sbom_reference(
6437 &self,
6438 ) -> std::option::Option<&std::boxed::Box<crate::model::SBOMReferenceOccurrence>> {
6439 #[allow(unreachable_patterns)]
6440 self.details.as_ref().and_then(|v| match v {
6441 crate::model::occurrence::Details::SbomReference(v) => std::option::Option::Some(v),
6442 _ => std::option::Option::None,
6443 })
6444 }
6445
6446 /// Sets the value of [details][crate::model::Occurrence::details]
6447 /// to hold a `SbomReference`.
6448 ///
6449 /// Note that all the setters affecting `details` are
6450 /// mutually exclusive.
6451 ///
6452 /// # Example
6453 /// ```ignore,no_run
6454 /// # use google_cloud_grafeas_v1::model::Occurrence;
6455 /// use google_cloud_grafeas_v1::model::SBOMReferenceOccurrence;
6456 /// let x = Occurrence::new().set_sbom_reference(SBOMReferenceOccurrence::default()/* use setters */);
6457 /// assert!(x.sbom_reference().is_some());
6458 /// assert!(x.vulnerability().is_none());
6459 /// assert!(x.build().is_none());
6460 /// assert!(x.image().is_none());
6461 /// assert!(x.package().is_none());
6462 /// assert!(x.deployment().is_none());
6463 /// assert!(x.discovery().is_none());
6464 /// assert!(x.attestation().is_none());
6465 /// assert!(x.upgrade().is_none());
6466 /// assert!(x.compliance().is_none());
6467 /// assert!(x.dsse_attestation().is_none());
6468 /// assert!(x.secret().is_none());
6469 /// ```
6470 pub fn set_sbom_reference<
6471 T: std::convert::Into<std::boxed::Box<crate::model::SBOMReferenceOccurrence>>,
6472 >(
6473 mut self,
6474 v: T,
6475 ) -> Self {
6476 self.details =
6477 std::option::Option::Some(crate::model::occurrence::Details::SbomReference(v.into()));
6478 self
6479 }
6480
6481 /// The value of [details][crate::model::Occurrence::details]
6482 /// if it holds a `Secret`, `None` if the field is not set or
6483 /// holds a different branch.
6484 pub fn secret(&self) -> std::option::Option<&std::boxed::Box<crate::model::SecretOccurrence>> {
6485 #[allow(unreachable_patterns)]
6486 self.details.as_ref().and_then(|v| match v {
6487 crate::model::occurrence::Details::Secret(v) => std::option::Option::Some(v),
6488 _ => std::option::Option::None,
6489 })
6490 }
6491
6492 /// Sets the value of [details][crate::model::Occurrence::details]
6493 /// to hold a `Secret`.
6494 ///
6495 /// Note that all the setters affecting `details` are
6496 /// mutually exclusive.
6497 ///
6498 /// # Example
6499 /// ```ignore,no_run
6500 /// # use google_cloud_grafeas_v1::model::Occurrence;
6501 /// use google_cloud_grafeas_v1::model::SecretOccurrence;
6502 /// let x = Occurrence::new().set_secret(SecretOccurrence::default()/* use setters */);
6503 /// assert!(x.secret().is_some());
6504 /// assert!(x.vulnerability().is_none());
6505 /// assert!(x.build().is_none());
6506 /// assert!(x.image().is_none());
6507 /// assert!(x.package().is_none());
6508 /// assert!(x.deployment().is_none());
6509 /// assert!(x.discovery().is_none());
6510 /// assert!(x.attestation().is_none());
6511 /// assert!(x.upgrade().is_none());
6512 /// assert!(x.compliance().is_none());
6513 /// assert!(x.dsse_attestation().is_none());
6514 /// assert!(x.sbom_reference().is_none());
6515 /// ```
6516 pub fn set_secret<T: std::convert::Into<std::boxed::Box<crate::model::SecretOccurrence>>>(
6517 mut self,
6518 v: T,
6519 ) -> Self {
6520 self.details =
6521 std::option::Option::Some(crate::model::occurrence::Details::Secret(v.into()));
6522 self
6523 }
6524}
6525
6526impl wkt::message::Message for Occurrence {
6527 fn typename() -> &'static str {
6528 "type.googleapis.com/grafeas.v1.Occurrence"
6529 }
6530}
6531
6532/// Defines additional types related to [Occurrence].
6533pub mod occurrence {
6534 #[allow(unused_imports)]
6535 use super::*;
6536
6537 /// Required. Immutable. Describes the details of the note kind found on this
6538 /// resource.
6539 #[derive(Clone, Debug, PartialEq)]
6540 #[non_exhaustive]
6541 pub enum Details {
6542 /// Describes a security vulnerability.
6543 Vulnerability(std::boxed::Box<crate::model::VulnerabilityOccurrence>),
6544 /// Describes a verifiable build.
6545 Build(std::boxed::Box<crate::model::BuildOccurrence>),
6546 /// Describes how this resource derives from the basis in the associated
6547 /// note.
6548 Image(std::boxed::Box<crate::model::ImageOccurrence>),
6549 /// Describes the installation of a package on the linked resource.
6550 Package(std::boxed::Box<crate::model::PackageOccurrence>),
6551 /// Describes the deployment of an artifact on a runtime.
6552 Deployment(std::boxed::Box<crate::model::DeploymentOccurrence>),
6553 /// Describes when a resource was discovered.
6554 Discovery(std::boxed::Box<crate::model::DiscoveryOccurrence>),
6555 /// Describes an attestation of an artifact.
6556 Attestation(std::boxed::Box<crate::model::AttestationOccurrence>),
6557 /// Describes an available package upgrade on the linked resource.
6558 Upgrade(std::boxed::Box<crate::model::UpgradeOccurrence>),
6559 /// Describes a compliance violation on a linked resource.
6560 Compliance(std::boxed::Box<crate::model::ComplianceOccurrence>),
6561 /// Describes an attestation of an artifact using dsse.
6562 DsseAttestation(std::boxed::Box<crate::model::DSSEAttestationOccurrence>),
6563 /// Describes a specific SBOM reference occurrences.
6564 SbomReference(std::boxed::Box<crate::model::SBOMReferenceOccurrence>),
6565 /// Describes a secret.
6566 Secret(std::boxed::Box<crate::model::SecretOccurrence>),
6567 }
6568}
6569
6570/// A type of analysis that can be done for a resource.
6571#[derive(Clone, Default, PartialEq)]
6572#[non_exhaustive]
6573pub struct Note {
6574 /// Output only. The name of the note in the form of
6575 /// `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
6576 pub name: std::string::String,
6577
6578 /// A one sentence description of this note.
6579 pub short_description: std::string::String,
6580
6581 /// A detailed description of this note.
6582 pub long_description: std::string::String,
6583
6584 /// Output only. The type of analysis. This field can be used as a filter in
6585 /// list requests.
6586 pub kind: crate::model::NoteKind,
6587
6588 /// URLs associated with this note.
6589 pub related_url: std::vec::Vec<crate::model::RelatedUrl>,
6590
6591 /// Time of expiration for this note. Empty if note does not expire.
6592 pub expiration_time: std::option::Option<wkt::Timestamp>,
6593
6594 /// Output only. The time this note was created. This field can be used as a
6595 /// filter in list requests.
6596 pub create_time: std::option::Option<wkt::Timestamp>,
6597
6598 /// Output only. The time this note was last updated. This field can be used as
6599 /// a filter in list requests.
6600 pub update_time: std::option::Option<wkt::Timestamp>,
6601
6602 /// Other notes related to this note.
6603 pub related_note_names: std::vec::Vec<std::string::String>,
6604
6605 /// Required. Immutable. The type of analysis this note represents.
6606 pub r#type: std::option::Option<crate::model::note::Type>,
6607
6608 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6609}
6610
6611impl Note {
6612 pub fn new() -> Self {
6613 std::default::Default::default()
6614 }
6615
6616 /// Sets the value of [name][crate::model::Note::name].
6617 ///
6618 /// # Example
6619 /// ```ignore,no_run
6620 /// # use google_cloud_grafeas_v1::model::Note;
6621 /// let x = Note::new().set_name("example");
6622 /// ```
6623 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6624 self.name = v.into();
6625 self
6626 }
6627
6628 /// Sets the value of [short_description][crate::model::Note::short_description].
6629 ///
6630 /// # Example
6631 /// ```ignore,no_run
6632 /// # use google_cloud_grafeas_v1::model::Note;
6633 /// let x = Note::new().set_short_description("example");
6634 /// ```
6635 pub fn set_short_description<T: std::convert::Into<std::string::String>>(
6636 mut self,
6637 v: T,
6638 ) -> Self {
6639 self.short_description = v.into();
6640 self
6641 }
6642
6643 /// Sets the value of [long_description][crate::model::Note::long_description].
6644 ///
6645 /// # Example
6646 /// ```ignore,no_run
6647 /// # use google_cloud_grafeas_v1::model::Note;
6648 /// let x = Note::new().set_long_description("example");
6649 /// ```
6650 pub fn set_long_description<T: std::convert::Into<std::string::String>>(
6651 mut self,
6652 v: T,
6653 ) -> Self {
6654 self.long_description = v.into();
6655 self
6656 }
6657
6658 /// Sets the value of [kind][crate::model::Note::kind].
6659 ///
6660 /// # Example
6661 /// ```ignore,no_run
6662 /// # use google_cloud_grafeas_v1::model::Note;
6663 /// use google_cloud_grafeas_v1::model::NoteKind;
6664 /// let x0 = Note::new().set_kind(NoteKind::Vulnerability);
6665 /// let x1 = Note::new().set_kind(NoteKind::Build);
6666 /// let x2 = Note::new().set_kind(NoteKind::Image);
6667 /// ```
6668 pub fn set_kind<T: std::convert::Into<crate::model::NoteKind>>(mut self, v: T) -> Self {
6669 self.kind = v.into();
6670 self
6671 }
6672
6673 /// Sets the value of [related_url][crate::model::Note::related_url].
6674 ///
6675 /// # Example
6676 /// ```ignore,no_run
6677 /// # use google_cloud_grafeas_v1::model::Note;
6678 /// use google_cloud_grafeas_v1::model::RelatedUrl;
6679 /// let x = Note::new()
6680 /// .set_related_url([
6681 /// RelatedUrl::default()/* use setters */,
6682 /// RelatedUrl::default()/* use (different) setters */,
6683 /// ]);
6684 /// ```
6685 pub fn set_related_url<T, V>(mut self, v: T) -> Self
6686 where
6687 T: std::iter::IntoIterator<Item = V>,
6688 V: std::convert::Into<crate::model::RelatedUrl>,
6689 {
6690 use std::iter::Iterator;
6691 self.related_url = v.into_iter().map(|i| i.into()).collect();
6692 self
6693 }
6694
6695 /// Sets the value of [expiration_time][crate::model::Note::expiration_time].
6696 ///
6697 /// # Example
6698 /// ```ignore,no_run
6699 /// # use google_cloud_grafeas_v1::model::Note;
6700 /// use wkt::Timestamp;
6701 /// let x = Note::new().set_expiration_time(Timestamp::default()/* use setters */);
6702 /// ```
6703 pub fn set_expiration_time<T>(mut self, v: T) -> Self
6704 where
6705 T: std::convert::Into<wkt::Timestamp>,
6706 {
6707 self.expiration_time = std::option::Option::Some(v.into());
6708 self
6709 }
6710
6711 /// Sets or clears the value of [expiration_time][crate::model::Note::expiration_time].
6712 ///
6713 /// # Example
6714 /// ```ignore,no_run
6715 /// # use google_cloud_grafeas_v1::model::Note;
6716 /// use wkt::Timestamp;
6717 /// let x = Note::new().set_or_clear_expiration_time(Some(Timestamp::default()/* use setters */));
6718 /// let x = Note::new().set_or_clear_expiration_time(None::<Timestamp>);
6719 /// ```
6720 pub fn set_or_clear_expiration_time<T>(mut self, v: std::option::Option<T>) -> Self
6721 where
6722 T: std::convert::Into<wkt::Timestamp>,
6723 {
6724 self.expiration_time = v.map(|x| x.into());
6725 self
6726 }
6727
6728 /// Sets the value of [create_time][crate::model::Note::create_time].
6729 ///
6730 /// # Example
6731 /// ```ignore,no_run
6732 /// # use google_cloud_grafeas_v1::model::Note;
6733 /// use wkt::Timestamp;
6734 /// let x = Note::new().set_create_time(Timestamp::default()/* use setters */);
6735 /// ```
6736 pub fn set_create_time<T>(mut self, v: T) -> Self
6737 where
6738 T: std::convert::Into<wkt::Timestamp>,
6739 {
6740 self.create_time = std::option::Option::Some(v.into());
6741 self
6742 }
6743
6744 /// Sets or clears the value of [create_time][crate::model::Note::create_time].
6745 ///
6746 /// # Example
6747 /// ```ignore,no_run
6748 /// # use google_cloud_grafeas_v1::model::Note;
6749 /// use wkt::Timestamp;
6750 /// let x = Note::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6751 /// let x = Note::new().set_or_clear_create_time(None::<Timestamp>);
6752 /// ```
6753 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6754 where
6755 T: std::convert::Into<wkt::Timestamp>,
6756 {
6757 self.create_time = v.map(|x| x.into());
6758 self
6759 }
6760
6761 /// Sets the value of [update_time][crate::model::Note::update_time].
6762 ///
6763 /// # Example
6764 /// ```ignore,no_run
6765 /// # use google_cloud_grafeas_v1::model::Note;
6766 /// use wkt::Timestamp;
6767 /// let x = Note::new().set_update_time(Timestamp::default()/* use setters */);
6768 /// ```
6769 pub fn set_update_time<T>(mut self, v: T) -> Self
6770 where
6771 T: std::convert::Into<wkt::Timestamp>,
6772 {
6773 self.update_time = std::option::Option::Some(v.into());
6774 self
6775 }
6776
6777 /// Sets or clears the value of [update_time][crate::model::Note::update_time].
6778 ///
6779 /// # Example
6780 /// ```ignore,no_run
6781 /// # use google_cloud_grafeas_v1::model::Note;
6782 /// use wkt::Timestamp;
6783 /// let x = Note::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
6784 /// let x = Note::new().set_or_clear_update_time(None::<Timestamp>);
6785 /// ```
6786 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
6787 where
6788 T: std::convert::Into<wkt::Timestamp>,
6789 {
6790 self.update_time = v.map(|x| x.into());
6791 self
6792 }
6793
6794 /// Sets the value of [related_note_names][crate::model::Note::related_note_names].
6795 ///
6796 /// # Example
6797 /// ```ignore,no_run
6798 /// # use google_cloud_grafeas_v1::model::Note;
6799 /// let x = Note::new().set_related_note_names(["a", "b", "c"]);
6800 /// ```
6801 pub fn set_related_note_names<T, V>(mut self, v: T) -> Self
6802 where
6803 T: std::iter::IntoIterator<Item = V>,
6804 V: std::convert::Into<std::string::String>,
6805 {
6806 use std::iter::Iterator;
6807 self.related_note_names = v.into_iter().map(|i| i.into()).collect();
6808 self
6809 }
6810
6811 /// Sets the value of [r#type][crate::model::Note::type].
6812 ///
6813 /// Note that all the setters affecting `r#type` are mutually
6814 /// exclusive.
6815 ///
6816 /// # Example
6817 /// ```ignore,no_run
6818 /// # use google_cloud_grafeas_v1::model::Note;
6819 /// use google_cloud_grafeas_v1::model::VulnerabilityNote;
6820 /// let x = Note::new().set_type(Some(
6821 /// google_cloud_grafeas_v1::model::note::Type::Vulnerability(VulnerabilityNote::default().into())));
6822 /// ```
6823 pub fn set_type<T: std::convert::Into<std::option::Option<crate::model::note::Type>>>(
6824 mut self,
6825 v: T,
6826 ) -> Self {
6827 self.r#type = v.into();
6828 self
6829 }
6830
6831 /// The value of [r#type][crate::model::Note::r#type]
6832 /// if it holds a `Vulnerability`, `None` if the field is not set or
6833 /// holds a different branch.
6834 pub fn vulnerability(
6835 &self,
6836 ) -> std::option::Option<&std::boxed::Box<crate::model::VulnerabilityNote>> {
6837 #[allow(unreachable_patterns)]
6838 self.r#type.as_ref().and_then(|v| match v {
6839 crate::model::note::Type::Vulnerability(v) => std::option::Option::Some(v),
6840 _ => std::option::Option::None,
6841 })
6842 }
6843
6844 /// Sets the value of [r#type][crate::model::Note::r#type]
6845 /// to hold a `Vulnerability`.
6846 ///
6847 /// Note that all the setters affecting `r#type` are
6848 /// mutually exclusive.
6849 ///
6850 /// # Example
6851 /// ```ignore,no_run
6852 /// # use google_cloud_grafeas_v1::model::Note;
6853 /// use google_cloud_grafeas_v1::model::VulnerabilityNote;
6854 /// let x = Note::new().set_vulnerability(VulnerabilityNote::default()/* use setters */);
6855 /// assert!(x.vulnerability().is_some());
6856 /// assert!(x.build().is_none());
6857 /// assert!(x.image().is_none());
6858 /// assert!(x.package().is_none());
6859 /// assert!(x.deployment().is_none());
6860 /// assert!(x.discovery().is_none());
6861 /// assert!(x.attestation().is_none());
6862 /// assert!(x.upgrade().is_none());
6863 /// assert!(x.compliance().is_none());
6864 /// assert!(x.dsse_attestation().is_none());
6865 /// assert!(x.vulnerability_assessment().is_none());
6866 /// assert!(x.sbom_reference().is_none());
6867 /// assert!(x.secret().is_none());
6868 /// ```
6869 pub fn set_vulnerability<
6870 T: std::convert::Into<std::boxed::Box<crate::model::VulnerabilityNote>>,
6871 >(
6872 mut self,
6873 v: T,
6874 ) -> Self {
6875 self.r#type = std::option::Option::Some(crate::model::note::Type::Vulnerability(v.into()));
6876 self
6877 }
6878
6879 /// The value of [r#type][crate::model::Note::r#type]
6880 /// if it holds a `Build`, `None` if the field is not set or
6881 /// holds a different branch.
6882 pub fn build(&self) -> std::option::Option<&std::boxed::Box<crate::model::BuildNote>> {
6883 #[allow(unreachable_patterns)]
6884 self.r#type.as_ref().and_then(|v| match v {
6885 crate::model::note::Type::Build(v) => std::option::Option::Some(v),
6886 _ => std::option::Option::None,
6887 })
6888 }
6889
6890 /// Sets the value of [r#type][crate::model::Note::r#type]
6891 /// to hold a `Build`.
6892 ///
6893 /// Note that all the setters affecting `r#type` are
6894 /// mutually exclusive.
6895 ///
6896 /// # Example
6897 /// ```ignore,no_run
6898 /// # use google_cloud_grafeas_v1::model::Note;
6899 /// use google_cloud_grafeas_v1::model::BuildNote;
6900 /// let x = Note::new().set_build(BuildNote::default()/* use setters */);
6901 /// assert!(x.build().is_some());
6902 /// assert!(x.vulnerability().is_none());
6903 /// assert!(x.image().is_none());
6904 /// assert!(x.package().is_none());
6905 /// assert!(x.deployment().is_none());
6906 /// assert!(x.discovery().is_none());
6907 /// assert!(x.attestation().is_none());
6908 /// assert!(x.upgrade().is_none());
6909 /// assert!(x.compliance().is_none());
6910 /// assert!(x.dsse_attestation().is_none());
6911 /// assert!(x.vulnerability_assessment().is_none());
6912 /// assert!(x.sbom_reference().is_none());
6913 /// assert!(x.secret().is_none());
6914 /// ```
6915 pub fn set_build<T: std::convert::Into<std::boxed::Box<crate::model::BuildNote>>>(
6916 mut self,
6917 v: T,
6918 ) -> Self {
6919 self.r#type = std::option::Option::Some(crate::model::note::Type::Build(v.into()));
6920 self
6921 }
6922
6923 /// The value of [r#type][crate::model::Note::r#type]
6924 /// if it holds a `Image`, `None` if the field is not set or
6925 /// holds a different branch.
6926 pub fn image(&self) -> std::option::Option<&std::boxed::Box<crate::model::ImageNote>> {
6927 #[allow(unreachable_patterns)]
6928 self.r#type.as_ref().and_then(|v| match v {
6929 crate::model::note::Type::Image(v) => std::option::Option::Some(v),
6930 _ => std::option::Option::None,
6931 })
6932 }
6933
6934 /// Sets the value of [r#type][crate::model::Note::r#type]
6935 /// to hold a `Image`.
6936 ///
6937 /// Note that all the setters affecting `r#type` are
6938 /// mutually exclusive.
6939 ///
6940 /// # Example
6941 /// ```ignore,no_run
6942 /// # use google_cloud_grafeas_v1::model::Note;
6943 /// use google_cloud_grafeas_v1::model::ImageNote;
6944 /// let x = Note::new().set_image(ImageNote::default()/* use setters */);
6945 /// assert!(x.image().is_some());
6946 /// assert!(x.vulnerability().is_none());
6947 /// assert!(x.build().is_none());
6948 /// assert!(x.package().is_none());
6949 /// assert!(x.deployment().is_none());
6950 /// assert!(x.discovery().is_none());
6951 /// assert!(x.attestation().is_none());
6952 /// assert!(x.upgrade().is_none());
6953 /// assert!(x.compliance().is_none());
6954 /// assert!(x.dsse_attestation().is_none());
6955 /// assert!(x.vulnerability_assessment().is_none());
6956 /// assert!(x.sbom_reference().is_none());
6957 /// assert!(x.secret().is_none());
6958 /// ```
6959 pub fn set_image<T: std::convert::Into<std::boxed::Box<crate::model::ImageNote>>>(
6960 mut self,
6961 v: T,
6962 ) -> Self {
6963 self.r#type = std::option::Option::Some(crate::model::note::Type::Image(v.into()));
6964 self
6965 }
6966
6967 /// The value of [r#type][crate::model::Note::r#type]
6968 /// if it holds a `Package`, `None` if the field is not set or
6969 /// holds a different branch.
6970 pub fn package(&self) -> std::option::Option<&std::boxed::Box<crate::model::PackageNote>> {
6971 #[allow(unreachable_patterns)]
6972 self.r#type.as_ref().and_then(|v| match v {
6973 crate::model::note::Type::Package(v) => std::option::Option::Some(v),
6974 _ => std::option::Option::None,
6975 })
6976 }
6977
6978 /// Sets the value of [r#type][crate::model::Note::r#type]
6979 /// to hold a `Package`.
6980 ///
6981 /// Note that all the setters affecting `r#type` are
6982 /// mutually exclusive.
6983 ///
6984 /// # Example
6985 /// ```ignore,no_run
6986 /// # use google_cloud_grafeas_v1::model::Note;
6987 /// use google_cloud_grafeas_v1::model::PackageNote;
6988 /// let x = Note::new().set_package(PackageNote::default()/* use setters */);
6989 /// assert!(x.package().is_some());
6990 /// assert!(x.vulnerability().is_none());
6991 /// assert!(x.build().is_none());
6992 /// assert!(x.image().is_none());
6993 /// assert!(x.deployment().is_none());
6994 /// assert!(x.discovery().is_none());
6995 /// assert!(x.attestation().is_none());
6996 /// assert!(x.upgrade().is_none());
6997 /// assert!(x.compliance().is_none());
6998 /// assert!(x.dsse_attestation().is_none());
6999 /// assert!(x.vulnerability_assessment().is_none());
7000 /// assert!(x.sbom_reference().is_none());
7001 /// assert!(x.secret().is_none());
7002 /// ```
7003 pub fn set_package<T: std::convert::Into<std::boxed::Box<crate::model::PackageNote>>>(
7004 mut self,
7005 v: T,
7006 ) -> Self {
7007 self.r#type = std::option::Option::Some(crate::model::note::Type::Package(v.into()));
7008 self
7009 }
7010
7011 /// The value of [r#type][crate::model::Note::r#type]
7012 /// if it holds a `Deployment`, `None` if the field is not set or
7013 /// holds a different branch.
7014 pub fn deployment(
7015 &self,
7016 ) -> std::option::Option<&std::boxed::Box<crate::model::DeploymentNote>> {
7017 #[allow(unreachable_patterns)]
7018 self.r#type.as_ref().and_then(|v| match v {
7019 crate::model::note::Type::Deployment(v) => std::option::Option::Some(v),
7020 _ => std::option::Option::None,
7021 })
7022 }
7023
7024 /// Sets the value of [r#type][crate::model::Note::r#type]
7025 /// to hold a `Deployment`.
7026 ///
7027 /// Note that all the setters affecting `r#type` are
7028 /// mutually exclusive.
7029 ///
7030 /// # Example
7031 /// ```ignore,no_run
7032 /// # use google_cloud_grafeas_v1::model::Note;
7033 /// use google_cloud_grafeas_v1::model::DeploymentNote;
7034 /// let x = Note::new().set_deployment(DeploymentNote::default()/* use setters */);
7035 /// assert!(x.deployment().is_some());
7036 /// assert!(x.vulnerability().is_none());
7037 /// assert!(x.build().is_none());
7038 /// assert!(x.image().is_none());
7039 /// assert!(x.package().is_none());
7040 /// assert!(x.discovery().is_none());
7041 /// assert!(x.attestation().is_none());
7042 /// assert!(x.upgrade().is_none());
7043 /// assert!(x.compliance().is_none());
7044 /// assert!(x.dsse_attestation().is_none());
7045 /// assert!(x.vulnerability_assessment().is_none());
7046 /// assert!(x.sbom_reference().is_none());
7047 /// assert!(x.secret().is_none());
7048 /// ```
7049 pub fn set_deployment<T: std::convert::Into<std::boxed::Box<crate::model::DeploymentNote>>>(
7050 mut self,
7051 v: T,
7052 ) -> Self {
7053 self.r#type = std::option::Option::Some(crate::model::note::Type::Deployment(v.into()));
7054 self
7055 }
7056
7057 /// The value of [r#type][crate::model::Note::r#type]
7058 /// if it holds a `Discovery`, `None` if the field is not set or
7059 /// holds a different branch.
7060 pub fn discovery(&self) -> std::option::Option<&std::boxed::Box<crate::model::DiscoveryNote>> {
7061 #[allow(unreachable_patterns)]
7062 self.r#type.as_ref().and_then(|v| match v {
7063 crate::model::note::Type::Discovery(v) => std::option::Option::Some(v),
7064 _ => std::option::Option::None,
7065 })
7066 }
7067
7068 /// Sets the value of [r#type][crate::model::Note::r#type]
7069 /// to hold a `Discovery`.
7070 ///
7071 /// Note that all the setters affecting `r#type` are
7072 /// mutually exclusive.
7073 ///
7074 /// # Example
7075 /// ```ignore,no_run
7076 /// # use google_cloud_grafeas_v1::model::Note;
7077 /// use google_cloud_grafeas_v1::model::DiscoveryNote;
7078 /// let x = Note::new().set_discovery(DiscoveryNote::default()/* use setters */);
7079 /// assert!(x.discovery().is_some());
7080 /// assert!(x.vulnerability().is_none());
7081 /// assert!(x.build().is_none());
7082 /// assert!(x.image().is_none());
7083 /// assert!(x.package().is_none());
7084 /// assert!(x.deployment().is_none());
7085 /// assert!(x.attestation().is_none());
7086 /// assert!(x.upgrade().is_none());
7087 /// assert!(x.compliance().is_none());
7088 /// assert!(x.dsse_attestation().is_none());
7089 /// assert!(x.vulnerability_assessment().is_none());
7090 /// assert!(x.sbom_reference().is_none());
7091 /// assert!(x.secret().is_none());
7092 /// ```
7093 pub fn set_discovery<T: std::convert::Into<std::boxed::Box<crate::model::DiscoveryNote>>>(
7094 mut self,
7095 v: T,
7096 ) -> Self {
7097 self.r#type = std::option::Option::Some(crate::model::note::Type::Discovery(v.into()));
7098 self
7099 }
7100
7101 /// The value of [r#type][crate::model::Note::r#type]
7102 /// if it holds a `Attestation`, `None` if the field is not set or
7103 /// holds a different branch.
7104 pub fn attestation(
7105 &self,
7106 ) -> std::option::Option<&std::boxed::Box<crate::model::AttestationNote>> {
7107 #[allow(unreachable_patterns)]
7108 self.r#type.as_ref().and_then(|v| match v {
7109 crate::model::note::Type::Attestation(v) => std::option::Option::Some(v),
7110 _ => std::option::Option::None,
7111 })
7112 }
7113
7114 /// Sets the value of [r#type][crate::model::Note::r#type]
7115 /// to hold a `Attestation`.
7116 ///
7117 /// Note that all the setters affecting `r#type` are
7118 /// mutually exclusive.
7119 ///
7120 /// # Example
7121 /// ```ignore,no_run
7122 /// # use google_cloud_grafeas_v1::model::Note;
7123 /// use google_cloud_grafeas_v1::model::AttestationNote;
7124 /// let x = Note::new().set_attestation(AttestationNote::default()/* use setters */);
7125 /// assert!(x.attestation().is_some());
7126 /// assert!(x.vulnerability().is_none());
7127 /// assert!(x.build().is_none());
7128 /// assert!(x.image().is_none());
7129 /// assert!(x.package().is_none());
7130 /// assert!(x.deployment().is_none());
7131 /// assert!(x.discovery().is_none());
7132 /// assert!(x.upgrade().is_none());
7133 /// assert!(x.compliance().is_none());
7134 /// assert!(x.dsse_attestation().is_none());
7135 /// assert!(x.vulnerability_assessment().is_none());
7136 /// assert!(x.sbom_reference().is_none());
7137 /// assert!(x.secret().is_none());
7138 /// ```
7139 pub fn set_attestation<
7140 T: std::convert::Into<std::boxed::Box<crate::model::AttestationNote>>,
7141 >(
7142 mut self,
7143 v: T,
7144 ) -> Self {
7145 self.r#type = std::option::Option::Some(crate::model::note::Type::Attestation(v.into()));
7146 self
7147 }
7148
7149 /// The value of [r#type][crate::model::Note::r#type]
7150 /// if it holds a `Upgrade`, `None` if the field is not set or
7151 /// holds a different branch.
7152 pub fn upgrade(&self) -> std::option::Option<&std::boxed::Box<crate::model::UpgradeNote>> {
7153 #[allow(unreachable_patterns)]
7154 self.r#type.as_ref().and_then(|v| match v {
7155 crate::model::note::Type::Upgrade(v) => std::option::Option::Some(v),
7156 _ => std::option::Option::None,
7157 })
7158 }
7159
7160 /// Sets the value of [r#type][crate::model::Note::r#type]
7161 /// to hold a `Upgrade`.
7162 ///
7163 /// Note that all the setters affecting `r#type` are
7164 /// mutually exclusive.
7165 ///
7166 /// # Example
7167 /// ```ignore,no_run
7168 /// # use google_cloud_grafeas_v1::model::Note;
7169 /// use google_cloud_grafeas_v1::model::UpgradeNote;
7170 /// let x = Note::new().set_upgrade(UpgradeNote::default()/* use setters */);
7171 /// assert!(x.upgrade().is_some());
7172 /// assert!(x.vulnerability().is_none());
7173 /// assert!(x.build().is_none());
7174 /// assert!(x.image().is_none());
7175 /// assert!(x.package().is_none());
7176 /// assert!(x.deployment().is_none());
7177 /// assert!(x.discovery().is_none());
7178 /// assert!(x.attestation().is_none());
7179 /// assert!(x.compliance().is_none());
7180 /// assert!(x.dsse_attestation().is_none());
7181 /// assert!(x.vulnerability_assessment().is_none());
7182 /// assert!(x.sbom_reference().is_none());
7183 /// assert!(x.secret().is_none());
7184 /// ```
7185 pub fn set_upgrade<T: std::convert::Into<std::boxed::Box<crate::model::UpgradeNote>>>(
7186 mut self,
7187 v: T,
7188 ) -> Self {
7189 self.r#type = std::option::Option::Some(crate::model::note::Type::Upgrade(v.into()));
7190 self
7191 }
7192
7193 /// The value of [r#type][crate::model::Note::r#type]
7194 /// if it holds a `Compliance`, `None` if the field is not set or
7195 /// holds a different branch.
7196 pub fn compliance(
7197 &self,
7198 ) -> std::option::Option<&std::boxed::Box<crate::model::ComplianceNote>> {
7199 #[allow(unreachable_patterns)]
7200 self.r#type.as_ref().and_then(|v| match v {
7201 crate::model::note::Type::Compliance(v) => std::option::Option::Some(v),
7202 _ => std::option::Option::None,
7203 })
7204 }
7205
7206 /// Sets the value of [r#type][crate::model::Note::r#type]
7207 /// to hold a `Compliance`.
7208 ///
7209 /// Note that all the setters affecting `r#type` are
7210 /// mutually exclusive.
7211 ///
7212 /// # Example
7213 /// ```ignore,no_run
7214 /// # use google_cloud_grafeas_v1::model::Note;
7215 /// use google_cloud_grafeas_v1::model::ComplianceNote;
7216 /// let x = Note::new().set_compliance(ComplianceNote::default()/* use setters */);
7217 /// assert!(x.compliance().is_some());
7218 /// assert!(x.vulnerability().is_none());
7219 /// assert!(x.build().is_none());
7220 /// assert!(x.image().is_none());
7221 /// assert!(x.package().is_none());
7222 /// assert!(x.deployment().is_none());
7223 /// assert!(x.discovery().is_none());
7224 /// assert!(x.attestation().is_none());
7225 /// assert!(x.upgrade().is_none());
7226 /// assert!(x.dsse_attestation().is_none());
7227 /// assert!(x.vulnerability_assessment().is_none());
7228 /// assert!(x.sbom_reference().is_none());
7229 /// assert!(x.secret().is_none());
7230 /// ```
7231 pub fn set_compliance<T: std::convert::Into<std::boxed::Box<crate::model::ComplianceNote>>>(
7232 mut self,
7233 v: T,
7234 ) -> Self {
7235 self.r#type = std::option::Option::Some(crate::model::note::Type::Compliance(v.into()));
7236 self
7237 }
7238
7239 /// The value of [r#type][crate::model::Note::r#type]
7240 /// if it holds a `DsseAttestation`, `None` if the field is not set or
7241 /// holds a different branch.
7242 pub fn dsse_attestation(
7243 &self,
7244 ) -> std::option::Option<&std::boxed::Box<crate::model::DSSEAttestationNote>> {
7245 #[allow(unreachable_patterns)]
7246 self.r#type.as_ref().and_then(|v| match v {
7247 crate::model::note::Type::DsseAttestation(v) => std::option::Option::Some(v),
7248 _ => std::option::Option::None,
7249 })
7250 }
7251
7252 /// Sets the value of [r#type][crate::model::Note::r#type]
7253 /// to hold a `DsseAttestation`.
7254 ///
7255 /// Note that all the setters affecting `r#type` are
7256 /// mutually exclusive.
7257 ///
7258 /// # Example
7259 /// ```ignore,no_run
7260 /// # use google_cloud_grafeas_v1::model::Note;
7261 /// use google_cloud_grafeas_v1::model::DSSEAttestationNote;
7262 /// let x = Note::new().set_dsse_attestation(DSSEAttestationNote::default()/* use setters */);
7263 /// assert!(x.dsse_attestation().is_some());
7264 /// assert!(x.vulnerability().is_none());
7265 /// assert!(x.build().is_none());
7266 /// assert!(x.image().is_none());
7267 /// assert!(x.package().is_none());
7268 /// assert!(x.deployment().is_none());
7269 /// assert!(x.discovery().is_none());
7270 /// assert!(x.attestation().is_none());
7271 /// assert!(x.upgrade().is_none());
7272 /// assert!(x.compliance().is_none());
7273 /// assert!(x.vulnerability_assessment().is_none());
7274 /// assert!(x.sbom_reference().is_none());
7275 /// assert!(x.secret().is_none());
7276 /// ```
7277 pub fn set_dsse_attestation<
7278 T: std::convert::Into<std::boxed::Box<crate::model::DSSEAttestationNote>>,
7279 >(
7280 mut self,
7281 v: T,
7282 ) -> Self {
7283 self.r#type =
7284 std::option::Option::Some(crate::model::note::Type::DsseAttestation(v.into()));
7285 self
7286 }
7287
7288 /// The value of [r#type][crate::model::Note::r#type]
7289 /// if it holds a `VulnerabilityAssessment`, `None` if the field is not set or
7290 /// holds a different branch.
7291 pub fn vulnerability_assessment(
7292 &self,
7293 ) -> std::option::Option<&std::boxed::Box<crate::model::VulnerabilityAssessmentNote>> {
7294 #[allow(unreachable_patterns)]
7295 self.r#type.as_ref().and_then(|v| match v {
7296 crate::model::note::Type::VulnerabilityAssessment(v) => std::option::Option::Some(v),
7297 _ => std::option::Option::None,
7298 })
7299 }
7300
7301 /// Sets the value of [r#type][crate::model::Note::r#type]
7302 /// to hold a `VulnerabilityAssessment`.
7303 ///
7304 /// Note that all the setters affecting `r#type` are
7305 /// mutually exclusive.
7306 ///
7307 /// # Example
7308 /// ```ignore,no_run
7309 /// # use google_cloud_grafeas_v1::model::Note;
7310 /// use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
7311 /// let x = Note::new().set_vulnerability_assessment(VulnerabilityAssessmentNote::default()/* use setters */);
7312 /// assert!(x.vulnerability_assessment().is_some());
7313 /// assert!(x.vulnerability().is_none());
7314 /// assert!(x.build().is_none());
7315 /// assert!(x.image().is_none());
7316 /// assert!(x.package().is_none());
7317 /// assert!(x.deployment().is_none());
7318 /// assert!(x.discovery().is_none());
7319 /// assert!(x.attestation().is_none());
7320 /// assert!(x.upgrade().is_none());
7321 /// assert!(x.compliance().is_none());
7322 /// assert!(x.dsse_attestation().is_none());
7323 /// assert!(x.sbom_reference().is_none());
7324 /// assert!(x.secret().is_none());
7325 /// ```
7326 pub fn set_vulnerability_assessment<
7327 T: std::convert::Into<std::boxed::Box<crate::model::VulnerabilityAssessmentNote>>,
7328 >(
7329 mut self,
7330 v: T,
7331 ) -> Self {
7332 self.r#type =
7333 std::option::Option::Some(crate::model::note::Type::VulnerabilityAssessment(v.into()));
7334 self
7335 }
7336
7337 /// The value of [r#type][crate::model::Note::r#type]
7338 /// if it holds a `SbomReference`, `None` if the field is not set or
7339 /// holds a different branch.
7340 pub fn sbom_reference(
7341 &self,
7342 ) -> std::option::Option<&std::boxed::Box<crate::model::SBOMReferenceNote>> {
7343 #[allow(unreachable_patterns)]
7344 self.r#type.as_ref().and_then(|v| match v {
7345 crate::model::note::Type::SbomReference(v) => std::option::Option::Some(v),
7346 _ => std::option::Option::None,
7347 })
7348 }
7349
7350 /// Sets the value of [r#type][crate::model::Note::r#type]
7351 /// to hold a `SbomReference`.
7352 ///
7353 /// Note that all the setters affecting `r#type` are
7354 /// mutually exclusive.
7355 ///
7356 /// # Example
7357 /// ```ignore,no_run
7358 /// # use google_cloud_grafeas_v1::model::Note;
7359 /// use google_cloud_grafeas_v1::model::SBOMReferenceNote;
7360 /// let x = Note::new().set_sbom_reference(SBOMReferenceNote::default()/* use setters */);
7361 /// assert!(x.sbom_reference().is_some());
7362 /// assert!(x.vulnerability().is_none());
7363 /// assert!(x.build().is_none());
7364 /// assert!(x.image().is_none());
7365 /// assert!(x.package().is_none());
7366 /// assert!(x.deployment().is_none());
7367 /// assert!(x.discovery().is_none());
7368 /// assert!(x.attestation().is_none());
7369 /// assert!(x.upgrade().is_none());
7370 /// assert!(x.compliance().is_none());
7371 /// assert!(x.dsse_attestation().is_none());
7372 /// assert!(x.vulnerability_assessment().is_none());
7373 /// assert!(x.secret().is_none());
7374 /// ```
7375 pub fn set_sbom_reference<
7376 T: std::convert::Into<std::boxed::Box<crate::model::SBOMReferenceNote>>,
7377 >(
7378 mut self,
7379 v: T,
7380 ) -> Self {
7381 self.r#type = std::option::Option::Some(crate::model::note::Type::SbomReference(v.into()));
7382 self
7383 }
7384
7385 /// The value of [r#type][crate::model::Note::r#type]
7386 /// if it holds a `Secret`, `None` if the field is not set or
7387 /// holds a different branch.
7388 pub fn secret(&self) -> std::option::Option<&std::boxed::Box<crate::model::SecretNote>> {
7389 #[allow(unreachable_patterns)]
7390 self.r#type.as_ref().and_then(|v| match v {
7391 crate::model::note::Type::Secret(v) => std::option::Option::Some(v),
7392 _ => std::option::Option::None,
7393 })
7394 }
7395
7396 /// Sets the value of [r#type][crate::model::Note::r#type]
7397 /// to hold a `Secret`.
7398 ///
7399 /// Note that all the setters affecting `r#type` are
7400 /// mutually exclusive.
7401 ///
7402 /// # Example
7403 /// ```ignore,no_run
7404 /// # use google_cloud_grafeas_v1::model::Note;
7405 /// use google_cloud_grafeas_v1::model::SecretNote;
7406 /// let x = Note::new().set_secret(SecretNote::default()/* use setters */);
7407 /// assert!(x.secret().is_some());
7408 /// assert!(x.vulnerability().is_none());
7409 /// assert!(x.build().is_none());
7410 /// assert!(x.image().is_none());
7411 /// assert!(x.package().is_none());
7412 /// assert!(x.deployment().is_none());
7413 /// assert!(x.discovery().is_none());
7414 /// assert!(x.attestation().is_none());
7415 /// assert!(x.upgrade().is_none());
7416 /// assert!(x.compliance().is_none());
7417 /// assert!(x.dsse_attestation().is_none());
7418 /// assert!(x.vulnerability_assessment().is_none());
7419 /// assert!(x.sbom_reference().is_none());
7420 /// ```
7421 pub fn set_secret<T: std::convert::Into<std::boxed::Box<crate::model::SecretNote>>>(
7422 mut self,
7423 v: T,
7424 ) -> Self {
7425 self.r#type = std::option::Option::Some(crate::model::note::Type::Secret(v.into()));
7426 self
7427 }
7428}
7429
7430impl wkt::message::Message for Note {
7431 fn typename() -> &'static str {
7432 "type.googleapis.com/grafeas.v1.Note"
7433 }
7434}
7435
7436/// Defines additional types related to [Note].
7437pub mod note {
7438 #[allow(unused_imports)]
7439 use super::*;
7440
7441 /// Required. Immutable. The type of analysis this note represents.
7442 #[derive(Clone, Debug, PartialEq)]
7443 #[non_exhaustive]
7444 pub enum Type {
7445 /// A note describing a package vulnerability.
7446 Vulnerability(std::boxed::Box<crate::model::VulnerabilityNote>),
7447 /// A note describing build provenance for a verifiable build.
7448 Build(std::boxed::Box<crate::model::BuildNote>),
7449 /// A note describing a base image.
7450 Image(std::boxed::Box<crate::model::ImageNote>),
7451 /// A note describing a package hosted by various package managers.
7452 Package(std::boxed::Box<crate::model::PackageNote>),
7453 /// A note describing something that can be deployed.
7454 Deployment(std::boxed::Box<crate::model::DeploymentNote>),
7455 /// A note describing the initial analysis of a resource.
7456 Discovery(std::boxed::Box<crate::model::DiscoveryNote>),
7457 /// A note describing an attestation role.
7458 Attestation(std::boxed::Box<crate::model::AttestationNote>),
7459 /// A note describing available package upgrades.
7460 Upgrade(std::boxed::Box<crate::model::UpgradeNote>),
7461 /// A note describing a compliance check.
7462 Compliance(std::boxed::Box<crate::model::ComplianceNote>),
7463 /// A note describing a dsse attestation note.
7464 DsseAttestation(std::boxed::Box<crate::model::DSSEAttestationNote>),
7465 /// A note describing a vulnerability assessment.
7466 VulnerabilityAssessment(std::boxed::Box<crate::model::VulnerabilityAssessmentNote>),
7467 /// A note describing an SBOM reference.
7468 SbomReference(std::boxed::Box<crate::model::SBOMReferenceNote>),
7469 /// A note describing a secret.
7470 Secret(std::boxed::Box<crate::model::SecretNote>),
7471 }
7472}
7473
7474/// Request to get an occurrence.
7475#[derive(Clone, Default, PartialEq)]
7476#[non_exhaustive]
7477pub struct GetOccurrenceRequest {
7478 /// The name of the occurrence in the form of
7479 /// `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
7480 pub name: std::string::String,
7481
7482 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7483}
7484
7485impl GetOccurrenceRequest {
7486 pub fn new() -> Self {
7487 std::default::Default::default()
7488 }
7489
7490 /// Sets the value of [name][crate::model::GetOccurrenceRequest::name].
7491 ///
7492 /// # Example
7493 /// ```ignore,no_run
7494 /// # use google_cloud_grafeas_v1::model::GetOccurrenceRequest;
7495 /// let x = GetOccurrenceRequest::new().set_name("example");
7496 /// ```
7497 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7498 self.name = v.into();
7499 self
7500 }
7501}
7502
7503impl wkt::message::Message for GetOccurrenceRequest {
7504 fn typename() -> &'static str {
7505 "type.googleapis.com/grafeas.v1.GetOccurrenceRequest"
7506 }
7507}
7508
7509/// Request to list occurrences.
7510#[derive(Clone, Default, PartialEq)]
7511#[non_exhaustive]
7512pub struct ListOccurrencesRequest {
7513 /// The name of the project to list occurrences for in the form of
7514 /// `projects/[PROJECT_ID]`.
7515 pub parent: std::string::String,
7516
7517 /// The filter expression.
7518 pub filter: std::string::String,
7519
7520 /// Number of occurrences to return in the list. Must be positive. Max allowed
7521 /// page size is 1000. If not specified, page size defaults to 20.
7522 pub page_size: i32,
7523
7524 /// Token to provide to skip to a particular spot in the list.
7525 pub page_token: std::string::String,
7526
7527 /// If set, the request will return all reachable Occurrences
7528 /// and report all unreachable regions in the `unreachable` field in
7529 /// the response.
7530 ///
7531 /// Only applicable for requests in the global region.
7532 pub return_partial_success: bool,
7533
7534 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7535}
7536
7537impl ListOccurrencesRequest {
7538 pub fn new() -> Self {
7539 std::default::Default::default()
7540 }
7541
7542 /// Sets the value of [parent][crate::model::ListOccurrencesRequest::parent].
7543 ///
7544 /// # Example
7545 /// ```ignore,no_run
7546 /// # use google_cloud_grafeas_v1::model::ListOccurrencesRequest;
7547 /// let x = ListOccurrencesRequest::new().set_parent("example");
7548 /// ```
7549 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7550 self.parent = v.into();
7551 self
7552 }
7553
7554 /// Sets the value of [filter][crate::model::ListOccurrencesRequest::filter].
7555 ///
7556 /// # Example
7557 /// ```ignore,no_run
7558 /// # use google_cloud_grafeas_v1::model::ListOccurrencesRequest;
7559 /// let x = ListOccurrencesRequest::new().set_filter("example");
7560 /// ```
7561 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7562 self.filter = v.into();
7563 self
7564 }
7565
7566 /// Sets the value of [page_size][crate::model::ListOccurrencesRequest::page_size].
7567 ///
7568 /// # Example
7569 /// ```ignore,no_run
7570 /// # use google_cloud_grafeas_v1::model::ListOccurrencesRequest;
7571 /// let x = ListOccurrencesRequest::new().set_page_size(42);
7572 /// ```
7573 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7574 self.page_size = v.into();
7575 self
7576 }
7577
7578 /// Sets the value of [page_token][crate::model::ListOccurrencesRequest::page_token].
7579 ///
7580 /// # Example
7581 /// ```ignore,no_run
7582 /// # use google_cloud_grafeas_v1::model::ListOccurrencesRequest;
7583 /// let x = ListOccurrencesRequest::new().set_page_token("example");
7584 /// ```
7585 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7586 self.page_token = v.into();
7587 self
7588 }
7589
7590 /// Sets the value of [return_partial_success][crate::model::ListOccurrencesRequest::return_partial_success].
7591 ///
7592 /// # Example
7593 /// ```ignore,no_run
7594 /// # use google_cloud_grafeas_v1::model::ListOccurrencesRequest;
7595 /// let x = ListOccurrencesRequest::new().set_return_partial_success(true);
7596 /// ```
7597 pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7598 self.return_partial_success = v.into();
7599 self
7600 }
7601}
7602
7603impl wkt::message::Message for ListOccurrencesRequest {
7604 fn typename() -> &'static str {
7605 "type.googleapis.com/grafeas.v1.ListOccurrencesRequest"
7606 }
7607}
7608
7609/// Response for listing occurrences.
7610#[derive(Clone, Default, PartialEq)]
7611#[non_exhaustive]
7612pub struct ListOccurrencesResponse {
7613 /// The occurrences requested.
7614 pub occurrences: std::vec::Vec<crate::model::Occurrence>,
7615
7616 /// The next pagination token in the list response. It should be used as
7617 /// `page_token` for the following request. An empty value means no more
7618 /// results.
7619 pub next_page_token: std::string::String,
7620
7621 /// Unreachable regions. Populated for requests from the global region
7622 /// when `return_partial_success` is set.
7623 ///
7624 /// Format: `projects/[PROJECT_ID]/locations/[LOCATION]`
7625 pub unreachable: std::vec::Vec<std::string::String>,
7626
7627 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7628}
7629
7630impl ListOccurrencesResponse {
7631 pub fn new() -> Self {
7632 std::default::Default::default()
7633 }
7634
7635 /// Sets the value of [occurrences][crate::model::ListOccurrencesResponse::occurrences].
7636 ///
7637 /// # Example
7638 /// ```ignore,no_run
7639 /// # use google_cloud_grafeas_v1::model::ListOccurrencesResponse;
7640 /// use google_cloud_grafeas_v1::model::Occurrence;
7641 /// let x = ListOccurrencesResponse::new()
7642 /// .set_occurrences([
7643 /// Occurrence::default()/* use setters */,
7644 /// Occurrence::default()/* use (different) setters */,
7645 /// ]);
7646 /// ```
7647 pub fn set_occurrences<T, V>(mut self, v: T) -> Self
7648 where
7649 T: std::iter::IntoIterator<Item = V>,
7650 V: std::convert::Into<crate::model::Occurrence>,
7651 {
7652 use std::iter::Iterator;
7653 self.occurrences = v.into_iter().map(|i| i.into()).collect();
7654 self
7655 }
7656
7657 /// Sets the value of [next_page_token][crate::model::ListOccurrencesResponse::next_page_token].
7658 ///
7659 /// # Example
7660 /// ```ignore,no_run
7661 /// # use google_cloud_grafeas_v1::model::ListOccurrencesResponse;
7662 /// let x = ListOccurrencesResponse::new().set_next_page_token("example");
7663 /// ```
7664 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7665 self.next_page_token = v.into();
7666 self
7667 }
7668
7669 /// Sets the value of [unreachable][crate::model::ListOccurrencesResponse::unreachable].
7670 ///
7671 /// # Example
7672 /// ```ignore,no_run
7673 /// # use google_cloud_grafeas_v1::model::ListOccurrencesResponse;
7674 /// let x = ListOccurrencesResponse::new().set_unreachable(["a", "b", "c"]);
7675 /// ```
7676 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
7677 where
7678 T: std::iter::IntoIterator<Item = V>,
7679 V: std::convert::Into<std::string::String>,
7680 {
7681 use std::iter::Iterator;
7682 self.unreachable = v.into_iter().map(|i| i.into()).collect();
7683 self
7684 }
7685}
7686
7687impl wkt::message::Message for ListOccurrencesResponse {
7688 fn typename() -> &'static str {
7689 "type.googleapis.com/grafeas.v1.ListOccurrencesResponse"
7690 }
7691}
7692
7693#[doc(hidden)]
7694impl google_cloud_gax::paginator::internal::PageableResponse for ListOccurrencesResponse {
7695 type PageItem = crate::model::Occurrence;
7696
7697 fn items(self) -> std::vec::Vec<Self::PageItem> {
7698 self.occurrences
7699 }
7700
7701 fn next_page_token(&self) -> std::string::String {
7702 use std::clone::Clone;
7703 self.next_page_token.clone()
7704 }
7705}
7706
7707/// Request to delete an occurrence.
7708#[derive(Clone, Default, PartialEq)]
7709#[non_exhaustive]
7710pub struct DeleteOccurrenceRequest {
7711 /// The name of the occurrence in the form of
7712 /// `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
7713 pub name: std::string::String,
7714
7715 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7716}
7717
7718impl DeleteOccurrenceRequest {
7719 pub fn new() -> Self {
7720 std::default::Default::default()
7721 }
7722
7723 /// Sets the value of [name][crate::model::DeleteOccurrenceRequest::name].
7724 ///
7725 /// # Example
7726 /// ```ignore,no_run
7727 /// # use google_cloud_grafeas_v1::model::DeleteOccurrenceRequest;
7728 /// let x = DeleteOccurrenceRequest::new().set_name("example");
7729 /// ```
7730 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7731 self.name = v.into();
7732 self
7733 }
7734}
7735
7736impl wkt::message::Message for DeleteOccurrenceRequest {
7737 fn typename() -> &'static str {
7738 "type.googleapis.com/grafeas.v1.DeleteOccurrenceRequest"
7739 }
7740}
7741
7742/// Request to create a new occurrence.
7743#[derive(Clone, Default, PartialEq)]
7744#[non_exhaustive]
7745pub struct CreateOccurrenceRequest {
7746 /// The name of the project in the form of `projects/[PROJECT_ID]`, under which
7747 /// the occurrence is to be created.
7748 pub parent: std::string::String,
7749
7750 /// The occurrence to create.
7751 pub occurrence: std::option::Option<crate::model::Occurrence>,
7752
7753 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7754}
7755
7756impl CreateOccurrenceRequest {
7757 pub fn new() -> Self {
7758 std::default::Default::default()
7759 }
7760
7761 /// Sets the value of [parent][crate::model::CreateOccurrenceRequest::parent].
7762 ///
7763 /// # Example
7764 /// ```ignore,no_run
7765 /// # use google_cloud_grafeas_v1::model::CreateOccurrenceRequest;
7766 /// let x = CreateOccurrenceRequest::new().set_parent("example");
7767 /// ```
7768 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7769 self.parent = v.into();
7770 self
7771 }
7772
7773 /// Sets the value of [occurrence][crate::model::CreateOccurrenceRequest::occurrence].
7774 ///
7775 /// # Example
7776 /// ```ignore,no_run
7777 /// # use google_cloud_grafeas_v1::model::CreateOccurrenceRequest;
7778 /// use google_cloud_grafeas_v1::model::Occurrence;
7779 /// let x = CreateOccurrenceRequest::new().set_occurrence(Occurrence::default()/* use setters */);
7780 /// ```
7781 pub fn set_occurrence<T>(mut self, v: T) -> Self
7782 where
7783 T: std::convert::Into<crate::model::Occurrence>,
7784 {
7785 self.occurrence = std::option::Option::Some(v.into());
7786 self
7787 }
7788
7789 /// Sets or clears the value of [occurrence][crate::model::CreateOccurrenceRequest::occurrence].
7790 ///
7791 /// # Example
7792 /// ```ignore,no_run
7793 /// # use google_cloud_grafeas_v1::model::CreateOccurrenceRequest;
7794 /// use google_cloud_grafeas_v1::model::Occurrence;
7795 /// let x = CreateOccurrenceRequest::new().set_or_clear_occurrence(Some(Occurrence::default()/* use setters */));
7796 /// let x = CreateOccurrenceRequest::new().set_or_clear_occurrence(None::<Occurrence>);
7797 /// ```
7798 pub fn set_or_clear_occurrence<T>(mut self, v: std::option::Option<T>) -> Self
7799 where
7800 T: std::convert::Into<crate::model::Occurrence>,
7801 {
7802 self.occurrence = v.map(|x| x.into());
7803 self
7804 }
7805}
7806
7807impl wkt::message::Message for CreateOccurrenceRequest {
7808 fn typename() -> &'static str {
7809 "type.googleapis.com/grafeas.v1.CreateOccurrenceRequest"
7810 }
7811}
7812
7813/// Request to update an occurrence.
7814#[derive(Clone, Default, PartialEq)]
7815#[non_exhaustive]
7816pub struct UpdateOccurrenceRequest {
7817 /// The name of the occurrence in the form of
7818 /// `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
7819 pub name: std::string::String,
7820
7821 /// The updated occurrence.
7822 pub occurrence: std::option::Option<crate::model::Occurrence>,
7823
7824 /// The fields to update.
7825 pub update_mask: std::option::Option<wkt::FieldMask>,
7826
7827 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7828}
7829
7830impl UpdateOccurrenceRequest {
7831 pub fn new() -> Self {
7832 std::default::Default::default()
7833 }
7834
7835 /// Sets the value of [name][crate::model::UpdateOccurrenceRequest::name].
7836 ///
7837 /// # Example
7838 /// ```ignore,no_run
7839 /// # use google_cloud_grafeas_v1::model::UpdateOccurrenceRequest;
7840 /// let x = UpdateOccurrenceRequest::new().set_name("example");
7841 /// ```
7842 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7843 self.name = v.into();
7844 self
7845 }
7846
7847 /// Sets the value of [occurrence][crate::model::UpdateOccurrenceRequest::occurrence].
7848 ///
7849 /// # Example
7850 /// ```ignore,no_run
7851 /// # use google_cloud_grafeas_v1::model::UpdateOccurrenceRequest;
7852 /// use google_cloud_grafeas_v1::model::Occurrence;
7853 /// let x = UpdateOccurrenceRequest::new().set_occurrence(Occurrence::default()/* use setters */);
7854 /// ```
7855 pub fn set_occurrence<T>(mut self, v: T) -> Self
7856 where
7857 T: std::convert::Into<crate::model::Occurrence>,
7858 {
7859 self.occurrence = std::option::Option::Some(v.into());
7860 self
7861 }
7862
7863 /// Sets or clears the value of [occurrence][crate::model::UpdateOccurrenceRequest::occurrence].
7864 ///
7865 /// # Example
7866 /// ```ignore,no_run
7867 /// # use google_cloud_grafeas_v1::model::UpdateOccurrenceRequest;
7868 /// use google_cloud_grafeas_v1::model::Occurrence;
7869 /// let x = UpdateOccurrenceRequest::new().set_or_clear_occurrence(Some(Occurrence::default()/* use setters */));
7870 /// let x = UpdateOccurrenceRequest::new().set_or_clear_occurrence(None::<Occurrence>);
7871 /// ```
7872 pub fn set_or_clear_occurrence<T>(mut self, v: std::option::Option<T>) -> Self
7873 where
7874 T: std::convert::Into<crate::model::Occurrence>,
7875 {
7876 self.occurrence = v.map(|x| x.into());
7877 self
7878 }
7879
7880 /// Sets the value of [update_mask][crate::model::UpdateOccurrenceRequest::update_mask].
7881 ///
7882 /// # Example
7883 /// ```ignore,no_run
7884 /// # use google_cloud_grafeas_v1::model::UpdateOccurrenceRequest;
7885 /// use wkt::FieldMask;
7886 /// let x = UpdateOccurrenceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
7887 /// ```
7888 pub fn set_update_mask<T>(mut self, v: T) -> Self
7889 where
7890 T: std::convert::Into<wkt::FieldMask>,
7891 {
7892 self.update_mask = std::option::Option::Some(v.into());
7893 self
7894 }
7895
7896 /// Sets or clears the value of [update_mask][crate::model::UpdateOccurrenceRequest::update_mask].
7897 ///
7898 /// # Example
7899 /// ```ignore,no_run
7900 /// # use google_cloud_grafeas_v1::model::UpdateOccurrenceRequest;
7901 /// use wkt::FieldMask;
7902 /// let x = UpdateOccurrenceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
7903 /// let x = UpdateOccurrenceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
7904 /// ```
7905 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7906 where
7907 T: std::convert::Into<wkt::FieldMask>,
7908 {
7909 self.update_mask = v.map(|x| x.into());
7910 self
7911 }
7912}
7913
7914impl wkt::message::Message for UpdateOccurrenceRequest {
7915 fn typename() -> &'static str {
7916 "type.googleapis.com/grafeas.v1.UpdateOccurrenceRequest"
7917 }
7918}
7919
7920/// Request to get a note.
7921#[derive(Clone, Default, PartialEq)]
7922#[non_exhaustive]
7923pub struct GetNoteRequest {
7924 /// The name of the note in the form of
7925 /// `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
7926 pub name: std::string::String,
7927
7928 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7929}
7930
7931impl GetNoteRequest {
7932 pub fn new() -> Self {
7933 std::default::Default::default()
7934 }
7935
7936 /// Sets the value of [name][crate::model::GetNoteRequest::name].
7937 ///
7938 /// # Example
7939 /// ```ignore,no_run
7940 /// # use google_cloud_grafeas_v1::model::GetNoteRequest;
7941 /// let x = GetNoteRequest::new().set_name("example");
7942 /// ```
7943 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7944 self.name = v.into();
7945 self
7946 }
7947}
7948
7949impl wkt::message::Message for GetNoteRequest {
7950 fn typename() -> &'static str {
7951 "type.googleapis.com/grafeas.v1.GetNoteRequest"
7952 }
7953}
7954
7955/// Request to get the note to which the specified occurrence is attached.
7956#[derive(Clone, Default, PartialEq)]
7957#[non_exhaustive]
7958pub struct GetOccurrenceNoteRequest {
7959 /// The name of the occurrence in the form of
7960 /// `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
7961 pub name: std::string::String,
7962
7963 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7964}
7965
7966impl GetOccurrenceNoteRequest {
7967 pub fn new() -> Self {
7968 std::default::Default::default()
7969 }
7970
7971 /// Sets the value of [name][crate::model::GetOccurrenceNoteRequest::name].
7972 ///
7973 /// # Example
7974 /// ```ignore,no_run
7975 /// # use google_cloud_grafeas_v1::model::GetOccurrenceNoteRequest;
7976 /// let x = GetOccurrenceNoteRequest::new().set_name("example");
7977 /// ```
7978 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7979 self.name = v.into();
7980 self
7981 }
7982}
7983
7984impl wkt::message::Message for GetOccurrenceNoteRequest {
7985 fn typename() -> &'static str {
7986 "type.googleapis.com/grafeas.v1.GetOccurrenceNoteRequest"
7987 }
7988}
7989
7990/// Request to list notes.
7991#[derive(Clone, Default, PartialEq)]
7992#[non_exhaustive]
7993pub struct ListNotesRequest {
7994 /// The name of the project to list notes for in the form of
7995 /// `projects/[PROJECT_ID]`.
7996 pub parent: std::string::String,
7997
7998 /// The filter expression.
7999 pub filter: std::string::String,
8000
8001 /// Number of notes to return in the list. Must be positive. Max allowed page
8002 /// size is 1000. If not specified, page size defaults to 20.
8003 pub page_size: i32,
8004
8005 /// Token to provide to skip to a particular spot in the list.
8006 pub page_token: std::string::String,
8007
8008 /// If set, the request will return all reachable Notes
8009 /// and report all unreachable regions in the `unreachable` field in
8010 /// the response.
8011 ///
8012 /// Only applicable for requests in the global region.
8013 pub return_partial_success: bool,
8014
8015 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8016}
8017
8018impl ListNotesRequest {
8019 pub fn new() -> Self {
8020 std::default::Default::default()
8021 }
8022
8023 /// Sets the value of [parent][crate::model::ListNotesRequest::parent].
8024 ///
8025 /// # Example
8026 /// ```ignore,no_run
8027 /// # use google_cloud_grafeas_v1::model::ListNotesRequest;
8028 /// let x = ListNotesRequest::new().set_parent("example");
8029 /// ```
8030 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8031 self.parent = v.into();
8032 self
8033 }
8034
8035 /// Sets the value of [filter][crate::model::ListNotesRequest::filter].
8036 ///
8037 /// # Example
8038 /// ```ignore,no_run
8039 /// # use google_cloud_grafeas_v1::model::ListNotesRequest;
8040 /// let x = ListNotesRequest::new().set_filter("example");
8041 /// ```
8042 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8043 self.filter = v.into();
8044 self
8045 }
8046
8047 /// Sets the value of [page_size][crate::model::ListNotesRequest::page_size].
8048 ///
8049 /// # Example
8050 /// ```ignore,no_run
8051 /// # use google_cloud_grafeas_v1::model::ListNotesRequest;
8052 /// let x = ListNotesRequest::new().set_page_size(42);
8053 /// ```
8054 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8055 self.page_size = v.into();
8056 self
8057 }
8058
8059 /// Sets the value of [page_token][crate::model::ListNotesRequest::page_token].
8060 ///
8061 /// # Example
8062 /// ```ignore,no_run
8063 /// # use google_cloud_grafeas_v1::model::ListNotesRequest;
8064 /// let x = ListNotesRequest::new().set_page_token("example");
8065 /// ```
8066 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8067 self.page_token = v.into();
8068 self
8069 }
8070
8071 /// Sets the value of [return_partial_success][crate::model::ListNotesRequest::return_partial_success].
8072 ///
8073 /// # Example
8074 /// ```ignore,no_run
8075 /// # use google_cloud_grafeas_v1::model::ListNotesRequest;
8076 /// let x = ListNotesRequest::new().set_return_partial_success(true);
8077 /// ```
8078 pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8079 self.return_partial_success = v.into();
8080 self
8081 }
8082}
8083
8084impl wkt::message::Message for ListNotesRequest {
8085 fn typename() -> &'static str {
8086 "type.googleapis.com/grafeas.v1.ListNotesRequest"
8087 }
8088}
8089
8090/// Response for listing notes.
8091#[derive(Clone, Default, PartialEq)]
8092#[non_exhaustive]
8093pub struct ListNotesResponse {
8094 /// The notes requested.
8095 pub notes: std::vec::Vec<crate::model::Note>,
8096
8097 /// The next pagination token in the list response. It should be used as
8098 /// `page_token` for the following request. An empty value means no more
8099 /// results.
8100 pub next_page_token: std::string::String,
8101
8102 /// Unreachable regions. Populated for requests from the global region
8103 /// when `return_partial_success` is set.
8104 ///
8105 /// Format: `projects/[PROJECT_ID]/locations/[LOCATION]`
8106 pub unreachable: std::vec::Vec<std::string::String>,
8107
8108 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8109}
8110
8111impl ListNotesResponse {
8112 pub fn new() -> Self {
8113 std::default::Default::default()
8114 }
8115
8116 /// Sets the value of [notes][crate::model::ListNotesResponse::notes].
8117 ///
8118 /// # Example
8119 /// ```ignore,no_run
8120 /// # use google_cloud_grafeas_v1::model::ListNotesResponse;
8121 /// use google_cloud_grafeas_v1::model::Note;
8122 /// let x = ListNotesResponse::new()
8123 /// .set_notes([
8124 /// Note::default()/* use setters */,
8125 /// Note::default()/* use (different) setters */,
8126 /// ]);
8127 /// ```
8128 pub fn set_notes<T, V>(mut self, v: T) -> Self
8129 where
8130 T: std::iter::IntoIterator<Item = V>,
8131 V: std::convert::Into<crate::model::Note>,
8132 {
8133 use std::iter::Iterator;
8134 self.notes = v.into_iter().map(|i| i.into()).collect();
8135 self
8136 }
8137
8138 /// Sets the value of [next_page_token][crate::model::ListNotesResponse::next_page_token].
8139 ///
8140 /// # Example
8141 /// ```ignore,no_run
8142 /// # use google_cloud_grafeas_v1::model::ListNotesResponse;
8143 /// let x = ListNotesResponse::new().set_next_page_token("example");
8144 /// ```
8145 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8146 self.next_page_token = v.into();
8147 self
8148 }
8149
8150 /// Sets the value of [unreachable][crate::model::ListNotesResponse::unreachable].
8151 ///
8152 /// # Example
8153 /// ```ignore,no_run
8154 /// # use google_cloud_grafeas_v1::model::ListNotesResponse;
8155 /// let x = ListNotesResponse::new().set_unreachable(["a", "b", "c"]);
8156 /// ```
8157 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
8158 where
8159 T: std::iter::IntoIterator<Item = V>,
8160 V: std::convert::Into<std::string::String>,
8161 {
8162 use std::iter::Iterator;
8163 self.unreachable = v.into_iter().map(|i| i.into()).collect();
8164 self
8165 }
8166}
8167
8168impl wkt::message::Message for ListNotesResponse {
8169 fn typename() -> &'static str {
8170 "type.googleapis.com/grafeas.v1.ListNotesResponse"
8171 }
8172}
8173
8174#[doc(hidden)]
8175impl google_cloud_gax::paginator::internal::PageableResponse for ListNotesResponse {
8176 type PageItem = crate::model::Note;
8177
8178 fn items(self) -> std::vec::Vec<Self::PageItem> {
8179 self.notes
8180 }
8181
8182 fn next_page_token(&self) -> std::string::String {
8183 use std::clone::Clone;
8184 self.next_page_token.clone()
8185 }
8186}
8187
8188/// Request to delete a note.
8189#[derive(Clone, Default, PartialEq)]
8190#[non_exhaustive]
8191pub struct DeleteNoteRequest {
8192 /// The name of the note in the form of
8193 /// `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
8194 pub name: std::string::String,
8195
8196 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8197}
8198
8199impl DeleteNoteRequest {
8200 pub fn new() -> Self {
8201 std::default::Default::default()
8202 }
8203
8204 /// Sets the value of [name][crate::model::DeleteNoteRequest::name].
8205 ///
8206 /// # Example
8207 /// ```ignore,no_run
8208 /// # use google_cloud_grafeas_v1::model::DeleteNoteRequest;
8209 /// let x = DeleteNoteRequest::new().set_name("example");
8210 /// ```
8211 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8212 self.name = v.into();
8213 self
8214 }
8215}
8216
8217impl wkt::message::Message for DeleteNoteRequest {
8218 fn typename() -> &'static str {
8219 "type.googleapis.com/grafeas.v1.DeleteNoteRequest"
8220 }
8221}
8222
8223/// Request to create a new note.
8224#[derive(Clone, Default, PartialEq)]
8225#[non_exhaustive]
8226pub struct CreateNoteRequest {
8227 /// The name of the project in the form of `projects/[PROJECT_ID]`, under which
8228 /// the note is to be created.
8229 pub parent: std::string::String,
8230
8231 /// The ID to use for this note.
8232 pub note_id: std::string::String,
8233
8234 /// The note to create.
8235 pub note: std::option::Option<crate::model::Note>,
8236
8237 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8238}
8239
8240impl CreateNoteRequest {
8241 pub fn new() -> Self {
8242 std::default::Default::default()
8243 }
8244
8245 /// Sets the value of [parent][crate::model::CreateNoteRequest::parent].
8246 ///
8247 /// # Example
8248 /// ```ignore,no_run
8249 /// # use google_cloud_grafeas_v1::model::CreateNoteRequest;
8250 /// let x = CreateNoteRequest::new().set_parent("example");
8251 /// ```
8252 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8253 self.parent = v.into();
8254 self
8255 }
8256
8257 /// Sets the value of [note_id][crate::model::CreateNoteRequest::note_id].
8258 ///
8259 /// # Example
8260 /// ```ignore,no_run
8261 /// # use google_cloud_grafeas_v1::model::CreateNoteRequest;
8262 /// let x = CreateNoteRequest::new().set_note_id("example");
8263 /// ```
8264 pub fn set_note_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8265 self.note_id = v.into();
8266 self
8267 }
8268
8269 /// Sets the value of [note][crate::model::CreateNoteRequest::note].
8270 ///
8271 /// # Example
8272 /// ```ignore,no_run
8273 /// # use google_cloud_grafeas_v1::model::CreateNoteRequest;
8274 /// use google_cloud_grafeas_v1::model::Note;
8275 /// let x = CreateNoteRequest::new().set_note(Note::default()/* use setters */);
8276 /// ```
8277 pub fn set_note<T>(mut self, v: T) -> Self
8278 where
8279 T: std::convert::Into<crate::model::Note>,
8280 {
8281 self.note = std::option::Option::Some(v.into());
8282 self
8283 }
8284
8285 /// Sets or clears the value of [note][crate::model::CreateNoteRequest::note].
8286 ///
8287 /// # Example
8288 /// ```ignore,no_run
8289 /// # use google_cloud_grafeas_v1::model::CreateNoteRequest;
8290 /// use google_cloud_grafeas_v1::model::Note;
8291 /// let x = CreateNoteRequest::new().set_or_clear_note(Some(Note::default()/* use setters */));
8292 /// let x = CreateNoteRequest::new().set_or_clear_note(None::<Note>);
8293 /// ```
8294 pub fn set_or_clear_note<T>(mut self, v: std::option::Option<T>) -> Self
8295 where
8296 T: std::convert::Into<crate::model::Note>,
8297 {
8298 self.note = v.map(|x| x.into());
8299 self
8300 }
8301}
8302
8303impl wkt::message::Message for CreateNoteRequest {
8304 fn typename() -> &'static str {
8305 "type.googleapis.com/grafeas.v1.CreateNoteRequest"
8306 }
8307}
8308
8309/// Request to update a note.
8310#[derive(Clone, Default, PartialEq)]
8311#[non_exhaustive]
8312pub struct UpdateNoteRequest {
8313 /// The name of the note in the form of
8314 /// `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
8315 pub name: std::string::String,
8316
8317 /// The updated note.
8318 pub note: std::option::Option<crate::model::Note>,
8319
8320 /// The fields to update.
8321 pub update_mask: std::option::Option<wkt::FieldMask>,
8322
8323 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8324}
8325
8326impl UpdateNoteRequest {
8327 pub fn new() -> Self {
8328 std::default::Default::default()
8329 }
8330
8331 /// Sets the value of [name][crate::model::UpdateNoteRequest::name].
8332 ///
8333 /// # Example
8334 /// ```ignore,no_run
8335 /// # use google_cloud_grafeas_v1::model::UpdateNoteRequest;
8336 /// let x = UpdateNoteRequest::new().set_name("example");
8337 /// ```
8338 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8339 self.name = v.into();
8340 self
8341 }
8342
8343 /// Sets the value of [note][crate::model::UpdateNoteRequest::note].
8344 ///
8345 /// # Example
8346 /// ```ignore,no_run
8347 /// # use google_cloud_grafeas_v1::model::UpdateNoteRequest;
8348 /// use google_cloud_grafeas_v1::model::Note;
8349 /// let x = UpdateNoteRequest::new().set_note(Note::default()/* use setters */);
8350 /// ```
8351 pub fn set_note<T>(mut self, v: T) -> Self
8352 where
8353 T: std::convert::Into<crate::model::Note>,
8354 {
8355 self.note = std::option::Option::Some(v.into());
8356 self
8357 }
8358
8359 /// Sets or clears the value of [note][crate::model::UpdateNoteRequest::note].
8360 ///
8361 /// # Example
8362 /// ```ignore,no_run
8363 /// # use google_cloud_grafeas_v1::model::UpdateNoteRequest;
8364 /// use google_cloud_grafeas_v1::model::Note;
8365 /// let x = UpdateNoteRequest::new().set_or_clear_note(Some(Note::default()/* use setters */));
8366 /// let x = UpdateNoteRequest::new().set_or_clear_note(None::<Note>);
8367 /// ```
8368 pub fn set_or_clear_note<T>(mut self, v: std::option::Option<T>) -> Self
8369 where
8370 T: std::convert::Into<crate::model::Note>,
8371 {
8372 self.note = v.map(|x| x.into());
8373 self
8374 }
8375
8376 /// Sets the value of [update_mask][crate::model::UpdateNoteRequest::update_mask].
8377 ///
8378 /// # Example
8379 /// ```ignore,no_run
8380 /// # use google_cloud_grafeas_v1::model::UpdateNoteRequest;
8381 /// use wkt::FieldMask;
8382 /// let x = UpdateNoteRequest::new().set_update_mask(FieldMask::default()/* use setters */);
8383 /// ```
8384 pub fn set_update_mask<T>(mut self, v: T) -> Self
8385 where
8386 T: std::convert::Into<wkt::FieldMask>,
8387 {
8388 self.update_mask = std::option::Option::Some(v.into());
8389 self
8390 }
8391
8392 /// Sets or clears the value of [update_mask][crate::model::UpdateNoteRequest::update_mask].
8393 ///
8394 /// # Example
8395 /// ```ignore,no_run
8396 /// # use google_cloud_grafeas_v1::model::UpdateNoteRequest;
8397 /// use wkt::FieldMask;
8398 /// let x = UpdateNoteRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
8399 /// let x = UpdateNoteRequest::new().set_or_clear_update_mask(None::<FieldMask>);
8400 /// ```
8401 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
8402 where
8403 T: std::convert::Into<wkt::FieldMask>,
8404 {
8405 self.update_mask = v.map(|x| x.into());
8406 self
8407 }
8408}
8409
8410impl wkt::message::Message for UpdateNoteRequest {
8411 fn typename() -> &'static str {
8412 "type.googleapis.com/grafeas.v1.UpdateNoteRequest"
8413 }
8414}
8415
8416/// Request to list occurrences for a note.
8417#[derive(Clone, Default, PartialEq)]
8418#[non_exhaustive]
8419pub struct ListNoteOccurrencesRequest {
8420 /// The name of the note to list occurrences for in the form of
8421 /// `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
8422 pub name: std::string::String,
8423
8424 /// The filter expression.
8425 pub filter: std::string::String,
8426
8427 /// Number of occurrences to return in the list.
8428 pub page_size: i32,
8429
8430 /// Token to provide to skip to a particular spot in the list.
8431 pub page_token: std::string::String,
8432
8433 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8434}
8435
8436impl ListNoteOccurrencesRequest {
8437 pub fn new() -> Self {
8438 std::default::Default::default()
8439 }
8440
8441 /// Sets the value of [name][crate::model::ListNoteOccurrencesRequest::name].
8442 ///
8443 /// # Example
8444 /// ```ignore,no_run
8445 /// # use google_cloud_grafeas_v1::model::ListNoteOccurrencesRequest;
8446 /// let x = ListNoteOccurrencesRequest::new().set_name("example");
8447 /// ```
8448 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8449 self.name = v.into();
8450 self
8451 }
8452
8453 /// Sets the value of [filter][crate::model::ListNoteOccurrencesRequest::filter].
8454 ///
8455 /// # Example
8456 /// ```ignore,no_run
8457 /// # use google_cloud_grafeas_v1::model::ListNoteOccurrencesRequest;
8458 /// let x = ListNoteOccurrencesRequest::new().set_filter("example");
8459 /// ```
8460 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8461 self.filter = v.into();
8462 self
8463 }
8464
8465 /// Sets the value of [page_size][crate::model::ListNoteOccurrencesRequest::page_size].
8466 ///
8467 /// # Example
8468 /// ```ignore,no_run
8469 /// # use google_cloud_grafeas_v1::model::ListNoteOccurrencesRequest;
8470 /// let x = ListNoteOccurrencesRequest::new().set_page_size(42);
8471 /// ```
8472 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8473 self.page_size = v.into();
8474 self
8475 }
8476
8477 /// Sets the value of [page_token][crate::model::ListNoteOccurrencesRequest::page_token].
8478 ///
8479 /// # Example
8480 /// ```ignore,no_run
8481 /// # use google_cloud_grafeas_v1::model::ListNoteOccurrencesRequest;
8482 /// let x = ListNoteOccurrencesRequest::new().set_page_token("example");
8483 /// ```
8484 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8485 self.page_token = v.into();
8486 self
8487 }
8488}
8489
8490impl wkt::message::Message for ListNoteOccurrencesRequest {
8491 fn typename() -> &'static str {
8492 "type.googleapis.com/grafeas.v1.ListNoteOccurrencesRequest"
8493 }
8494}
8495
8496/// Response for listing occurrences for a note.
8497#[derive(Clone, Default, PartialEq)]
8498#[non_exhaustive]
8499pub struct ListNoteOccurrencesResponse {
8500 /// The occurrences attached to the specified note.
8501 pub occurrences: std::vec::Vec<crate::model::Occurrence>,
8502
8503 /// Token to provide to skip to a particular spot in the list.
8504 pub next_page_token: std::string::String,
8505
8506 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8507}
8508
8509impl ListNoteOccurrencesResponse {
8510 pub fn new() -> Self {
8511 std::default::Default::default()
8512 }
8513
8514 /// Sets the value of [occurrences][crate::model::ListNoteOccurrencesResponse::occurrences].
8515 ///
8516 /// # Example
8517 /// ```ignore,no_run
8518 /// # use google_cloud_grafeas_v1::model::ListNoteOccurrencesResponse;
8519 /// use google_cloud_grafeas_v1::model::Occurrence;
8520 /// let x = ListNoteOccurrencesResponse::new()
8521 /// .set_occurrences([
8522 /// Occurrence::default()/* use setters */,
8523 /// Occurrence::default()/* use (different) setters */,
8524 /// ]);
8525 /// ```
8526 pub fn set_occurrences<T, V>(mut self, v: T) -> Self
8527 where
8528 T: std::iter::IntoIterator<Item = V>,
8529 V: std::convert::Into<crate::model::Occurrence>,
8530 {
8531 use std::iter::Iterator;
8532 self.occurrences = v.into_iter().map(|i| i.into()).collect();
8533 self
8534 }
8535
8536 /// Sets the value of [next_page_token][crate::model::ListNoteOccurrencesResponse::next_page_token].
8537 ///
8538 /// # Example
8539 /// ```ignore,no_run
8540 /// # use google_cloud_grafeas_v1::model::ListNoteOccurrencesResponse;
8541 /// let x = ListNoteOccurrencesResponse::new().set_next_page_token("example");
8542 /// ```
8543 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8544 self.next_page_token = v.into();
8545 self
8546 }
8547}
8548
8549impl wkt::message::Message for ListNoteOccurrencesResponse {
8550 fn typename() -> &'static str {
8551 "type.googleapis.com/grafeas.v1.ListNoteOccurrencesResponse"
8552 }
8553}
8554
8555#[doc(hidden)]
8556impl google_cloud_gax::paginator::internal::PageableResponse for ListNoteOccurrencesResponse {
8557 type PageItem = crate::model::Occurrence;
8558
8559 fn items(self) -> std::vec::Vec<Self::PageItem> {
8560 self.occurrences
8561 }
8562
8563 fn next_page_token(&self) -> std::string::String {
8564 use std::clone::Clone;
8565 self.next_page_token.clone()
8566 }
8567}
8568
8569/// Request to create notes in batch.
8570#[derive(Clone, Default, PartialEq)]
8571#[non_exhaustive]
8572pub struct BatchCreateNotesRequest {
8573 /// The name of the project in the form of `projects/[PROJECT_ID]`, under which
8574 /// the notes are to be created.
8575 pub parent: std::string::String,
8576
8577 /// The notes to create. Max allowed length is 1000.
8578 pub notes: std::collections::HashMap<std::string::String, crate::model::Note>,
8579
8580 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8581}
8582
8583impl BatchCreateNotesRequest {
8584 pub fn new() -> Self {
8585 std::default::Default::default()
8586 }
8587
8588 /// Sets the value of [parent][crate::model::BatchCreateNotesRequest::parent].
8589 ///
8590 /// # Example
8591 /// ```ignore,no_run
8592 /// # use google_cloud_grafeas_v1::model::BatchCreateNotesRequest;
8593 /// let x = BatchCreateNotesRequest::new().set_parent("example");
8594 /// ```
8595 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8596 self.parent = v.into();
8597 self
8598 }
8599
8600 /// Sets the value of [notes][crate::model::BatchCreateNotesRequest::notes].
8601 ///
8602 /// # Example
8603 /// ```ignore,no_run
8604 /// # use google_cloud_grafeas_v1::model::BatchCreateNotesRequest;
8605 /// use google_cloud_grafeas_v1::model::Note;
8606 /// let x = BatchCreateNotesRequest::new().set_notes([
8607 /// ("key0", Note::default()/* use setters */),
8608 /// ("key1", Note::default()/* use (different) setters */),
8609 /// ]);
8610 /// ```
8611 pub fn set_notes<T, K, V>(mut self, v: T) -> Self
8612 where
8613 T: std::iter::IntoIterator<Item = (K, V)>,
8614 K: std::convert::Into<std::string::String>,
8615 V: std::convert::Into<crate::model::Note>,
8616 {
8617 use std::iter::Iterator;
8618 self.notes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8619 self
8620 }
8621}
8622
8623impl wkt::message::Message for BatchCreateNotesRequest {
8624 fn typename() -> &'static str {
8625 "type.googleapis.com/grafeas.v1.BatchCreateNotesRequest"
8626 }
8627}
8628
8629/// Response for creating notes in batch.
8630#[derive(Clone, Default, PartialEq)]
8631#[non_exhaustive]
8632pub struct BatchCreateNotesResponse {
8633 /// The notes that were created.
8634 pub notes: std::vec::Vec<crate::model::Note>,
8635
8636 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8637}
8638
8639impl BatchCreateNotesResponse {
8640 pub fn new() -> Self {
8641 std::default::Default::default()
8642 }
8643
8644 /// Sets the value of [notes][crate::model::BatchCreateNotesResponse::notes].
8645 ///
8646 /// # Example
8647 /// ```ignore,no_run
8648 /// # use google_cloud_grafeas_v1::model::BatchCreateNotesResponse;
8649 /// use google_cloud_grafeas_v1::model::Note;
8650 /// let x = BatchCreateNotesResponse::new()
8651 /// .set_notes([
8652 /// Note::default()/* use setters */,
8653 /// Note::default()/* use (different) setters */,
8654 /// ]);
8655 /// ```
8656 pub fn set_notes<T, V>(mut self, v: T) -> Self
8657 where
8658 T: std::iter::IntoIterator<Item = V>,
8659 V: std::convert::Into<crate::model::Note>,
8660 {
8661 use std::iter::Iterator;
8662 self.notes = v.into_iter().map(|i| i.into()).collect();
8663 self
8664 }
8665}
8666
8667impl wkt::message::Message for BatchCreateNotesResponse {
8668 fn typename() -> &'static str {
8669 "type.googleapis.com/grafeas.v1.BatchCreateNotesResponse"
8670 }
8671}
8672
8673/// Request to create occurrences in batch.
8674#[derive(Clone, Default, PartialEq)]
8675#[non_exhaustive]
8676pub struct BatchCreateOccurrencesRequest {
8677 /// The name of the project in the form of `projects/[PROJECT_ID]`, under which
8678 /// the occurrences are to be created.
8679 pub parent: std::string::String,
8680
8681 /// The occurrences to create. Max allowed length is 1000.
8682 pub occurrences: std::vec::Vec<crate::model::Occurrence>,
8683
8684 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8685}
8686
8687impl BatchCreateOccurrencesRequest {
8688 pub fn new() -> Self {
8689 std::default::Default::default()
8690 }
8691
8692 /// Sets the value of [parent][crate::model::BatchCreateOccurrencesRequest::parent].
8693 ///
8694 /// # Example
8695 /// ```ignore,no_run
8696 /// # use google_cloud_grafeas_v1::model::BatchCreateOccurrencesRequest;
8697 /// let x = BatchCreateOccurrencesRequest::new().set_parent("example");
8698 /// ```
8699 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8700 self.parent = v.into();
8701 self
8702 }
8703
8704 /// Sets the value of [occurrences][crate::model::BatchCreateOccurrencesRequest::occurrences].
8705 ///
8706 /// # Example
8707 /// ```ignore,no_run
8708 /// # use google_cloud_grafeas_v1::model::BatchCreateOccurrencesRequest;
8709 /// use google_cloud_grafeas_v1::model::Occurrence;
8710 /// let x = BatchCreateOccurrencesRequest::new()
8711 /// .set_occurrences([
8712 /// Occurrence::default()/* use setters */,
8713 /// Occurrence::default()/* use (different) setters */,
8714 /// ]);
8715 /// ```
8716 pub fn set_occurrences<T, V>(mut self, v: T) -> Self
8717 where
8718 T: std::iter::IntoIterator<Item = V>,
8719 V: std::convert::Into<crate::model::Occurrence>,
8720 {
8721 use std::iter::Iterator;
8722 self.occurrences = v.into_iter().map(|i| i.into()).collect();
8723 self
8724 }
8725}
8726
8727impl wkt::message::Message for BatchCreateOccurrencesRequest {
8728 fn typename() -> &'static str {
8729 "type.googleapis.com/grafeas.v1.BatchCreateOccurrencesRequest"
8730 }
8731}
8732
8733/// Response for creating occurrences in batch.
8734#[derive(Clone, Default, PartialEq)]
8735#[non_exhaustive]
8736pub struct BatchCreateOccurrencesResponse {
8737 /// The occurrences that were created.
8738 pub occurrences: std::vec::Vec<crate::model::Occurrence>,
8739
8740 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8741}
8742
8743impl BatchCreateOccurrencesResponse {
8744 pub fn new() -> Self {
8745 std::default::Default::default()
8746 }
8747
8748 /// Sets the value of [occurrences][crate::model::BatchCreateOccurrencesResponse::occurrences].
8749 ///
8750 /// # Example
8751 /// ```ignore,no_run
8752 /// # use google_cloud_grafeas_v1::model::BatchCreateOccurrencesResponse;
8753 /// use google_cloud_grafeas_v1::model::Occurrence;
8754 /// let x = BatchCreateOccurrencesResponse::new()
8755 /// .set_occurrences([
8756 /// Occurrence::default()/* use setters */,
8757 /// Occurrence::default()/* use (different) setters */,
8758 /// ]);
8759 /// ```
8760 pub fn set_occurrences<T, V>(mut self, v: T) -> Self
8761 where
8762 T: std::iter::IntoIterator<Item = V>,
8763 V: std::convert::Into<crate::model::Occurrence>,
8764 {
8765 use std::iter::Iterator;
8766 self.occurrences = v.into_iter().map(|i| i.into()).collect();
8767 self
8768 }
8769}
8770
8771impl wkt::message::Message for BatchCreateOccurrencesResponse {
8772 fn typename() -> &'static str {
8773 "type.googleapis.com/grafeas.v1.BatchCreateOccurrencesResponse"
8774 }
8775}
8776
8777/// Layer holds metadata specific to a layer of a Docker image.
8778#[derive(Clone, Default, PartialEq)]
8779#[non_exhaustive]
8780pub struct Layer {
8781 /// Required. The recovered Dockerfile directive used to construct this layer.
8782 /// See <https://docs.docker.com/engine/reference/builder/> for more information.
8783 pub directive: std::string::String,
8784
8785 /// The recovered arguments to the Dockerfile directive.
8786 pub arguments: std::string::String,
8787
8788 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8789}
8790
8791impl Layer {
8792 pub fn new() -> Self {
8793 std::default::Default::default()
8794 }
8795
8796 /// Sets the value of [directive][crate::model::Layer::directive].
8797 ///
8798 /// # Example
8799 /// ```ignore,no_run
8800 /// # use google_cloud_grafeas_v1::model::Layer;
8801 /// let x = Layer::new().set_directive("example");
8802 /// ```
8803 pub fn set_directive<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8804 self.directive = v.into();
8805 self
8806 }
8807
8808 /// Sets the value of [arguments][crate::model::Layer::arguments].
8809 ///
8810 /// # Example
8811 /// ```ignore,no_run
8812 /// # use google_cloud_grafeas_v1::model::Layer;
8813 /// let x = Layer::new().set_arguments("example");
8814 /// ```
8815 pub fn set_arguments<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8816 self.arguments = v.into();
8817 self
8818 }
8819}
8820
8821impl wkt::message::Message for Layer {
8822 fn typename() -> &'static str {
8823 "type.googleapis.com/grafeas.v1.Layer"
8824 }
8825}
8826
8827/// A set of properties that uniquely identify a given Docker image.
8828#[derive(Clone, Default, PartialEq)]
8829#[non_exhaustive]
8830pub struct Fingerprint {
8831 /// Required. The layer ID of the final layer in the Docker image's v1
8832 /// representation.
8833 pub v1_name: std::string::String,
8834
8835 /// Required. The ordered list of v2 blobs that represent a given image.
8836 pub v2_blob: std::vec::Vec<std::string::String>,
8837
8838 /// Output only. The name of the image's v2 blobs computed via:
8839 /// [bottom] := v2_blob[bottom]
8840 /// [N] := sha256(v2_blob[N] + " " + v2_name[N+1])
8841 /// Only the name of the final blob is kept.
8842 pub v2_name: std::string::String,
8843
8844 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8845}
8846
8847impl Fingerprint {
8848 pub fn new() -> Self {
8849 std::default::Default::default()
8850 }
8851
8852 /// Sets the value of [v1_name][crate::model::Fingerprint::v1_name].
8853 ///
8854 /// # Example
8855 /// ```ignore,no_run
8856 /// # use google_cloud_grafeas_v1::model::Fingerprint;
8857 /// let x = Fingerprint::new().set_v1_name("example");
8858 /// ```
8859 pub fn set_v1_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8860 self.v1_name = v.into();
8861 self
8862 }
8863
8864 /// Sets the value of [v2_blob][crate::model::Fingerprint::v2_blob].
8865 ///
8866 /// # Example
8867 /// ```ignore,no_run
8868 /// # use google_cloud_grafeas_v1::model::Fingerprint;
8869 /// let x = Fingerprint::new().set_v2_blob(["a", "b", "c"]);
8870 /// ```
8871 pub fn set_v2_blob<T, V>(mut self, v: T) -> Self
8872 where
8873 T: std::iter::IntoIterator<Item = V>,
8874 V: std::convert::Into<std::string::String>,
8875 {
8876 use std::iter::Iterator;
8877 self.v2_blob = v.into_iter().map(|i| i.into()).collect();
8878 self
8879 }
8880
8881 /// Sets the value of [v2_name][crate::model::Fingerprint::v2_name].
8882 ///
8883 /// # Example
8884 /// ```ignore,no_run
8885 /// # use google_cloud_grafeas_v1::model::Fingerprint;
8886 /// let x = Fingerprint::new().set_v2_name("example");
8887 /// ```
8888 pub fn set_v2_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8889 self.v2_name = v.into();
8890 self
8891 }
8892}
8893
8894impl wkt::message::Message for Fingerprint {
8895 fn typename() -> &'static str {
8896 "type.googleapis.com/grafeas.v1.Fingerprint"
8897 }
8898}
8899
8900/// Basis describes the base image portion (Note) of the DockerImage
8901/// relationship. Linked occurrences are derived from this or an equivalent image
8902/// via:
8903/// FROM <Basis.resource_url>
8904/// Or an equivalent reference, e.g., a tag of the resource_url.
8905#[derive(Clone, Default, PartialEq)]
8906#[non_exhaustive]
8907pub struct ImageNote {
8908 /// Required. Immutable. The resource_url for the resource representing the
8909 /// basis of associated occurrence images.
8910 pub resource_url: std::string::String,
8911
8912 /// Required. Immutable. The fingerprint of the base image.
8913 pub fingerprint: std::option::Option<crate::model::Fingerprint>,
8914
8915 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8916}
8917
8918impl ImageNote {
8919 pub fn new() -> Self {
8920 std::default::Default::default()
8921 }
8922
8923 /// Sets the value of [resource_url][crate::model::ImageNote::resource_url].
8924 ///
8925 /// # Example
8926 /// ```ignore,no_run
8927 /// # use google_cloud_grafeas_v1::model::ImageNote;
8928 /// let x = ImageNote::new().set_resource_url("example");
8929 /// ```
8930 pub fn set_resource_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8931 self.resource_url = v.into();
8932 self
8933 }
8934
8935 /// Sets the value of [fingerprint][crate::model::ImageNote::fingerprint].
8936 ///
8937 /// # Example
8938 /// ```ignore,no_run
8939 /// # use google_cloud_grafeas_v1::model::ImageNote;
8940 /// use google_cloud_grafeas_v1::model::Fingerprint;
8941 /// let x = ImageNote::new().set_fingerprint(Fingerprint::default()/* use setters */);
8942 /// ```
8943 pub fn set_fingerprint<T>(mut self, v: T) -> Self
8944 where
8945 T: std::convert::Into<crate::model::Fingerprint>,
8946 {
8947 self.fingerprint = std::option::Option::Some(v.into());
8948 self
8949 }
8950
8951 /// Sets or clears the value of [fingerprint][crate::model::ImageNote::fingerprint].
8952 ///
8953 /// # Example
8954 /// ```ignore,no_run
8955 /// # use google_cloud_grafeas_v1::model::ImageNote;
8956 /// use google_cloud_grafeas_v1::model::Fingerprint;
8957 /// let x = ImageNote::new().set_or_clear_fingerprint(Some(Fingerprint::default()/* use setters */));
8958 /// let x = ImageNote::new().set_or_clear_fingerprint(None::<Fingerprint>);
8959 /// ```
8960 pub fn set_or_clear_fingerprint<T>(mut self, v: std::option::Option<T>) -> Self
8961 where
8962 T: std::convert::Into<crate::model::Fingerprint>,
8963 {
8964 self.fingerprint = v.map(|x| x.into());
8965 self
8966 }
8967}
8968
8969impl wkt::message::Message for ImageNote {
8970 fn typename() -> &'static str {
8971 "type.googleapis.com/grafeas.v1.ImageNote"
8972 }
8973}
8974
8975/// Details of the derived image portion of the DockerImage relationship. This
8976/// image would be produced from a Dockerfile with FROM <DockerImage.Basis in
8977/// attached Note>.
8978#[derive(Clone, Default, PartialEq)]
8979#[non_exhaustive]
8980pub struct ImageOccurrence {
8981 /// Required. The fingerprint of the derived image.
8982 pub fingerprint: std::option::Option<crate::model::Fingerprint>,
8983
8984 /// Output only. The number of layers by which this image differs from the
8985 /// associated image basis.
8986 pub distance: i32,
8987
8988 /// This contains layer-specific metadata, if populated it has length
8989 /// "distance" and is ordered with [distance] being the layer immediately
8990 /// following the base image and [1] being the final layer.
8991 pub layer_info: std::vec::Vec<crate::model::Layer>,
8992
8993 /// Output only. This contains the base image URL for the derived image
8994 /// occurrence.
8995 pub base_resource_url: std::string::String,
8996
8997 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8998}
8999
9000impl ImageOccurrence {
9001 pub fn new() -> Self {
9002 std::default::Default::default()
9003 }
9004
9005 /// Sets the value of [fingerprint][crate::model::ImageOccurrence::fingerprint].
9006 ///
9007 /// # Example
9008 /// ```ignore,no_run
9009 /// # use google_cloud_grafeas_v1::model::ImageOccurrence;
9010 /// use google_cloud_grafeas_v1::model::Fingerprint;
9011 /// let x = ImageOccurrence::new().set_fingerprint(Fingerprint::default()/* use setters */);
9012 /// ```
9013 pub fn set_fingerprint<T>(mut self, v: T) -> Self
9014 where
9015 T: std::convert::Into<crate::model::Fingerprint>,
9016 {
9017 self.fingerprint = std::option::Option::Some(v.into());
9018 self
9019 }
9020
9021 /// Sets or clears the value of [fingerprint][crate::model::ImageOccurrence::fingerprint].
9022 ///
9023 /// # Example
9024 /// ```ignore,no_run
9025 /// # use google_cloud_grafeas_v1::model::ImageOccurrence;
9026 /// use google_cloud_grafeas_v1::model::Fingerprint;
9027 /// let x = ImageOccurrence::new().set_or_clear_fingerprint(Some(Fingerprint::default()/* use setters */));
9028 /// let x = ImageOccurrence::new().set_or_clear_fingerprint(None::<Fingerprint>);
9029 /// ```
9030 pub fn set_or_clear_fingerprint<T>(mut self, v: std::option::Option<T>) -> Self
9031 where
9032 T: std::convert::Into<crate::model::Fingerprint>,
9033 {
9034 self.fingerprint = v.map(|x| x.into());
9035 self
9036 }
9037
9038 /// Sets the value of [distance][crate::model::ImageOccurrence::distance].
9039 ///
9040 /// # Example
9041 /// ```ignore,no_run
9042 /// # use google_cloud_grafeas_v1::model::ImageOccurrence;
9043 /// let x = ImageOccurrence::new().set_distance(42);
9044 /// ```
9045 pub fn set_distance<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9046 self.distance = v.into();
9047 self
9048 }
9049
9050 /// Sets the value of [layer_info][crate::model::ImageOccurrence::layer_info].
9051 ///
9052 /// # Example
9053 /// ```ignore,no_run
9054 /// # use google_cloud_grafeas_v1::model::ImageOccurrence;
9055 /// use google_cloud_grafeas_v1::model::Layer;
9056 /// let x = ImageOccurrence::new()
9057 /// .set_layer_info([
9058 /// Layer::default()/* use setters */,
9059 /// Layer::default()/* use (different) setters */,
9060 /// ]);
9061 /// ```
9062 pub fn set_layer_info<T, V>(mut self, v: T) -> Self
9063 where
9064 T: std::iter::IntoIterator<Item = V>,
9065 V: std::convert::Into<crate::model::Layer>,
9066 {
9067 use std::iter::Iterator;
9068 self.layer_info = v.into_iter().map(|i| i.into()).collect();
9069 self
9070 }
9071
9072 /// Sets the value of [base_resource_url][crate::model::ImageOccurrence::base_resource_url].
9073 ///
9074 /// # Example
9075 /// ```ignore,no_run
9076 /// # use google_cloud_grafeas_v1::model::ImageOccurrence;
9077 /// let x = ImageOccurrence::new().set_base_resource_url("example");
9078 /// ```
9079 pub fn set_base_resource_url<T: std::convert::Into<std::string::String>>(
9080 mut self,
9081 v: T,
9082 ) -> Self {
9083 self.base_resource_url = v.into();
9084 self
9085 }
9086}
9087
9088impl wkt::message::Message for ImageOccurrence {
9089 fn typename() -> &'static str {
9090 "type.googleapis.com/grafeas.v1.ImageOccurrence"
9091 }
9092}
9093
9094/// Steps taken to build the artifact.
9095/// For a TaskRun, typically each container corresponds to one step in the
9096/// recipe.
9097#[derive(Clone, Default, PartialEq)]
9098#[non_exhaustive]
9099pub struct Recipe {
9100 /// URI indicating what type of recipe was performed. It determines the meaning
9101 /// of recipe.entryPoint, recipe.arguments, recipe.environment, and materials.
9102 pub r#type: std::string::String,
9103
9104 /// Index in materials containing the recipe steps that are not implied by
9105 /// recipe.type. For example, if the recipe type were "make", then this would
9106 /// point to the source containing the Makefile, not the make program itself.
9107 /// Set to -1 if the recipe doesn't come from a material, as zero is default
9108 /// unset value for int64.
9109 pub defined_in_material: i64,
9110
9111 /// String identifying the entry point into the build.
9112 /// This is often a path to a configuration file and/or a target label within
9113 /// that file. The syntax and meaning are defined by recipe.type. For example,
9114 /// if the recipe type were "make", then this would reference the directory in
9115 /// which to run make as well as which target to use.
9116 pub entry_point: std::string::String,
9117
9118 /// Collection of all external inputs that influenced the build on top of
9119 /// recipe.definedInMaterial and recipe.entryPoint. For example, if the recipe
9120 /// type were "make", then this might be the flags passed to make aside from
9121 /// the target, which is captured in recipe.entryPoint. Since the arguments
9122 /// field can greatly vary in structure, depending on the builder and recipe
9123 /// type, this is of form "Any".
9124 pub arguments: std::vec::Vec<wkt::Any>,
9125
9126 /// Any other builder-controlled inputs necessary for correctly evaluating the
9127 /// recipe. Usually only needed for reproducing the build but not evaluated as
9128 /// part of policy. Since the environment field can greatly vary in structure,
9129 /// depending on the builder and recipe type, this is of form "Any".
9130 pub environment: std::vec::Vec<wkt::Any>,
9131
9132 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9133}
9134
9135impl Recipe {
9136 pub fn new() -> Self {
9137 std::default::Default::default()
9138 }
9139
9140 /// Sets the value of [r#type][crate::model::Recipe::type].
9141 ///
9142 /// # Example
9143 /// ```ignore,no_run
9144 /// # use google_cloud_grafeas_v1::model::Recipe;
9145 /// let x = Recipe::new().set_type("example");
9146 /// ```
9147 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9148 self.r#type = v.into();
9149 self
9150 }
9151
9152 /// Sets the value of [defined_in_material][crate::model::Recipe::defined_in_material].
9153 ///
9154 /// # Example
9155 /// ```ignore,no_run
9156 /// # use google_cloud_grafeas_v1::model::Recipe;
9157 /// let x = Recipe::new().set_defined_in_material(42);
9158 /// ```
9159 pub fn set_defined_in_material<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9160 self.defined_in_material = v.into();
9161 self
9162 }
9163
9164 /// Sets the value of [entry_point][crate::model::Recipe::entry_point].
9165 ///
9166 /// # Example
9167 /// ```ignore,no_run
9168 /// # use google_cloud_grafeas_v1::model::Recipe;
9169 /// let x = Recipe::new().set_entry_point("example");
9170 /// ```
9171 pub fn set_entry_point<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9172 self.entry_point = v.into();
9173 self
9174 }
9175
9176 /// Sets the value of [arguments][crate::model::Recipe::arguments].
9177 ///
9178 /// # Example
9179 /// ```ignore,no_run
9180 /// # use google_cloud_grafeas_v1::model::Recipe;
9181 /// use wkt::Any;
9182 /// let x = Recipe::new()
9183 /// .set_arguments([
9184 /// Any::default()/* use setters */,
9185 /// Any::default()/* use (different) setters */,
9186 /// ]);
9187 /// ```
9188 pub fn set_arguments<T, V>(mut self, v: T) -> Self
9189 where
9190 T: std::iter::IntoIterator<Item = V>,
9191 V: std::convert::Into<wkt::Any>,
9192 {
9193 use std::iter::Iterator;
9194 self.arguments = v.into_iter().map(|i| i.into()).collect();
9195 self
9196 }
9197
9198 /// Sets the value of [environment][crate::model::Recipe::environment].
9199 ///
9200 /// # Example
9201 /// ```ignore,no_run
9202 /// # use google_cloud_grafeas_v1::model::Recipe;
9203 /// use wkt::Any;
9204 /// let x = Recipe::new()
9205 /// .set_environment([
9206 /// Any::default()/* use setters */,
9207 /// Any::default()/* use (different) setters */,
9208 /// ]);
9209 /// ```
9210 pub fn set_environment<T, V>(mut self, v: T) -> Self
9211 where
9212 T: std::iter::IntoIterator<Item = V>,
9213 V: std::convert::Into<wkt::Any>,
9214 {
9215 use std::iter::Iterator;
9216 self.environment = v.into_iter().map(|i| i.into()).collect();
9217 self
9218 }
9219}
9220
9221impl wkt::message::Message for Recipe {
9222 fn typename() -> &'static str {
9223 "type.googleapis.com/grafeas.v1.Recipe"
9224 }
9225}
9226
9227/// Indicates that the builder claims certain fields in this message to be
9228/// complete.
9229#[derive(Clone, Default, PartialEq)]
9230#[non_exhaustive]
9231pub struct Completeness {
9232 /// If true, the builder claims that recipe.arguments is complete, meaning that
9233 /// all external inputs are properly captured in the recipe.
9234 pub arguments: bool,
9235
9236 /// If true, the builder claims that recipe.environment is claimed to be
9237 /// complete.
9238 pub environment: bool,
9239
9240 /// If true, the builder claims that materials are complete, usually through
9241 /// some controls to prevent network access. Sometimes called "hermetic".
9242 pub materials: bool,
9243
9244 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9245}
9246
9247impl Completeness {
9248 pub fn new() -> Self {
9249 std::default::Default::default()
9250 }
9251
9252 /// Sets the value of [arguments][crate::model::Completeness::arguments].
9253 ///
9254 /// # Example
9255 /// ```ignore,no_run
9256 /// # use google_cloud_grafeas_v1::model::Completeness;
9257 /// let x = Completeness::new().set_arguments(true);
9258 /// ```
9259 pub fn set_arguments<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9260 self.arguments = v.into();
9261 self
9262 }
9263
9264 /// Sets the value of [environment][crate::model::Completeness::environment].
9265 ///
9266 /// # Example
9267 /// ```ignore,no_run
9268 /// # use google_cloud_grafeas_v1::model::Completeness;
9269 /// let x = Completeness::new().set_environment(true);
9270 /// ```
9271 pub fn set_environment<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9272 self.environment = v.into();
9273 self
9274 }
9275
9276 /// Sets the value of [materials][crate::model::Completeness::materials].
9277 ///
9278 /// # Example
9279 /// ```ignore,no_run
9280 /// # use google_cloud_grafeas_v1::model::Completeness;
9281 /// let x = Completeness::new().set_materials(true);
9282 /// ```
9283 pub fn set_materials<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9284 self.materials = v.into();
9285 self
9286 }
9287}
9288
9289impl wkt::message::Message for Completeness {
9290 fn typename() -> &'static str {
9291 "type.googleapis.com/grafeas.v1.Completeness"
9292 }
9293}
9294
9295/// Other properties of the build.
9296#[derive(Clone, Default, PartialEq)]
9297#[non_exhaustive]
9298pub struct Metadata {
9299 /// Identifies the particular build invocation, which can be useful for finding
9300 /// associated logs or other ad-hoc analysis. The value SHOULD be globally
9301 /// unique, per in-toto Provenance spec.
9302 pub build_invocation_id: std::string::String,
9303
9304 /// The timestamp of when the build started.
9305 pub build_started_on: std::option::Option<wkt::Timestamp>,
9306
9307 /// The timestamp of when the build completed.
9308 pub build_finished_on: std::option::Option<wkt::Timestamp>,
9309
9310 /// Indicates that the builder claims certain fields in this message to be
9311 /// complete.
9312 pub completeness: std::option::Option<crate::model::Completeness>,
9313
9314 /// If true, the builder claims that running the recipe on materials will
9315 /// produce bit-for-bit identical output.
9316 pub reproducible: bool,
9317
9318 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9319}
9320
9321impl Metadata {
9322 pub fn new() -> Self {
9323 std::default::Default::default()
9324 }
9325
9326 /// Sets the value of [build_invocation_id][crate::model::Metadata::build_invocation_id].
9327 ///
9328 /// # Example
9329 /// ```ignore,no_run
9330 /// # use google_cloud_grafeas_v1::model::Metadata;
9331 /// let x = Metadata::new().set_build_invocation_id("example");
9332 /// ```
9333 pub fn set_build_invocation_id<T: std::convert::Into<std::string::String>>(
9334 mut self,
9335 v: T,
9336 ) -> Self {
9337 self.build_invocation_id = v.into();
9338 self
9339 }
9340
9341 /// Sets the value of [build_started_on][crate::model::Metadata::build_started_on].
9342 ///
9343 /// # Example
9344 /// ```ignore,no_run
9345 /// # use google_cloud_grafeas_v1::model::Metadata;
9346 /// use wkt::Timestamp;
9347 /// let x = Metadata::new().set_build_started_on(Timestamp::default()/* use setters */);
9348 /// ```
9349 pub fn set_build_started_on<T>(mut self, v: T) -> Self
9350 where
9351 T: std::convert::Into<wkt::Timestamp>,
9352 {
9353 self.build_started_on = std::option::Option::Some(v.into());
9354 self
9355 }
9356
9357 /// Sets or clears the value of [build_started_on][crate::model::Metadata::build_started_on].
9358 ///
9359 /// # Example
9360 /// ```ignore,no_run
9361 /// # use google_cloud_grafeas_v1::model::Metadata;
9362 /// use wkt::Timestamp;
9363 /// let x = Metadata::new().set_or_clear_build_started_on(Some(Timestamp::default()/* use setters */));
9364 /// let x = Metadata::new().set_or_clear_build_started_on(None::<Timestamp>);
9365 /// ```
9366 pub fn set_or_clear_build_started_on<T>(mut self, v: std::option::Option<T>) -> Self
9367 where
9368 T: std::convert::Into<wkt::Timestamp>,
9369 {
9370 self.build_started_on = v.map(|x| x.into());
9371 self
9372 }
9373
9374 /// Sets the value of [build_finished_on][crate::model::Metadata::build_finished_on].
9375 ///
9376 /// # Example
9377 /// ```ignore,no_run
9378 /// # use google_cloud_grafeas_v1::model::Metadata;
9379 /// use wkt::Timestamp;
9380 /// let x = Metadata::new().set_build_finished_on(Timestamp::default()/* use setters */);
9381 /// ```
9382 pub fn set_build_finished_on<T>(mut self, v: T) -> Self
9383 where
9384 T: std::convert::Into<wkt::Timestamp>,
9385 {
9386 self.build_finished_on = std::option::Option::Some(v.into());
9387 self
9388 }
9389
9390 /// Sets or clears the value of [build_finished_on][crate::model::Metadata::build_finished_on].
9391 ///
9392 /// # Example
9393 /// ```ignore,no_run
9394 /// # use google_cloud_grafeas_v1::model::Metadata;
9395 /// use wkt::Timestamp;
9396 /// let x = Metadata::new().set_or_clear_build_finished_on(Some(Timestamp::default()/* use setters */));
9397 /// let x = Metadata::new().set_or_clear_build_finished_on(None::<Timestamp>);
9398 /// ```
9399 pub fn set_or_clear_build_finished_on<T>(mut self, v: std::option::Option<T>) -> Self
9400 where
9401 T: std::convert::Into<wkt::Timestamp>,
9402 {
9403 self.build_finished_on = v.map(|x| x.into());
9404 self
9405 }
9406
9407 /// Sets the value of [completeness][crate::model::Metadata::completeness].
9408 ///
9409 /// # Example
9410 /// ```ignore,no_run
9411 /// # use google_cloud_grafeas_v1::model::Metadata;
9412 /// use google_cloud_grafeas_v1::model::Completeness;
9413 /// let x = Metadata::new().set_completeness(Completeness::default()/* use setters */);
9414 /// ```
9415 pub fn set_completeness<T>(mut self, v: T) -> Self
9416 where
9417 T: std::convert::Into<crate::model::Completeness>,
9418 {
9419 self.completeness = std::option::Option::Some(v.into());
9420 self
9421 }
9422
9423 /// Sets or clears the value of [completeness][crate::model::Metadata::completeness].
9424 ///
9425 /// # Example
9426 /// ```ignore,no_run
9427 /// # use google_cloud_grafeas_v1::model::Metadata;
9428 /// use google_cloud_grafeas_v1::model::Completeness;
9429 /// let x = Metadata::new().set_or_clear_completeness(Some(Completeness::default()/* use setters */));
9430 /// let x = Metadata::new().set_or_clear_completeness(None::<Completeness>);
9431 /// ```
9432 pub fn set_or_clear_completeness<T>(mut self, v: std::option::Option<T>) -> Self
9433 where
9434 T: std::convert::Into<crate::model::Completeness>,
9435 {
9436 self.completeness = v.map(|x| x.into());
9437 self
9438 }
9439
9440 /// Sets the value of [reproducible][crate::model::Metadata::reproducible].
9441 ///
9442 /// # Example
9443 /// ```ignore,no_run
9444 /// # use google_cloud_grafeas_v1::model::Metadata;
9445 /// let x = Metadata::new().set_reproducible(true);
9446 /// ```
9447 pub fn set_reproducible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9448 self.reproducible = v.into();
9449 self
9450 }
9451}
9452
9453impl wkt::message::Message for Metadata {
9454 fn typename() -> &'static str {
9455 "type.googleapis.com/grafeas.v1.Metadata"
9456 }
9457}
9458
9459#[derive(Clone, Default, PartialEq)]
9460#[non_exhaustive]
9461pub struct BuilderConfig {
9462 pub id: std::string::String,
9463
9464 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9465}
9466
9467impl BuilderConfig {
9468 pub fn new() -> Self {
9469 std::default::Default::default()
9470 }
9471
9472 /// Sets the value of [id][crate::model::BuilderConfig::id].
9473 ///
9474 /// # Example
9475 /// ```ignore,no_run
9476 /// # use google_cloud_grafeas_v1::model::BuilderConfig;
9477 /// let x = BuilderConfig::new().set_id("example");
9478 /// ```
9479 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9480 self.id = v.into();
9481 self
9482 }
9483}
9484
9485impl wkt::message::Message for BuilderConfig {
9486 fn typename() -> &'static str {
9487 "type.googleapis.com/grafeas.v1.BuilderConfig"
9488 }
9489}
9490
9491#[derive(Clone, Default, PartialEq)]
9492#[non_exhaustive]
9493pub struct InTotoProvenance {
9494 pub builder_config: std::option::Option<crate::model::BuilderConfig>,
9495
9496 /// Identifies the configuration used for the build.
9497 /// When combined with materials, this SHOULD fully describe the build,
9498 /// such that re-running this recipe results in bit-for-bit identical output
9499 /// (if the build is reproducible).
9500 pub recipe: std::option::Option<crate::model::Recipe>,
9501
9502 pub metadata: std::option::Option<crate::model::Metadata>,
9503
9504 /// The collection of artifacts that influenced the build including sources,
9505 /// dependencies, build tools, base images, and so on. This is considered to be
9506 /// incomplete unless metadata.completeness.materials is true. Unset or null is
9507 /// equivalent to empty.
9508 pub materials: std::vec::Vec<std::string::String>,
9509
9510 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9511}
9512
9513impl InTotoProvenance {
9514 pub fn new() -> Self {
9515 std::default::Default::default()
9516 }
9517
9518 /// Sets the value of [builder_config][crate::model::InTotoProvenance::builder_config].
9519 ///
9520 /// # Example
9521 /// ```ignore,no_run
9522 /// # use google_cloud_grafeas_v1::model::InTotoProvenance;
9523 /// use google_cloud_grafeas_v1::model::BuilderConfig;
9524 /// let x = InTotoProvenance::new().set_builder_config(BuilderConfig::default()/* use setters */);
9525 /// ```
9526 pub fn set_builder_config<T>(mut self, v: T) -> Self
9527 where
9528 T: std::convert::Into<crate::model::BuilderConfig>,
9529 {
9530 self.builder_config = std::option::Option::Some(v.into());
9531 self
9532 }
9533
9534 /// Sets or clears the value of [builder_config][crate::model::InTotoProvenance::builder_config].
9535 ///
9536 /// # Example
9537 /// ```ignore,no_run
9538 /// # use google_cloud_grafeas_v1::model::InTotoProvenance;
9539 /// use google_cloud_grafeas_v1::model::BuilderConfig;
9540 /// let x = InTotoProvenance::new().set_or_clear_builder_config(Some(BuilderConfig::default()/* use setters */));
9541 /// let x = InTotoProvenance::new().set_or_clear_builder_config(None::<BuilderConfig>);
9542 /// ```
9543 pub fn set_or_clear_builder_config<T>(mut self, v: std::option::Option<T>) -> Self
9544 where
9545 T: std::convert::Into<crate::model::BuilderConfig>,
9546 {
9547 self.builder_config = v.map(|x| x.into());
9548 self
9549 }
9550
9551 /// Sets the value of [recipe][crate::model::InTotoProvenance::recipe].
9552 ///
9553 /// # Example
9554 /// ```ignore,no_run
9555 /// # use google_cloud_grafeas_v1::model::InTotoProvenance;
9556 /// use google_cloud_grafeas_v1::model::Recipe;
9557 /// let x = InTotoProvenance::new().set_recipe(Recipe::default()/* use setters */);
9558 /// ```
9559 pub fn set_recipe<T>(mut self, v: T) -> Self
9560 where
9561 T: std::convert::Into<crate::model::Recipe>,
9562 {
9563 self.recipe = std::option::Option::Some(v.into());
9564 self
9565 }
9566
9567 /// Sets or clears the value of [recipe][crate::model::InTotoProvenance::recipe].
9568 ///
9569 /// # Example
9570 /// ```ignore,no_run
9571 /// # use google_cloud_grafeas_v1::model::InTotoProvenance;
9572 /// use google_cloud_grafeas_v1::model::Recipe;
9573 /// let x = InTotoProvenance::new().set_or_clear_recipe(Some(Recipe::default()/* use setters */));
9574 /// let x = InTotoProvenance::new().set_or_clear_recipe(None::<Recipe>);
9575 /// ```
9576 pub fn set_or_clear_recipe<T>(mut self, v: std::option::Option<T>) -> Self
9577 where
9578 T: std::convert::Into<crate::model::Recipe>,
9579 {
9580 self.recipe = v.map(|x| x.into());
9581 self
9582 }
9583
9584 /// Sets the value of [metadata][crate::model::InTotoProvenance::metadata].
9585 ///
9586 /// # Example
9587 /// ```ignore,no_run
9588 /// # use google_cloud_grafeas_v1::model::InTotoProvenance;
9589 /// use google_cloud_grafeas_v1::model::Metadata;
9590 /// let x = InTotoProvenance::new().set_metadata(Metadata::default()/* use setters */);
9591 /// ```
9592 pub fn set_metadata<T>(mut self, v: T) -> Self
9593 where
9594 T: std::convert::Into<crate::model::Metadata>,
9595 {
9596 self.metadata = std::option::Option::Some(v.into());
9597 self
9598 }
9599
9600 /// Sets or clears the value of [metadata][crate::model::InTotoProvenance::metadata].
9601 ///
9602 /// # Example
9603 /// ```ignore,no_run
9604 /// # use google_cloud_grafeas_v1::model::InTotoProvenance;
9605 /// use google_cloud_grafeas_v1::model::Metadata;
9606 /// let x = InTotoProvenance::new().set_or_clear_metadata(Some(Metadata::default()/* use setters */));
9607 /// let x = InTotoProvenance::new().set_or_clear_metadata(None::<Metadata>);
9608 /// ```
9609 pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
9610 where
9611 T: std::convert::Into<crate::model::Metadata>,
9612 {
9613 self.metadata = v.map(|x| x.into());
9614 self
9615 }
9616
9617 /// Sets the value of [materials][crate::model::InTotoProvenance::materials].
9618 ///
9619 /// # Example
9620 /// ```ignore,no_run
9621 /// # use google_cloud_grafeas_v1::model::InTotoProvenance;
9622 /// let x = InTotoProvenance::new().set_materials(["a", "b", "c"]);
9623 /// ```
9624 pub fn set_materials<T, V>(mut self, v: T) -> Self
9625 where
9626 T: std::iter::IntoIterator<Item = V>,
9627 V: std::convert::Into<std::string::String>,
9628 {
9629 use std::iter::Iterator;
9630 self.materials = v.into_iter().map(|i| i.into()).collect();
9631 self
9632 }
9633}
9634
9635impl wkt::message::Message for InTotoProvenance {
9636 fn typename() -> &'static str {
9637 "type.googleapis.com/grafeas.v1.InTotoProvenance"
9638 }
9639}
9640
9641/// Spec defined at
9642/// <https://github.com/in-toto/attestation/tree/main/spec#statement> The
9643/// serialized InTotoStatement will be stored as Envelope.payload.
9644/// Envelope.payloadType is always "application/vnd.in-toto+json".
9645#[derive(Clone, Default, PartialEq)]
9646#[non_exhaustive]
9647pub struct InTotoStatement {
9648 /// Always `<https://in-toto.io/Statement/v0.1>`.
9649 pub r#type: std::string::String,
9650
9651 pub subject: std::vec::Vec<crate::model::Subject>,
9652
9653 /// `<https://slsa.dev/provenance/v0.1>` for SlsaProvenance.
9654 pub predicate_type: std::string::String,
9655
9656 pub predicate: std::option::Option<crate::model::in_toto_statement::Predicate>,
9657
9658 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9659}
9660
9661impl InTotoStatement {
9662 pub fn new() -> Self {
9663 std::default::Default::default()
9664 }
9665
9666 /// Sets the value of [r#type][crate::model::InTotoStatement::type].
9667 ///
9668 /// # Example
9669 /// ```ignore,no_run
9670 /// # use google_cloud_grafeas_v1::model::InTotoStatement;
9671 /// let x = InTotoStatement::new().set_type("example");
9672 /// ```
9673 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9674 self.r#type = v.into();
9675 self
9676 }
9677
9678 /// Sets the value of [subject][crate::model::InTotoStatement::subject].
9679 ///
9680 /// # Example
9681 /// ```ignore,no_run
9682 /// # use google_cloud_grafeas_v1::model::InTotoStatement;
9683 /// use google_cloud_grafeas_v1::model::Subject;
9684 /// let x = InTotoStatement::new()
9685 /// .set_subject([
9686 /// Subject::default()/* use setters */,
9687 /// Subject::default()/* use (different) setters */,
9688 /// ]);
9689 /// ```
9690 pub fn set_subject<T, V>(mut self, v: T) -> Self
9691 where
9692 T: std::iter::IntoIterator<Item = V>,
9693 V: std::convert::Into<crate::model::Subject>,
9694 {
9695 use std::iter::Iterator;
9696 self.subject = v.into_iter().map(|i| i.into()).collect();
9697 self
9698 }
9699
9700 /// Sets the value of [predicate_type][crate::model::InTotoStatement::predicate_type].
9701 ///
9702 /// # Example
9703 /// ```ignore,no_run
9704 /// # use google_cloud_grafeas_v1::model::InTotoStatement;
9705 /// let x = InTotoStatement::new().set_predicate_type("example");
9706 /// ```
9707 pub fn set_predicate_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9708 self.predicate_type = v.into();
9709 self
9710 }
9711
9712 /// Sets the value of [predicate][crate::model::InTotoStatement::predicate].
9713 ///
9714 /// Note that all the setters affecting `predicate` are mutually
9715 /// exclusive.
9716 ///
9717 /// # Example
9718 /// ```ignore,no_run
9719 /// # use google_cloud_grafeas_v1::model::InTotoStatement;
9720 /// use google_cloud_grafeas_v1::model::InTotoProvenance;
9721 /// let x = InTotoStatement::new().set_predicate(Some(
9722 /// google_cloud_grafeas_v1::model::in_toto_statement::Predicate::Provenance(InTotoProvenance::default().into())));
9723 /// ```
9724 pub fn set_predicate<
9725 T: std::convert::Into<std::option::Option<crate::model::in_toto_statement::Predicate>>,
9726 >(
9727 mut self,
9728 v: T,
9729 ) -> Self {
9730 self.predicate = v.into();
9731 self
9732 }
9733
9734 /// The value of [predicate][crate::model::InTotoStatement::predicate]
9735 /// if it holds a `Provenance`, `None` if the field is not set or
9736 /// holds a different branch.
9737 pub fn provenance(
9738 &self,
9739 ) -> std::option::Option<&std::boxed::Box<crate::model::InTotoProvenance>> {
9740 #[allow(unreachable_patterns)]
9741 self.predicate.as_ref().and_then(|v| match v {
9742 crate::model::in_toto_statement::Predicate::Provenance(v) => {
9743 std::option::Option::Some(v)
9744 }
9745 _ => std::option::Option::None,
9746 })
9747 }
9748
9749 /// Sets the value of [predicate][crate::model::InTotoStatement::predicate]
9750 /// to hold a `Provenance`.
9751 ///
9752 /// Note that all the setters affecting `predicate` are
9753 /// mutually exclusive.
9754 ///
9755 /// # Example
9756 /// ```ignore,no_run
9757 /// # use google_cloud_grafeas_v1::model::InTotoStatement;
9758 /// use google_cloud_grafeas_v1::model::InTotoProvenance;
9759 /// let x = InTotoStatement::new().set_provenance(InTotoProvenance::default()/* use setters */);
9760 /// assert!(x.provenance().is_some());
9761 /// assert!(x.slsa_provenance().is_none());
9762 /// assert!(x.slsa_provenance_zero_two().is_none());
9763 /// ```
9764 pub fn set_provenance<
9765 T: std::convert::Into<std::boxed::Box<crate::model::InTotoProvenance>>,
9766 >(
9767 mut self,
9768 v: T,
9769 ) -> Self {
9770 self.predicate = std::option::Option::Some(
9771 crate::model::in_toto_statement::Predicate::Provenance(v.into()),
9772 );
9773 self
9774 }
9775
9776 /// The value of [predicate][crate::model::InTotoStatement::predicate]
9777 /// if it holds a `SlsaProvenance`, `None` if the field is not set or
9778 /// holds a different branch.
9779 pub fn slsa_provenance(
9780 &self,
9781 ) -> std::option::Option<&std::boxed::Box<crate::model::SlsaProvenance>> {
9782 #[allow(unreachable_patterns)]
9783 self.predicate.as_ref().and_then(|v| match v {
9784 crate::model::in_toto_statement::Predicate::SlsaProvenance(v) => {
9785 std::option::Option::Some(v)
9786 }
9787 _ => std::option::Option::None,
9788 })
9789 }
9790
9791 /// Sets the value of [predicate][crate::model::InTotoStatement::predicate]
9792 /// to hold a `SlsaProvenance`.
9793 ///
9794 /// Note that all the setters affecting `predicate` are
9795 /// mutually exclusive.
9796 ///
9797 /// # Example
9798 /// ```ignore,no_run
9799 /// # use google_cloud_grafeas_v1::model::InTotoStatement;
9800 /// use google_cloud_grafeas_v1::model::SlsaProvenance;
9801 /// let x = InTotoStatement::new().set_slsa_provenance(SlsaProvenance::default()/* use setters */);
9802 /// assert!(x.slsa_provenance().is_some());
9803 /// assert!(x.provenance().is_none());
9804 /// assert!(x.slsa_provenance_zero_two().is_none());
9805 /// ```
9806 pub fn set_slsa_provenance<
9807 T: std::convert::Into<std::boxed::Box<crate::model::SlsaProvenance>>,
9808 >(
9809 mut self,
9810 v: T,
9811 ) -> Self {
9812 self.predicate = std::option::Option::Some(
9813 crate::model::in_toto_statement::Predicate::SlsaProvenance(v.into()),
9814 );
9815 self
9816 }
9817
9818 /// The value of [predicate][crate::model::InTotoStatement::predicate]
9819 /// if it holds a `SlsaProvenanceZeroTwo`, `None` if the field is not set or
9820 /// holds a different branch.
9821 pub fn slsa_provenance_zero_two(
9822 &self,
9823 ) -> std::option::Option<&std::boxed::Box<crate::model::SlsaProvenanceZeroTwo>> {
9824 #[allow(unreachable_patterns)]
9825 self.predicate.as_ref().and_then(|v| match v {
9826 crate::model::in_toto_statement::Predicate::SlsaProvenanceZeroTwo(v) => {
9827 std::option::Option::Some(v)
9828 }
9829 _ => std::option::Option::None,
9830 })
9831 }
9832
9833 /// Sets the value of [predicate][crate::model::InTotoStatement::predicate]
9834 /// to hold a `SlsaProvenanceZeroTwo`.
9835 ///
9836 /// Note that all the setters affecting `predicate` are
9837 /// mutually exclusive.
9838 ///
9839 /// # Example
9840 /// ```ignore,no_run
9841 /// # use google_cloud_grafeas_v1::model::InTotoStatement;
9842 /// use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
9843 /// let x = InTotoStatement::new().set_slsa_provenance_zero_two(SlsaProvenanceZeroTwo::default()/* use setters */);
9844 /// assert!(x.slsa_provenance_zero_two().is_some());
9845 /// assert!(x.provenance().is_none());
9846 /// assert!(x.slsa_provenance().is_none());
9847 /// ```
9848 pub fn set_slsa_provenance_zero_two<
9849 T: std::convert::Into<std::boxed::Box<crate::model::SlsaProvenanceZeroTwo>>,
9850 >(
9851 mut self,
9852 v: T,
9853 ) -> Self {
9854 self.predicate = std::option::Option::Some(
9855 crate::model::in_toto_statement::Predicate::SlsaProvenanceZeroTwo(v.into()),
9856 );
9857 self
9858 }
9859}
9860
9861impl wkt::message::Message for InTotoStatement {
9862 fn typename() -> &'static str {
9863 "type.googleapis.com/grafeas.v1.InTotoStatement"
9864 }
9865}
9866
9867/// Defines additional types related to [InTotoStatement].
9868pub mod in_toto_statement {
9869 #[allow(unused_imports)]
9870 use super::*;
9871
9872 #[derive(Clone, Debug, PartialEq)]
9873 #[non_exhaustive]
9874 pub enum Predicate {
9875 Provenance(std::boxed::Box<crate::model::InTotoProvenance>),
9876 SlsaProvenance(std::boxed::Box<crate::model::SlsaProvenance>),
9877 SlsaProvenanceZeroTwo(std::boxed::Box<crate::model::SlsaProvenanceZeroTwo>),
9878 }
9879}
9880
9881#[derive(Clone, Default, PartialEq)]
9882#[non_exhaustive]
9883pub struct Subject {
9884 pub name: std::string::String,
9885
9886 /// `"<ALGORITHM>": "<HEX_VALUE>"`
9887 /// Algorithms can be e.g. sha256, sha512
9888 /// See
9889 /// <https://github.com/in-toto/attestation/blob/main/spec/field_types.md#DigestSet>
9890 pub digest: std::collections::HashMap<std::string::String, std::string::String>,
9891
9892 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9893}
9894
9895impl Subject {
9896 pub fn new() -> Self {
9897 std::default::Default::default()
9898 }
9899
9900 /// Sets the value of [name][crate::model::Subject::name].
9901 ///
9902 /// # Example
9903 /// ```ignore,no_run
9904 /// # use google_cloud_grafeas_v1::model::Subject;
9905 /// let x = Subject::new().set_name("example");
9906 /// ```
9907 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9908 self.name = v.into();
9909 self
9910 }
9911
9912 /// Sets the value of [digest][crate::model::Subject::digest].
9913 ///
9914 /// # Example
9915 /// ```ignore,no_run
9916 /// # use google_cloud_grafeas_v1::model::Subject;
9917 /// let x = Subject::new().set_digest([
9918 /// ("key0", "abc"),
9919 /// ("key1", "xyz"),
9920 /// ]);
9921 /// ```
9922 pub fn set_digest<T, K, V>(mut self, v: T) -> Self
9923 where
9924 T: std::iter::IntoIterator<Item = (K, V)>,
9925 K: std::convert::Into<std::string::String>,
9926 V: std::convert::Into<std::string::String>,
9927 {
9928 use std::iter::Iterator;
9929 self.digest = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9930 self
9931 }
9932}
9933
9934impl wkt::message::Message for Subject {
9935 fn typename() -> &'static str {
9936 "type.googleapis.com/grafeas.v1.Subject"
9937 }
9938}
9939
9940#[derive(Clone, Default, PartialEq)]
9941#[non_exhaustive]
9942pub struct InTotoSlsaProvenanceV1 {
9943 /// InToto spec defined at
9944 /// <https://github.com/in-toto/attestation/tree/main/spec#statement>
9945 pub r#type: std::string::String,
9946
9947 pub subject: std::vec::Vec<crate::model::Subject>,
9948
9949 pub predicate_type: std::string::String,
9950
9951 pub predicate: std::option::Option<crate::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1>,
9952
9953 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9954}
9955
9956impl InTotoSlsaProvenanceV1 {
9957 pub fn new() -> Self {
9958 std::default::Default::default()
9959 }
9960
9961 /// Sets the value of [r#type][crate::model::InTotoSlsaProvenanceV1::type].
9962 ///
9963 /// # Example
9964 /// ```ignore,no_run
9965 /// # use google_cloud_grafeas_v1::model::InTotoSlsaProvenanceV1;
9966 /// let x = InTotoSlsaProvenanceV1::new().set_type("example");
9967 /// ```
9968 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9969 self.r#type = v.into();
9970 self
9971 }
9972
9973 /// Sets the value of [subject][crate::model::InTotoSlsaProvenanceV1::subject].
9974 ///
9975 /// # Example
9976 /// ```ignore,no_run
9977 /// # use google_cloud_grafeas_v1::model::InTotoSlsaProvenanceV1;
9978 /// use google_cloud_grafeas_v1::model::Subject;
9979 /// let x = InTotoSlsaProvenanceV1::new()
9980 /// .set_subject([
9981 /// Subject::default()/* use setters */,
9982 /// Subject::default()/* use (different) setters */,
9983 /// ]);
9984 /// ```
9985 pub fn set_subject<T, V>(mut self, v: T) -> Self
9986 where
9987 T: std::iter::IntoIterator<Item = V>,
9988 V: std::convert::Into<crate::model::Subject>,
9989 {
9990 use std::iter::Iterator;
9991 self.subject = v.into_iter().map(|i| i.into()).collect();
9992 self
9993 }
9994
9995 /// Sets the value of [predicate_type][crate::model::InTotoSlsaProvenanceV1::predicate_type].
9996 ///
9997 /// # Example
9998 /// ```ignore,no_run
9999 /// # use google_cloud_grafeas_v1::model::InTotoSlsaProvenanceV1;
10000 /// let x = InTotoSlsaProvenanceV1::new().set_predicate_type("example");
10001 /// ```
10002 pub fn set_predicate_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10003 self.predicate_type = v.into();
10004 self
10005 }
10006
10007 /// Sets the value of [predicate][crate::model::InTotoSlsaProvenanceV1::predicate].
10008 ///
10009 /// # Example
10010 /// ```ignore,no_run
10011 /// # use google_cloud_grafeas_v1::model::InTotoSlsaProvenanceV1;
10012 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1;
10013 /// let x = InTotoSlsaProvenanceV1::new().set_predicate(SlsaProvenanceV1::default()/* use setters */);
10014 /// ```
10015 pub fn set_predicate<T>(mut self, v: T) -> Self
10016 where
10017 T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1>,
10018 {
10019 self.predicate = std::option::Option::Some(v.into());
10020 self
10021 }
10022
10023 /// Sets or clears the value of [predicate][crate::model::InTotoSlsaProvenanceV1::predicate].
10024 ///
10025 /// # Example
10026 /// ```ignore,no_run
10027 /// # use google_cloud_grafeas_v1::model::InTotoSlsaProvenanceV1;
10028 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1;
10029 /// let x = InTotoSlsaProvenanceV1::new().set_or_clear_predicate(Some(SlsaProvenanceV1::default()/* use setters */));
10030 /// let x = InTotoSlsaProvenanceV1::new().set_or_clear_predicate(None::<SlsaProvenanceV1>);
10031 /// ```
10032 pub fn set_or_clear_predicate<T>(mut self, v: std::option::Option<T>) -> Self
10033 where
10034 T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1>,
10035 {
10036 self.predicate = v.map(|x| x.into());
10037 self
10038 }
10039}
10040
10041impl wkt::message::Message for InTotoSlsaProvenanceV1 {
10042 fn typename() -> &'static str {
10043 "type.googleapis.com/grafeas.v1.InTotoSlsaProvenanceV1"
10044 }
10045}
10046
10047/// Defines additional types related to [InTotoSlsaProvenanceV1].
10048pub mod in_toto_slsa_provenance_v_1 {
10049 #[allow(unused_imports)]
10050 use super::*;
10051
10052 /// Keep in sync with schema at
10053 /// <https://github.com/slsa-framework/slsa/blob/main/docs/provenance/schema/v1/provenance.proto>
10054 /// Builder renamed to ProvenanceBuilder because of Java conflicts.
10055 #[derive(Clone, Default, PartialEq)]
10056 #[non_exhaustive]
10057 pub struct SlsaProvenanceV1 {
10058 pub build_definition:
10059 std::option::Option<crate::model::in_toto_slsa_provenance_v_1::BuildDefinition>,
10060
10061 pub run_details: std::option::Option<crate::model::in_toto_slsa_provenance_v_1::RunDetails>,
10062
10063 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10064 }
10065
10066 impl SlsaProvenanceV1 {
10067 pub fn new() -> Self {
10068 std::default::Default::default()
10069 }
10070
10071 /// Sets the value of [build_definition][crate::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1::build_definition].
10072 ///
10073 /// # Example
10074 /// ```ignore,no_run
10075 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1;
10076 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildDefinition;
10077 /// let x = SlsaProvenanceV1::new().set_build_definition(BuildDefinition::default()/* use setters */);
10078 /// ```
10079 pub fn set_build_definition<T>(mut self, v: T) -> Self
10080 where
10081 T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::BuildDefinition>,
10082 {
10083 self.build_definition = std::option::Option::Some(v.into());
10084 self
10085 }
10086
10087 /// Sets or clears the value of [build_definition][crate::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1::build_definition].
10088 ///
10089 /// # Example
10090 /// ```ignore,no_run
10091 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1;
10092 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildDefinition;
10093 /// let x = SlsaProvenanceV1::new().set_or_clear_build_definition(Some(BuildDefinition::default()/* use setters */));
10094 /// let x = SlsaProvenanceV1::new().set_or_clear_build_definition(None::<BuildDefinition>);
10095 /// ```
10096 pub fn set_or_clear_build_definition<T>(mut self, v: std::option::Option<T>) -> Self
10097 where
10098 T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::BuildDefinition>,
10099 {
10100 self.build_definition = v.map(|x| x.into());
10101 self
10102 }
10103
10104 /// Sets the value of [run_details][crate::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1::run_details].
10105 ///
10106 /// # Example
10107 /// ```ignore,no_run
10108 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1;
10109 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::RunDetails;
10110 /// let x = SlsaProvenanceV1::new().set_run_details(RunDetails::default()/* use setters */);
10111 /// ```
10112 pub fn set_run_details<T>(mut self, v: T) -> Self
10113 where
10114 T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::RunDetails>,
10115 {
10116 self.run_details = std::option::Option::Some(v.into());
10117 self
10118 }
10119
10120 /// Sets or clears the value of [run_details][crate::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1::run_details].
10121 ///
10122 /// # Example
10123 /// ```ignore,no_run
10124 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1;
10125 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::RunDetails;
10126 /// let x = SlsaProvenanceV1::new().set_or_clear_run_details(Some(RunDetails::default()/* use setters */));
10127 /// let x = SlsaProvenanceV1::new().set_or_clear_run_details(None::<RunDetails>);
10128 /// ```
10129 pub fn set_or_clear_run_details<T>(mut self, v: std::option::Option<T>) -> Self
10130 where
10131 T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::RunDetails>,
10132 {
10133 self.run_details = v.map(|x| x.into());
10134 self
10135 }
10136 }
10137
10138 impl wkt::message::Message for SlsaProvenanceV1 {
10139 fn typename() -> &'static str {
10140 "type.googleapis.com/grafeas.v1.InTotoSlsaProvenanceV1.SlsaProvenanceV1"
10141 }
10142 }
10143
10144 #[derive(Clone, Default, PartialEq)]
10145 #[non_exhaustive]
10146 pub struct BuildDefinition {
10147 pub build_type: std::string::String,
10148
10149 pub external_parameters: std::option::Option<wkt::Struct>,
10150
10151 pub internal_parameters: std::option::Option<wkt::Struct>,
10152
10153 pub resolved_dependencies:
10154 std::vec::Vec<crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor>,
10155
10156 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10157 }
10158
10159 impl BuildDefinition {
10160 pub fn new() -> Self {
10161 std::default::Default::default()
10162 }
10163
10164 /// Sets the value of [build_type][crate::model::in_toto_slsa_provenance_v_1::BuildDefinition::build_type].
10165 ///
10166 /// # Example
10167 /// ```ignore,no_run
10168 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildDefinition;
10169 /// let x = BuildDefinition::new().set_build_type("example");
10170 /// ```
10171 pub fn set_build_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10172 self.build_type = v.into();
10173 self
10174 }
10175
10176 /// Sets the value of [external_parameters][crate::model::in_toto_slsa_provenance_v_1::BuildDefinition::external_parameters].
10177 ///
10178 /// # Example
10179 /// ```ignore,no_run
10180 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildDefinition;
10181 /// use wkt::Struct;
10182 /// let x = BuildDefinition::new().set_external_parameters(Struct::default()/* use setters */);
10183 /// ```
10184 pub fn set_external_parameters<T>(mut self, v: T) -> Self
10185 where
10186 T: std::convert::Into<wkt::Struct>,
10187 {
10188 self.external_parameters = std::option::Option::Some(v.into());
10189 self
10190 }
10191
10192 /// Sets or clears the value of [external_parameters][crate::model::in_toto_slsa_provenance_v_1::BuildDefinition::external_parameters].
10193 ///
10194 /// # Example
10195 /// ```ignore,no_run
10196 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildDefinition;
10197 /// use wkt::Struct;
10198 /// let x = BuildDefinition::new().set_or_clear_external_parameters(Some(Struct::default()/* use setters */));
10199 /// let x = BuildDefinition::new().set_or_clear_external_parameters(None::<Struct>);
10200 /// ```
10201 pub fn set_or_clear_external_parameters<T>(mut self, v: std::option::Option<T>) -> Self
10202 where
10203 T: std::convert::Into<wkt::Struct>,
10204 {
10205 self.external_parameters = v.map(|x| x.into());
10206 self
10207 }
10208
10209 /// Sets the value of [internal_parameters][crate::model::in_toto_slsa_provenance_v_1::BuildDefinition::internal_parameters].
10210 ///
10211 /// # Example
10212 /// ```ignore,no_run
10213 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildDefinition;
10214 /// use wkt::Struct;
10215 /// let x = BuildDefinition::new().set_internal_parameters(Struct::default()/* use setters */);
10216 /// ```
10217 pub fn set_internal_parameters<T>(mut self, v: T) -> Self
10218 where
10219 T: std::convert::Into<wkt::Struct>,
10220 {
10221 self.internal_parameters = std::option::Option::Some(v.into());
10222 self
10223 }
10224
10225 /// Sets or clears the value of [internal_parameters][crate::model::in_toto_slsa_provenance_v_1::BuildDefinition::internal_parameters].
10226 ///
10227 /// # Example
10228 /// ```ignore,no_run
10229 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildDefinition;
10230 /// use wkt::Struct;
10231 /// let x = BuildDefinition::new().set_or_clear_internal_parameters(Some(Struct::default()/* use setters */));
10232 /// let x = BuildDefinition::new().set_or_clear_internal_parameters(None::<Struct>);
10233 /// ```
10234 pub fn set_or_clear_internal_parameters<T>(mut self, v: std::option::Option<T>) -> Self
10235 where
10236 T: std::convert::Into<wkt::Struct>,
10237 {
10238 self.internal_parameters = v.map(|x| x.into());
10239 self
10240 }
10241
10242 /// Sets the value of [resolved_dependencies][crate::model::in_toto_slsa_provenance_v_1::BuildDefinition::resolved_dependencies].
10243 ///
10244 /// # Example
10245 /// ```ignore,no_run
10246 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildDefinition;
10247 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ResourceDescriptor;
10248 /// let x = BuildDefinition::new()
10249 /// .set_resolved_dependencies([
10250 /// ResourceDescriptor::default()/* use setters */,
10251 /// ResourceDescriptor::default()/* use (different) setters */,
10252 /// ]);
10253 /// ```
10254 pub fn set_resolved_dependencies<T, V>(mut self, v: T) -> Self
10255 where
10256 T: std::iter::IntoIterator<Item = V>,
10257 V: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor>,
10258 {
10259 use std::iter::Iterator;
10260 self.resolved_dependencies = v.into_iter().map(|i| i.into()).collect();
10261 self
10262 }
10263 }
10264
10265 impl wkt::message::Message for BuildDefinition {
10266 fn typename() -> &'static str {
10267 "type.googleapis.com/grafeas.v1.InTotoSlsaProvenanceV1.BuildDefinition"
10268 }
10269 }
10270
10271 #[derive(Clone, Default, PartialEq)]
10272 #[non_exhaustive]
10273 pub struct ResourceDescriptor {
10274 pub name: std::string::String,
10275
10276 pub uri: std::string::String,
10277
10278 pub digest: std::collections::HashMap<std::string::String, std::string::String>,
10279
10280 pub content: ::bytes::Bytes,
10281
10282 pub download_location: std::string::String,
10283
10284 pub media_type: std::string::String,
10285
10286 pub annotations: std::collections::HashMap<std::string::String, wkt::Value>,
10287
10288 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10289 }
10290
10291 impl ResourceDescriptor {
10292 pub fn new() -> Self {
10293 std::default::Default::default()
10294 }
10295
10296 /// Sets the value of [name][crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor::name].
10297 ///
10298 /// # Example
10299 /// ```ignore,no_run
10300 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ResourceDescriptor;
10301 /// let x = ResourceDescriptor::new().set_name("example");
10302 /// ```
10303 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10304 self.name = v.into();
10305 self
10306 }
10307
10308 /// Sets the value of [uri][crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor::uri].
10309 ///
10310 /// # Example
10311 /// ```ignore,no_run
10312 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ResourceDescriptor;
10313 /// let x = ResourceDescriptor::new().set_uri("example");
10314 /// ```
10315 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10316 self.uri = v.into();
10317 self
10318 }
10319
10320 /// Sets the value of [digest][crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor::digest].
10321 ///
10322 /// # Example
10323 /// ```ignore,no_run
10324 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ResourceDescriptor;
10325 /// let x = ResourceDescriptor::new().set_digest([
10326 /// ("key0", "abc"),
10327 /// ("key1", "xyz"),
10328 /// ]);
10329 /// ```
10330 pub fn set_digest<T, K, V>(mut self, v: T) -> Self
10331 where
10332 T: std::iter::IntoIterator<Item = (K, V)>,
10333 K: std::convert::Into<std::string::String>,
10334 V: std::convert::Into<std::string::String>,
10335 {
10336 use std::iter::Iterator;
10337 self.digest = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10338 self
10339 }
10340
10341 /// Sets the value of [content][crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor::content].
10342 ///
10343 /// # Example
10344 /// ```ignore,no_run
10345 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ResourceDescriptor;
10346 /// let x = ResourceDescriptor::new().set_content(bytes::Bytes::from_static(b"example"));
10347 /// ```
10348 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
10349 self.content = v.into();
10350 self
10351 }
10352
10353 /// Sets the value of [download_location][crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor::download_location].
10354 ///
10355 /// # Example
10356 /// ```ignore,no_run
10357 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ResourceDescriptor;
10358 /// let x = ResourceDescriptor::new().set_download_location("example");
10359 /// ```
10360 pub fn set_download_location<T: std::convert::Into<std::string::String>>(
10361 mut self,
10362 v: T,
10363 ) -> Self {
10364 self.download_location = v.into();
10365 self
10366 }
10367
10368 /// Sets the value of [media_type][crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor::media_type].
10369 ///
10370 /// # Example
10371 /// ```ignore,no_run
10372 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ResourceDescriptor;
10373 /// let x = ResourceDescriptor::new().set_media_type("example");
10374 /// ```
10375 pub fn set_media_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10376 self.media_type = v.into();
10377 self
10378 }
10379
10380 /// Sets the value of [annotations][crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor::annotations].
10381 ///
10382 /// # Example
10383 /// ```ignore,no_run
10384 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ResourceDescriptor;
10385 /// use wkt::Value;
10386 /// let x = ResourceDescriptor::new().set_annotations([
10387 /// ("key0", Value::default()/* use setters */),
10388 /// ("key1", Value::default()/* use (different) setters */),
10389 /// ]);
10390 /// ```
10391 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
10392 where
10393 T: std::iter::IntoIterator<Item = (K, V)>,
10394 K: std::convert::Into<std::string::String>,
10395 V: std::convert::Into<wkt::Value>,
10396 {
10397 use std::iter::Iterator;
10398 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10399 self
10400 }
10401 }
10402
10403 impl wkt::message::Message for ResourceDescriptor {
10404 fn typename() -> &'static str {
10405 "type.googleapis.com/grafeas.v1.InTotoSlsaProvenanceV1.ResourceDescriptor"
10406 }
10407 }
10408
10409 #[derive(Clone, Default, PartialEq)]
10410 #[non_exhaustive]
10411 pub struct RunDetails {
10412 pub builder:
10413 std::option::Option<crate::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder>,
10414
10415 pub metadata: std::option::Option<crate::model::in_toto_slsa_provenance_v_1::BuildMetadata>,
10416
10417 pub byproducts:
10418 std::vec::Vec<crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor>,
10419
10420 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10421 }
10422
10423 impl RunDetails {
10424 pub fn new() -> Self {
10425 std::default::Default::default()
10426 }
10427
10428 /// Sets the value of [builder][crate::model::in_toto_slsa_provenance_v_1::RunDetails::builder].
10429 ///
10430 /// # Example
10431 /// ```ignore,no_run
10432 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::RunDetails;
10433 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder;
10434 /// let x = RunDetails::new().set_builder(ProvenanceBuilder::default()/* use setters */);
10435 /// ```
10436 pub fn set_builder<T>(mut self, v: T) -> Self
10437 where
10438 T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder>,
10439 {
10440 self.builder = std::option::Option::Some(v.into());
10441 self
10442 }
10443
10444 /// Sets or clears the value of [builder][crate::model::in_toto_slsa_provenance_v_1::RunDetails::builder].
10445 ///
10446 /// # Example
10447 /// ```ignore,no_run
10448 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::RunDetails;
10449 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder;
10450 /// let x = RunDetails::new().set_or_clear_builder(Some(ProvenanceBuilder::default()/* use setters */));
10451 /// let x = RunDetails::new().set_or_clear_builder(None::<ProvenanceBuilder>);
10452 /// ```
10453 pub fn set_or_clear_builder<T>(mut self, v: std::option::Option<T>) -> Self
10454 where
10455 T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder>,
10456 {
10457 self.builder = v.map(|x| x.into());
10458 self
10459 }
10460
10461 /// Sets the value of [metadata][crate::model::in_toto_slsa_provenance_v_1::RunDetails::metadata].
10462 ///
10463 /// # Example
10464 /// ```ignore,no_run
10465 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::RunDetails;
10466 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildMetadata;
10467 /// let x = RunDetails::new().set_metadata(BuildMetadata::default()/* use setters */);
10468 /// ```
10469 pub fn set_metadata<T>(mut self, v: T) -> Self
10470 where
10471 T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::BuildMetadata>,
10472 {
10473 self.metadata = std::option::Option::Some(v.into());
10474 self
10475 }
10476
10477 /// Sets or clears the value of [metadata][crate::model::in_toto_slsa_provenance_v_1::RunDetails::metadata].
10478 ///
10479 /// # Example
10480 /// ```ignore,no_run
10481 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::RunDetails;
10482 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildMetadata;
10483 /// let x = RunDetails::new().set_or_clear_metadata(Some(BuildMetadata::default()/* use setters */));
10484 /// let x = RunDetails::new().set_or_clear_metadata(None::<BuildMetadata>);
10485 /// ```
10486 pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
10487 where
10488 T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::BuildMetadata>,
10489 {
10490 self.metadata = v.map(|x| x.into());
10491 self
10492 }
10493
10494 /// Sets the value of [byproducts][crate::model::in_toto_slsa_provenance_v_1::RunDetails::byproducts].
10495 ///
10496 /// # Example
10497 /// ```ignore,no_run
10498 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::RunDetails;
10499 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ResourceDescriptor;
10500 /// let x = RunDetails::new()
10501 /// .set_byproducts([
10502 /// ResourceDescriptor::default()/* use setters */,
10503 /// ResourceDescriptor::default()/* use (different) setters */,
10504 /// ]);
10505 /// ```
10506 pub fn set_byproducts<T, V>(mut self, v: T) -> Self
10507 where
10508 T: std::iter::IntoIterator<Item = V>,
10509 V: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor>,
10510 {
10511 use std::iter::Iterator;
10512 self.byproducts = v.into_iter().map(|i| i.into()).collect();
10513 self
10514 }
10515 }
10516
10517 impl wkt::message::Message for RunDetails {
10518 fn typename() -> &'static str {
10519 "type.googleapis.com/grafeas.v1.InTotoSlsaProvenanceV1.RunDetails"
10520 }
10521 }
10522
10523 #[derive(Clone, Default, PartialEq)]
10524 #[non_exhaustive]
10525 pub struct ProvenanceBuilder {
10526 pub id: std::string::String,
10527
10528 pub version: std::collections::HashMap<std::string::String, std::string::String>,
10529
10530 pub builder_dependencies:
10531 std::vec::Vec<crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor>,
10532
10533 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10534 }
10535
10536 impl ProvenanceBuilder {
10537 pub fn new() -> Self {
10538 std::default::Default::default()
10539 }
10540
10541 /// Sets the value of [id][crate::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder::id].
10542 ///
10543 /// # Example
10544 /// ```ignore,no_run
10545 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder;
10546 /// let x = ProvenanceBuilder::new().set_id("example");
10547 /// ```
10548 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10549 self.id = v.into();
10550 self
10551 }
10552
10553 /// Sets the value of [version][crate::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder::version].
10554 ///
10555 /// # Example
10556 /// ```ignore,no_run
10557 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder;
10558 /// let x = ProvenanceBuilder::new().set_version([
10559 /// ("key0", "abc"),
10560 /// ("key1", "xyz"),
10561 /// ]);
10562 /// ```
10563 pub fn set_version<T, K, V>(mut self, v: T) -> Self
10564 where
10565 T: std::iter::IntoIterator<Item = (K, V)>,
10566 K: std::convert::Into<std::string::String>,
10567 V: std::convert::Into<std::string::String>,
10568 {
10569 use std::iter::Iterator;
10570 self.version = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10571 self
10572 }
10573
10574 /// Sets the value of [builder_dependencies][crate::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder::builder_dependencies].
10575 ///
10576 /// # Example
10577 /// ```ignore,no_run
10578 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder;
10579 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ResourceDescriptor;
10580 /// let x = ProvenanceBuilder::new()
10581 /// .set_builder_dependencies([
10582 /// ResourceDescriptor::default()/* use setters */,
10583 /// ResourceDescriptor::default()/* use (different) setters */,
10584 /// ]);
10585 /// ```
10586 pub fn set_builder_dependencies<T, V>(mut self, v: T) -> Self
10587 where
10588 T: std::iter::IntoIterator<Item = V>,
10589 V: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor>,
10590 {
10591 use std::iter::Iterator;
10592 self.builder_dependencies = v.into_iter().map(|i| i.into()).collect();
10593 self
10594 }
10595 }
10596
10597 impl wkt::message::Message for ProvenanceBuilder {
10598 fn typename() -> &'static str {
10599 "type.googleapis.com/grafeas.v1.InTotoSlsaProvenanceV1.ProvenanceBuilder"
10600 }
10601 }
10602
10603 #[derive(Clone, Default, PartialEq)]
10604 #[non_exhaustive]
10605 pub struct BuildMetadata {
10606 pub invocation_id: std::string::String,
10607
10608 pub started_on: std::option::Option<wkt::Timestamp>,
10609
10610 pub finished_on: std::option::Option<wkt::Timestamp>,
10611
10612 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10613 }
10614
10615 impl BuildMetadata {
10616 pub fn new() -> Self {
10617 std::default::Default::default()
10618 }
10619
10620 /// Sets the value of [invocation_id][crate::model::in_toto_slsa_provenance_v_1::BuildMetadata::invocation_id].
10621 ///
10622 /// # Example
10623 /// ```ignore,no_run
10624 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildMetadata;
10625 /// let x = BuildMetadata::new().set_invocation_id("example");
10626 /// ```
10627 pub fn set_invocation_id<T: std::convert::Into<std::string::String>>(
10628 mut self,
10629 v: T,
10630 ) -> Self {
10631 self.invocation_id = v.into();
10632 self
10633 }
10634
10635 /// Sets the value of [started_on][crate::model::in_toto_slsa_provenance_v_1::BuildMetadata::started_on].
10636 ///
10637 /// # Example
10638 /// ```ignore,no_run
10639 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildMetadata;
10640 /// use wkt::Timestamp;
10641 /// let x = BuildMetadata::new().set_started_on(Timestamp::default()/* use setters */);
10642 /// ```
10643 pub fn set_started_on<T>(mut self, v: T) -> Self
10644 where
10645 T: std::convert::Into<wkt::Timestamp>,
10646 {
10647 self.started_on = std::option::Option::Some(v.into());
10648 self
10649 }
10650
10651 /// Sets or clears the value of [started_on][crate::model::in_toto_slsa_provenance_v_1::BuildMetadata::started_on].
10652 ///
10653 /// # Example
10654 /// ```ignore,no_run
10655 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildMetadata;
10656 /// use wkt::Timestamp;
10657 /// let x = BuildMetadata::new().set_or_clear_started_on(Some(Timestamp::default()/* use setters */));
10658 /// let x = BuildMetadata::new().set_or_clear_started_on(None::<Timestamp>);
10659 /// ```
10660 pub fn set_or_clear_started_on<T>(mut self, v: std::option::Option<T>) -> Self
10661 where
10662 T: std::convert::Into<wkt::Timestamp>,
10663 {
10664 self.started_on = v.map(|x| x.into());
10665 self
10666 }
10667
10668 /// Sets the value of [finished_on][crate::model::in_toto_slsa_provenance_v_1::BuildMetadata::finished_on].
10669 ///
10670 /// # Example
10671 /// ```ignore,no_run
10672 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildMetadata;
10673 /// use wkt::Timestamp;
10674 /// let x = BuildMetadata::new().set_finished_on(Timestamp::default()/* use setters */);
10675 /// ```
10676 pub fn set_finished_on<T>(mut self, v: T) -> Self
10677 where
10678 T: std::convert::Into<wkt::Timestamp>,
10679 {
10680 self.finished_on = std::option::Option::Some(v.into());
10681 self
10682 }
10683
10684 /// Sets or clears the value of [finished_on][crate::model::in_toto_slsa_provenance_v_1::BuildMetadata::finished_on].
10685 ///
10686 /// # Example
10687 /// ```ignore,no_run
10688 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildMetadata;
10689 /// use wkt::Timestamp;
10690 /// let x = BuildMetadata::new().set_or_clear_finished_on(Some(Timestamp::default()/* use setters */));
10691 /// let x = BuildMetadata::new().set_or_clear_finished_on(None::<Timestamp>);
10692 /// ```
10693 pub fn set_or_clear_finished_on<T>(mut self, v: std::option::Option<T>) -> Self
10694 where
10695 T: std::convert::Into<wkt::Timestamp>,
10696 {
10697 self.finished_on = v.map(|x| x.into());
10698 self
10699 }
10700 }
10701
10702 impl wkt::message::Message for BuildMetadata {
10703 fn typename() -> &'static str {
10704 "type.googleapis.com/grafeas.v1.InTotoSlsaProvenanceV1.BuildMetadata"
10705 }
10706 }
10707}
10708
10709/// This represents a particular channel of distribution for a given package.
10710/// E.g., Debian's jessie-backports dpkg mirror.
10711#[derive(Clone, Default, PartialEq)]
10712#[non_exhaustive]
10713pub struct Distribution {
10714 /// The cpe_uri in [CPE format](https://cpe.mitre.org/specification/)
10715 /// denoting the package manager version distributing a package.
10716 pub cpe_uri: std::string::String,
10717
10718 /// The CPU architecture for which packages in this distribution channel were
10719 /// built.
10720 pub architecture: crate::model::Architecture,
10721
10722 /// The latest available version of this package in this distribution channel.
10723 pub latest_version: std::option::Option<crate::model::Version>,
10724
10725 /// A freeform string denoting the maintainer of this package.
10726 pub maintainer: std::string::String,
10727
10728 /// The distribution channel-specific homepage for this package.
10729 pub url: std::string::String,
10730
10731 /// The distribution channel-specific description of this package.
10732 pub description: std::string::String,
10733
10734 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10735}
10736
10737impl Distribution {
10738 pub fn new() -> Self {
10739 std::default::Default::default()
10740 }
10741
10742 /// Sets the value of [cpe_uri][crate::model::Distribution::cpe_uri].
10743 ///
10744 /// # Example
10745 /// ```ignore,no_run
10746 /// # use google_cloud_grafeas_v1::model::Distribution;
10747 /// let x = Distribution::new().set_cpe_uri("example");
10748 /// ```
10749 pub fn set_cpe_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10750 self.cpe_uri = v.into();
10751 self
10752 }
10753
10754 /// Sets the value of [architecture][crate::model::Distribution::architecture].
10755 ///
10756 /// # Example
10757 /// ```ignore,no_run
10758 /// # use google_cloud_grafeas_v1::model::Distribution;
10759 /// use google_cloud_grafeas_v1::model::Architecture;
10760 /// let x0 = Distribution::new().set_architecture(Architecture::X86);
10761 /// let x1 = Distribution::new().set_architecture(Architecture::X64);
10762 /// ```
10763 pub fn set_architecture<T: std::convert::Into<crate::model::Architecture>>(
10764 mut self,
10765 v: T,
10766 ) -> Self {
10767 self.architecture = v.into();
10768 self
10769 }
10770
10771 /// Sets the value of [latest_version][crate::model::Distribution::latest_version].
10772 ///
10773 /// # Example
10774 /// ```ignore,no_run
10775 /// # use google_cloud_grafeas_v1::model::Distribution;
10776 /// use google_cloud_grafeas_v1::model::Version;
10777 /// let x = Distribution::new().set_latest_version(Version::default()/* use setters */);
10778 /// ```
10779 pub fn set_latest_version<T>(mut self, v: T) -> Self
10780 where
10781 T: std::convert::Into<crate::model::Version>,
10782 {
10783 self.latest_version = std::option::Option::Some(v.into());
10784 self
10785 }
10786
10787 /// Sets or clears the value of [latest_version][crate::model::Distribution::latest_version].
10788 ///
10789 /// # Example
10790 /// ```ignore,no_run
10791 /// # use google_cloud_grafeas_v1::model::Distribution;
10792 /// use google_cloud_grafeas_v1::model::Version;
10793 /// let x = Distribution::new().set_or_clear_latest_version(Some(Version::default()/* use setters */));
10794 /// let x = Distribution::new().set_or_clear_latest_version(None::<Version>);
10795 /// ```
10796 pub fn set_or_clear_latest_version<T>(mut self, v: std::option::Option<T>) -> Self
10797 where
10798 T: std::convert::Into<crate::model::Version>,
10799 {
10800 self.latest_version = v.map(|x| x.into());
10801 self
10802 }
10803
10804 /// Sets the value of [maintainer][crate::model::Distribution::maintainer].
10805 ///
10806 /// # Example
10807 /// ```ignore,no_run
10808 /// # use google_cloud_grafeas_v1::model::Distribution;
10809 /// let x = Distribution::new().set_maintainer("example");
10810 /// ```
10811 pub fn set_maintainer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10812 self.maintainer = v.into();
10813 self
10814 }
10815
10816 /// Sets the value of [url][crate::model::Distribution::url].
10817 ///
10818 /// # Example
10819 /// ```ignore,no_run
10820 /// # use google_cloud_grafeas_v1::model::Distribution;
10821 /// let x = Distribution::new().set_url("example");
10822 /// ```
10823 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10824 self.url = v.into();
10825 self
10826 }
10827
10828 /// Sets the value of [description][crate::model::Distribution::description].
10829 ///
10830 /// # Example
10831 /// ```ignore,no_run
10832 /// # use google_cloud_grafeas_v1::model::Distribution;
10833 /// let x = Distribution::new().set_description("example");
10834 /// ```
10835 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10836 self.description = v.into();
10837 self
10838 }
10839}
10840
10841impl wkt::message::Message for Distribution {
10842 fn typename() -> &'static str {
10843 "type.googleapis.com/grafeas.v1.Distribution"
10844 }
10845}
10846
10847/// An occurrence of a particular package installation found within a system's
10848/// filesystem. E.g., glibc was found in `/var/lib/dpkg/status`.
10849#[derive(Clone, Default, PartialEq)]
10850#[non_exhaustive]
10851pub struct Location {
10852 /// Deprecated.
10853 /// The CPE URI in [CPE format](https://cpe.mitre.org/specification/)
10854 pub cpe_uri: std::string::String,
10855
10856 /// Deprecated.
10857 /// The version installed at this location.
10858 pub version: std::option::Option<crate::model::Version>,
10859
10860 /// The path from which we gathered that this package/version is installed.
10861 pub path: std::string::String,
10862
10863 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10864}
10865
10866impl Location {
10867 pub fn new() -> Self {
10868 std::default::Default::default()
10869 }
10870
10871 /// Sets the value of [cpe_uri][crate::model::Location::cpe_uri].
10872 ///
10873 /// # Example
10874 /// ```ignore,no_run
10875 /// # use google_cloud_grafeas_v1::model::Location;
10876 /// let x = Location::new().set_cpe_uri("example");
10877 /// ```
10878 pub fn set_cpe_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10879 self.cpe_uri = v.into();
10880 self
10881 }
10882
10883 /// Sets the value of [version][crate::model::Location::version].
10884 ///
10885 /// # Example
10886 /// ```ignore,no_run
10887 /// # use google_cloud_grafeas_v1::model::Location;
10888 /// use google_cloud_grafeas_v1::model::Version;
10889 /// let x = Location::new().set_version(Version::default()/* use setters */);
10890 /// ```
10891 pub fn set_version<T>(mut self, v: T) -> Self
10892 where
10893 T: std::convert::Into<crate::model::Version>,
10894 {
10895 self.version = std::option::Option::Some(v.into());
10896 self
10897 }
10898
10899 /// Sets or clears the value of [version][crate::model::Location::version].
10900 ///
10901 /// # Example
10902 /// ```ignore,no_run
10903 /// # use google_cloud_grafeas_v1::model::Location;
10904 /// use google_cloud_grafeas_v1::model::Version;
10905 /// let x = Location::new().set_or_clear_version(Some(Version::default()/* use setters */));
10906 /// let x = Location::new().set_or_clear_version(None::<Version>);
10907 /// ```
10908 pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
10909 where
10910 T: std::convert::Into<crate::model::Version>,
10911 {
10912 self.version = v.map(|x| x.into());
10913 self
10914 }
10915
10916 /// Sets the value of [path][crate::model::Location::path].
10917 ///
10918 /// # Example
10919 /// ```ignore,no_run
10920 /// # use google_cloud_grafeas_v1::model::Location;
10921 /// let x = Location::new().set_path("example");
10922 /// ```
10923 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10924 self.path = v.into();
10925 self
10926 }
10927}
10928
10929impl wkt::message::Message for Location {
10930 fn typename() -> &'static str {
10931 "type.googleapis.com/grafeas.v1.Location"
10932 }
10933}
10934
10935/// PackageNote represents a particular package version.
10936#[derive(Clone, Default, PartialEq)]
10937#[non_exhaustive]
10938pub struct PackageNote {
10939 /// The name of the package.
10940 pub name: std::string::String,
10941
10942 /// Deprecated.
10943 /// The various channels by which a package is distributed.
10944 pub distribution: std::vec::Vec<crate::model::Distribution>,
10945
10946 /// The type of package; whether native or non native (e.g., ruby gems,
10947 /// node.js packages, etc.).
10948 pub package_type: std::string::String,
10949
10950 /// The cpe_uri in [CPE format](https://cpe.mitre.org/specification/)
10951 /// denoting the package manager version distributing a package.
10952 /// The cpe_uri will be blank for language packages.
10953 pub cpe_uri: std::string::String,
10954
10955 /// The CPU architecture for which packages in this distribution channel were
10956 /// built. Architecture will be blank for language packages.
10957 pub architecture: crate::model::Architecture,
10958
10959 /// The version of the package.
10960 pub version: std::option::Option<crate::model::Version>,
10961
10962 /// A freeform text denoting the maintainer of this package.
10963 pub maintainer: std::string::String,
10964
10965 /// The homepage for this package.
10966 pub url: std::string::String,
10967
10968 /// The description of this package.
10969 pub description: std::string::String,
10970
10971 /// Licenses that have been declared by the authors of the package.
10972 pub license: std::option::Option<crate::model::License>,
10973
10974 /// Hash value, typically a file digest, that allows unique
10975 /// identification a specific package.
10976 pub digest: std::vec::Vec<crate::model::Digest>,
10977
10978 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10979}
10980
10981impl PackageNote {
10982 pub fn new() -> Self {
10983 std::default::Default::default()
10984 }
10985
10986 /// Sets the value of [name][crate::model::PackageNote::name].
10987 ///
10988 /// # Example
10989 /// ```ignore,no_run
10990 /// # use google_cloud_grafeas_v1::model::PackageNote;
10991 /// let x = PackageNote::new().set_name("example");
10992 /// ```
10993 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10994 self.name = v.into();
10995 self
10996 }
10997
10998 /// Sets the value of [distribution][crate::model::PackageNote::distribution].
10999 ///
11000 /// # Example
11001 /// ```ignore,no_run
11002 /// # use google_cloud_grafeas_v1::model::PackageNote;
11003 /// use google_cloud_grafeas_v1::model::Distribution;
11004 /// let x = PackageNote::new()
11005 /// .set_distribution([
11006 /// Distribution::default()/* use setters */,
11007 /// Distribution::default()/* use (different) setters */,
11008 /// ]);
11009 /// ```
11010 pub fn set_distribution<T, V>(mut self, v: T) -> Self
11011 where
11012 T: std::iter::IntoIterator<Item = V>,
11013 V: std::convert::Into<crate::model::Distribution>,
11014 {
11015 use std::iter::Iterator;
11016 self.distribution = v.into_iter().map(|i| i.into()).collect();
11017 self
11018 }
11019
11020 /// Sets the value of [package_type][crate::model::PackageNote::package_type].
11021 ///
11022 /// # Example
11023 /// ```ignore,no_run
11024 /// # use google_cloud_grafeas_v1::model::PackageNote;
11025 /// let x = PackageNote::new().set_package_type("example");
11026 /// ```
11027 pub fn set_package_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11028 self.package_type = v.into();
11029 self
11030 }
11031
11032 /// Sets the value of [cpe_uri][crate::model::PackageNote::cpe_uri].
11033 ///
11034 /// # Example
11035 /// ```ignore,no_run
11036 /// # use google_cloud_grafeas_v1::model::PackageNote;
11037 /// let x = PackageNote::new().set_cpe_uri("example");
11038 /// ```
11039 pub fn set_cpe_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11040 self.cpe_uri = v.into();
11041 self
11042 }
11043
11044 /// Sets the value of [architecture][crate::model::PackageNote::architecture].
11045 ///
11046 /// # Example
11047 /// ```ignore,no_run
11048 /// # use google_cloud_grafeas_v1::model::PackageNote;
11049 /// use google_cloud_grafeas_v1::model::Architecture;
11050 /// let x0 = PackageNote::new().set_architecture(Architecture::X86);
11051 /// let x1 = PackageNote::new().set_architecture(Architecture::X64);
11052 /// ```
11053 pub fn set_architecture<T: std::convert::Into<crate::model::Architecture>>(
11054 mut self,
11055 v: T,
11056 ) -> Self {
11057 self.architecture = v.into();
11058 self
11059 }
11060
11061 /// Sets the value of [version][crate::model::PackageNote::version].
11062 ///
11063 /// # Example
11064 /// ```ignore,no_run
11065 /// # use google_cloud_grafeas_v1::model::PackageNote;
11066 /// use google_cloud_grafeas_v1::model::Version;
11067 /// let x = PackageNote::new().set_version(Version::default()/* use setters */);
11068 /// ```
11069 pub fn set_version<T>(mut self, v: T) -> Self
11070 where
11071 T: std::convert::Into<crate::model::Version>,
11072 {
11073 self.version = std::option::Option::Some(v.into());
11074 self
11075 }
11076
11077 /// Sets or clears the value of [version][crate::model::PackageNote::version].
11078 ///
11079 /// # Example
11080 /// ```ignore,no_run
11081 /// # use google_cloud_grafeas_v1::model::PackageNote;
11082 /// use google_cloud_grafeas_v1::model::Version;
11083 /// let x = PackageNote::new().set_or_clear_version(Some(Version::default()/* use setters */));
11084 /// let x = PackageNote::new().set_or_clear_version(None::<Version>);
11085 /// ```
11086 pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
11087 where
11088 T: std::convert::Into<crate::model::Version>,
11089 {
11090 self.version = v.map(|x| x.into());
11091 self
11092 }
11093
11094 /// Sets the value of [maintainer][crate::model::PackageNote::maintainer].
11095 ///
11096 /// # Example
11097 /// ```ignore,no_run
11098 /// # use google_cloud_grafeas_v1::model::PackageNote;
11099 /// let x = PackageNote::new().set_maintainer("example");
11100 /// ```
11101 pub fn set_maintainer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11102 self.maintainer = v.into();
11103 self
11104 }
11105
11106 /// Sets the value of [url][crate::model::PackageNote::url].
11107 ///
11108 /// # Example
11109 /// ```ignore,no_run
11110 /// # use google_cloud_grafeas_v1::model::PackageNote;
11111 /// let x = PackageNote::new().set_url("example");
11112 /// ```
11113 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11114 self.url = v.into();
11115 self
11116 }
11117
11118 /// Sets the value of [description][crate::model::PackageNote::description].
11119 ///
11120 /// # Example
11121 /// ```ignore,no_run
11122 /// # use google_cloud_grafeas_v1::model::PackageNote;
11123 /// let x = PackageNote::new().set_description("example");
11124 /// ```
11125 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11126 self.description = v.into();
11127 self
11128 }
11129
11130 /// Sets the value of [license][crate::model::PackageNote::license].
11131 ///
11132 /// # Example
11133 /// ```ignore,no_run
11134 /// # use google_cloud_grafeas_v1::model::PackageNote;
11135 /// use google_cloud_grafeas_v1::model::License;
11136 /// let x = PackageNote::new().set_license(License::default()/* use setters */);
11137 /// ```
11138 pub fn set_license<T>(mut self, v: T) -> Self
11139 where
11140 T: std::convert::Into<crate::model::License>,
11141 {
11142 self.license = std::option::Option::Some(v.into());
11143 self
11144 }
11145
11146 /// Sets or clears the value of [license][crate::model::PackageNote::license].
11147 ///
11148 /// # Example
11149 /// ```ignore,no_run
11150 /// # use google_cloud_grafeas_v1::model::PackageNote;
11151 /// use google_cloud_grafeas_v1::model::License;
11152 /// let x = PackageNote::new().set_or_clear_license(Some(License::default()/* use setters */));
11153 /// let x = PackageNote::new().set_or_clear_license(None::<License>);
11154 /// ```
11155 pub fn set_or_clear_license<T>(mut self, v: std::option::Option<T>) -> Self
11156 where
11157 T: std::convert::Into<crate::model::License>,
11158 {
11159 self.license = v.map(|x| x.into());
11160 self
11161 }
11162
11163 /// Sets the value of [digest][crate::model::PackageNote::digest].
11164 ///
11165 /// # Example
11166 /// ```ignore,no_run
11167 /// # use google_cloud_grafeas_v1::model::PackageNote;
11168 /// use google_cloud_grafeas_v1::model::Digest;
11169 /// let x = PackageNote::new()
11170 /// .set_digest([
11171 /// Digest::default()/* use setters */,
11172 /// Digest::default()/* use (different) setters */,
11173 /// ]);
11174 /// ```
11175 pub fn set_digest<T, V>(mut self, v: T) -> Self
11176 where
11177 T: std::iter::IntoIterator<Item = V>,
11178 V: std::convert::Into<crate::model::Digest>,
11179 {
11180 use std::iter::Iterator;
11181 self.digest = v.into_iter().map(|i| i.into()).collect();
11182 self
11183 }
11184}
11185
11186impl wkt::message::Message for PackageNote {
11187 fn typename() -> &'static str {
11188 "type.googleapis.com/grafeas.v1.PackageNote"
11189 }
11190}
11191
11192/// Details on how a particular software package was installed on a system.
11193#[derive(Clone, Default, PartialEq)]
11194#[non_exhaustive]
11195pub struct PackageOccurrence {
11196 /// The name of the installed package.
11197 pub name: std::string::String,
11198
11199 /// All of the places within the filesystem versions of this package
11200 /// have been found.
11201 pub location: std::vec::Vec<crate::model::Location>,
11202
11203 /// The type of package; whether native or non native (e.g., ruby gems,
11204 /// node.js packages, etc.).
11205 pub package_type: std::string::String,
11206
11207 /// The cpe_uri in [CPE format](https://cpe.mitre.org/specification/)
11208 /// denoting the package manager version distributing a package.
11209 /// The cpe_uri will be blank for language packages.
11210 pub cpe_uri: std::string::String,
11211
11212 /// The CPU architecture for which packages in this distribution channel were
11213 /// built. Architecture will be blank for language packages.
11214 pub architecture: crate::model::Architecture,
11215
11216 /// Licenses that have been declared by the authors of the package.
11217 pub license: std::option::Option<crate::model::License>,
11218
11219 /// The version of the package.
11220 pub version: std::option::Option<crate::model::Version>,
11221
11222 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11223}
11224
11225impl PackageOccurrence {
11226 pub fn new() -> Self {
11227 std::default::Default::default()
11228 }
11229
11230 /// Sets the value of [name][crate::model::PackageOccurrence::name].
11231 ///
11232 /// # Example
11233 /// ```ignore,no_run
11234 /// # use google_cloud_grafeas_v1::model::PackageOccurrence;
11235 /// let x = PackageOccurrence::new().set_name("example");
11236 /// ```
11237 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11238 self.name = v.into();
11239 self
11240 }
11241
11242 /// Sets the value of [location][crate::model::PackageOccurrence::location].
11243 ///
11244 /// # Example
11245 /// ```ignore,no_run
11246 /// # use google_cloud_grafeas_v1::model::PackageOccurrence;
11247 /// use google_cloud_grafeas_v1::model::Location;
11248 /// let x = PackageOccurrence::new()
11249 /// .set_location([
11250 /// Location::default()/* use setters */,
11251 /// Location::default()/* use (different) setters */,
11252 /// ]);
11253 /// ```
11254 pub fn set_location<T, V>(mut self, v: T) -> Self
11255 where
11256 T: std::iter::IntoIterator<Item = V>,
11257 V: std::convert::Into<crate::model::Location>,
11258 {
11259 use std::iter::Iterator;
11260 self.location = v.into_iter().map(|i| i.into()).collect();
11261 self
11262 }
11263
11264 /// Sets the value of [package_type][crate::model::PackageOccurrence::package_type].
11265 ///
11266 /// # Example
11267 /// ```ignore,no_run
11268 /// # use google_cloud_grafeas_v1::model::PackageOccurrence;
11269 /// let x = PackageOccurrence::new().set_package_type("example");
11270 /// ```
11271 pub fn set_package_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11272 self.package_type = v.into();
11273 self
11274 }
11275
11276 /// Sets the value of [cpe_uri][crate::model::PackageOccurrence::cpe_uri].
11277 ///
11278 /// # Example
11279 /// ```ignore,no_run
11280 /// # use google_cloud_grafeas_v1::model::PackageOccurrence;
11281 /// let x = PackageOccurrence::new().set_cpe_uri("example");
11282 /// ```
11283 pub fn set_cpe_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11284 self.cpe_uri = v.into();
11285 self
11286 }
11287
11288 /// Sets the value of [architecture][crate::model::PackageOccurrence::architecture].
11289 ///
11290 /// # Example
11291 /// ```ignore,no_run
11292 /// # use google_cloud_grafeas_v1::model::PackageOccurrence;
11293 /// use google_cloud_grafeas_v1::model::Architecture;
11294 /// let x0 = PackageOccurrence::new().set_architecture(Architecture::X86);
11295 /// let x1 = PackageOccurrence::new().set_architecture(Architecture::X64);
11296 /// ```
11297 pub fn set_architecture<T: std::convert::Into<crate::model::Architecture>>(
11298 mut self,
11299 v: T,
11300 ) -> Self {
11301 self.architecture = v.into();
11302 self
11303 }
11304
11305 /// Sets the value of [license][crate::model::PackageOccurrence::license].
11306 ///
11307 /// # Example
11308 /// ```ignore,no_run
11309 /// # use google_cloud_grafeas_v1::model::PackageOccurrence;
11310 /// use google_cloud_grafeas_v1::model::License;
11311 /// let x = PackageOccurrence::new().set_license(License::default()/* use setters */);
11312 /// ```
11313 pub fn set_license<T>(mut self, v: T) -> Self
11314 where
11315 T: std::convert::Into<crate::model::License>,
11316 {
11317 self.license = std::option::Option::Some(v.into());
11318 self
11319 }
11320
11321 /// Sets or clears the value of [license][crate::model::PackageOccurrence::license].
11322 ///
11323 /// # Example
11324 /// ```ignore,no_run
11325 /// # use google_cloud_grafeas_v1::model::PackageOccurrence;
11326 /// use google_cloud_grafeas_v1::model::License;
11327 /// let x = PackageOccurrence::new().set_or_clear_license(Some(License::default()/* use setters */));
11328 /// let x = PackageOccurrence::new().set_or_clear_license(None::<License>);
11329 /// ```
11330 pub fn set_or_clear_license<T>(mut self, v: std::option::Option<T>) -> Self
11331 where
11332 T: std::convert::Into<crate::model::License>,
11333 {
11334 self.license = v.map(|x| x.into());
11335 self
11336 }
11337
11338 /// Sets the value of [version][crate::model::PackageOccurrence::version].
11339 ///
11340 /// # Example
11341 /// ```ignore,no_run
11342 /// # use google_cloud_grafeas_v1::model::PackageOccurrence;
11343 /// use google_cloud_grafeas_v1::model::Version;
11344 /// let x = PackageOccurrence::new().set_version(Version::default()/* use setters */);
11345 /// ```
11346 pub fn set_version<T>(mut self, v: T) -> Self
11347 where
11348 T: std::convert::Into<crate::model::Version>,
11349 {
11350 self.version = std::option::Option::Some(v.into());
11351 self
11352 }
11353
11354 /// Sets or clears the value of [version][crate::model::PackageOccurrence::version].
11355 ///
11356 /// # Example
11357 /// ```ignore,no_run
11358 /// # use google_cloud_grafeas_v1::model::PackageOccurrence;
11359 /// use google_cloud_grafeas_v1::model::Version;
11360 /// let x = PackageOccurrence::new().set_or_clear_version(Some(Version::default()/* use setters */));
11361 /// let x = PackageOccurrence::new().set_or_clear_version(None::<Version>);
11362 /// ```
11363 pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
11364 where
11365 T: std::convert::Into<crate::model::Version>,
11366 {
11367 self.version = v.map(|x| x.into());
11368 self
11369 }
11370}
11371
11372impl wkt::message::Message for PackageOccurrence {
11373 fn typename() -> &'static str {
11374 "type.googleapis.com/grafeas.v1.PackageOccurrence"
11375 }
11376}
11377
11378/// Version contains structured information about the version of a package.
11379#[derive(Clone, Default, PartialEq)]
11380#[non_exhaustive]
11381pub struct Version {
11382 /// Used to correct mistakes in the version numbering scheme.
11383 pub epoch: i32,
11384
11385 /// Required only when version kind is NORMAL. The main part of the version
11386 /// name.
11387 pub name: std::string::String,
11388
11389 /// The iteration of the package build from the above version.
11390 pub revision: std::string::String,
11391
11392 /// Whether this version is specifying part of an inclusive range. Grafeas
11393 /// does not have the capability to specify version ranges; instead we have
11394 /// fields that specify start version and end versions. At times this is
11395 /// insufficient - we also need to specify whether the version is included in
11396 /// the range or is excluded from the range. This boolean is expected to be set
11397 /// to true when the version is included in a range.
11398 pub inclusive: bool,
11399
11400 /// Required. Distinguishes between sentinel MIN/MAX versions and normal
11401 /// versions.
11402 pub kind: crate::model::version::VersionKind,
11403
11404 /// Human readable version string. This string is of the form
11405 /// \<epoch\>:\<name\>-\<revision\> and is only set when kind is NORMAL.
11406 pub full_name: std::string::String,
11407
11408 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11409}
11410
11411impl Version {
11412 pub fn new() -> Self {
11413 std::default::Default::default()
11414 }
11415
11416 /// Sets the value of [epoch][crate::model::Version::epoch].
11417 ///
11418 /// # Example
11419 /// ```ignore,no_run
11420 /// # use google_cloud_grafeas_v1::model::Version;
11421 /// let x = Version::new().set_epoch(42);
11422 /// ```
11423 pub fn set_epoch<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11424 self.epoch = v.into();
11425 self
11426 }
11427
11428 /// Sets the value of [name][crate::model::Version::name].
11429 ///
11430 /// # Example
11431 /// ```ignore,no_run
11432 /// # use google_cloud_grafeas_v1::model::Version;
11433 /// let x = Version::new().set_name("example");
11434 /// ```
11435 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11436 self.name = v.into();
11437 self
11438 }
11439
11440 /// Sets the value of [revision][crate::model::Version::revision].
11441 ///
11442 /// # Example
11443 /// ```ignore,no_run
11444 /// # use google_cloud_grafeas_v1::model::Version;
11445 /// let x = Version::new().set_revision("example");
11446 /// ```
11447 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11448 self.revision = v.into();
11449 self
11450 }
11451
11452 /// Sets the value of [inclusive][crate::model::Version::inclusive].
11453 ///
11454 /// # Example
11455 /// ```ignore,no_run
11456 /// # use google_cloud_grafeas_v1::model::Version;
11457 /// let x = Version::new().set_inclusive(true);
11458 /// ```
11459 pub fn set_inclusive<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11460 self.inclusive = v.into();
11461 self
11462 }
11463
11464 /// Sets the value of [kind][crate::model::Version::kind].
11465 ///
11466 /// # Example
11467 /// ```ignore,no_run
11468 /// # use google_cloud_grafeas_v1::model::Version;
11469 /// use google_cloud_grafeas_v1::model::version::VersionKind;
11470 /// let x0 = Version::new().set_kind(VersionKind::Normal);
11471 /// let x1 = Version::new().set_kind(VersionKind::Minimum);
11472 /// let x2 = Version::new().set_kind(VersionKind::Maximum);
11473 /// ```
11474 pub fn set_kind<T: std::convert::Into<crate::model::version::VersionKind>>(
11475 mut self,
11476 v: T,
11477 ) -> Self {
11478 self.kind = v.into();
11479 self
11480 }
11481
11482 /// Sets the value of [full_name][crate::model::Version::full_name].
11483 ///
11484 /// # Example
11485 /// ```ignore,no_run
11486 /// # use google_cloud_grafeas_v1::model::Version;
11487 /// let x = Version::new().set_full_name("example");
11488 /// ```
11489 pub fn set_full_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11490 self.full_name = v.into();
11491 self
11492 }
11493}
11494
11495impl wkt::message::Message for Version {
11496 fn typename() -> &'static str {
11497 "type.googleapis.com/grafeas.v1.Version"
11498 }
11499}
11500
11501/// Defines additional types related to [Version].
11502pub mod version {
11503 #[allow(unused_imports)]
11504 use super::*;
11505
11506 /// Whether this is an ordinary package version or a sentinel MIN/MAX version.
11507 ///
11508 /// # Working with unknown values
11509 ///
11510 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11511 /// additional enum variants at any time. Adding new variants is not considered
11512 /// a breaking change. Applications should write their code in anticipation of:
11513 ///
11514 /// - New values appearing in future releases of the client library, **and**
11515 /// - New values received dynamically, without application changes.
11516 ///
11517 /// Please consult the [Working with enums] section in the user guide for some
11518 /// guidelines.
11519 ///
11520 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11521 #[derive(Clone, Debug, PartialEq)]
11522 #[non_exhaustive]
11523 pub enum VersionKind {
11524 /// Unknown.
11525 Unspecified,
11526 /// A standard package version.
11527 Normal,
11528 /// A special version representing negative infinity.
11529 Minimum,
11530 /// A special version representing positive infinity.
11531 Maximum,
11532 /// If set, the enum was initialized with an unknown value.
11533 ///
11534 /// Applications can examine the value using [VersionKind::value] or
11535 /// [VersionKind::name].
11536 UnknownValue(version_kind::UnknownValue),
11537 }
11538
11539 #[doc(hidden)]
11540 pub mod version_kind {
11541 #[allow(unused_imports)]
11542 use super::*;
11543 #[derive(Clone, Debug, PartialEq)]
11544 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11545 }
11546
11547 impl VersionKind {
11548 /// Gets the enum value.
11549 ///
11550 /// Returns `None` if the enum contains an unknown value deserialized from
11551 /// the string representation of enums.
11552 pub fn value(&self) -> std::option::Option<i32> {
11553 match self {
11554 Self::Unspecified => std::option::Option::Some(0),
11555 Self::Normal => std::option::Option::Some(1),
11556 Self::Minimum => std::option::Option::Some(2),
11557 Self::Maximum => std::option::Option::Some(3),
11558 Self::UnknownValue(u) => u.0.value(),
11559 }
11560 }
11561
11562 /// Gets the enum value as a string.
11563 ///
11564 /// Returns `None` if the enum contains an unknown value deserialized from
11565 /// the integer representation of enums.
11566 pub fn name(&self) -> std::option::Option<&str> {
11567 match self {
11568 Self::Unspecified => std::option::Option::Some("VERSION_KIND_UNSPECIFIED"),
11569 Self::Normal => std::option::Option::Some("NORMAL"),
11570 Self::Minimum => std::option::Option::Some("MINIMUM"),
11571 Self::Maximum => std::option::Option::Some("MAXIMUM"),
11572 Self::UnknownValue(u) => u.0.name(),
11573 }
11574 }
11575 }
11576
11577 impl std::default::Default for VersionKind {
11578 fn default() -> Self {
11579 use std::convert::From;
11580 Self::from(0)
11581 }
11582 }
11583
11584 impl std::fmt::Display for VersionKind {
11585 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11586 wkt::internal::display_enum(f, self.name(), self.value())
11587 }
11588 }
11589
11590 impl std::convert::From<i32> for VersionKind {
11591 fn from(value: i32) -> Self {
11592 match value {
11593 0 => Self::Unspecified,
11594 1 => Self::Normal,
11595 2 => Self::Minimum,
11596 3 => Self::Maximum,
11597 _ => Self::UnknownValue(version_kind::UnknownValue(
11598 wkt::internal::UnknownEnumValue::Integer(value),
11599 )),
11600 }
11601 }
11602 }
11603
11604 impl std::convert::From<&str> for VersionKind {
11605 fn from(value: &str) -> Self {
11606 use std::string::ToString;
11607 match value {
11608 "VERSION_KIND_UNSPECIFIED" => Self::Unspecified,
11609 "NORMAL" => Self::Normal,
11610 "MINIMUM" => Self::Minimum,
11611 "MAXIMUM" => Self::Maximum,
11612 _ => Self::UnknownValue(version_kind::UnknownValue(
11613 wkt::internal::UnknownEnumValue::String(value.to_string()),
11614 )),
11615 }
11616 }
11617 }
11618
11619 impl serde::ser::Serialize for VersionKind {
11620 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11621 where
11622 S: serde::Serializer,
11623 {
11624 match self {
11625 Self::Unspecified => serializer.serialize_i32(0),
11626 Self::Normal => serializer.serialize_i32(1),
11627 Self::Minimum => serializer.serialize_i32(2),
11628 Self::Maximum => serializer.serialize_i32(3),
11629 Self::UnknownValue(u) => u.0.serialize(serializer),
11630 }
11631 }
11632 }
11633
11634 impl<'de> serde::de::Deserialize<'de> for VersionKind {
11635 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11636 where
11637 D: serde::Deserializer<'de>,
11638 {
11639 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VersionKind>::new(
11640 ".grafeas.v1.Version.VersionKind",
11641 ))
11642 }
11643 }
11644}
11645
11646/// Provenance of a build. Contains all information needed to verify the full
11647/// details about the build from source to completion.
11648#[derive(Clone, Default, PartialEq)]
11649#[non_exhaustive]
11650pub struct BuildProvenance {
11651 /// Required. Unique identifier of the build.
11652 pub id: std::string::String,
11653
11654 /// ID of the project.
11655 pub project_id: std::string::String,
11656
11657 /// Commands requested by the build.
11658 pub commands: std::vec::Vec<crate::model::Command>,
11659
11660 /// Output of the build.
11661 pub built_artifacts: std::vec::Vec<crate::model::Artifact>,
11662
11663 /// Time at which the build was created.
11664 pub create_time: std::option::Option<wkt::Timestamp>,
11665
11666 /// Time at which execution of the build was started.
11667 pub start_time: std::option::Option<wkt::Timestamp>,
11668
11669 /// Time at which execution of the build was finished.
11670 pub end_time: std::option::Option<wkt::Timestamp>,
11671
11672 /// E-mail address of the user who initiated this build. Note that this was the
11673 /// user's e-mail address at the time the build was initiated; this address may
11674 /// not represent the same end-user for all time.
11675 pub creator: std::string::String,
11676
11677 /// URI where any logs for this provenance were written.
11678 pub logs_uri: std::string::String,
11679
11680 /// Details of the Source input to the build.
11681 pub source_provenance: std::option::Option<crate::model::Source>,
11682
11683 /// Trigger identifier if the build was triggered automatically; empty if not.
11684 pub trigger_id: std::string::String,
11685
11686 /// Special options applied to this build. This is a catch-all field where
11687 /// build providers can enter any desired additional details.
11688 pub build_options: std::collections::HashMap<std::string::String, std::string::String>,
11689
11690 /// Version string of the builder at the time this build was executed.
11691 pub builder_version: std::string::String,
11692
11693 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11694}
11695
11696impl BuildProvenance {
11697 pub fn new() -> Self {
11698 std::default::Default::default()
11699 }
11700
11701 /// Sets the value of [id][crate::model::BuildProvenance::id].
11702 ///
11703 /// # Example
11704 /// ```ignore,no_run
11705 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11706 /// let x = BuildProvenance::new().set_id("example");
11707 /// ```
11708 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11709 self.id = v.into();
11710 self
11711 }
11712
11713 /// Sets the value of [project_id][crate::model::BuildProvenance::project_id].
11714 ///
11715 /// # Example
11716 /// ```ignore,no_run
11717 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11718 /// let x = BuildProvenance::new().set_project_id("example");
11719 /// ```
11720 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11721 self.project_id = v.into();
11722 self
11723 }
11724
11725 /// Sets the value of [commands][crate::model::BuildProvenance::commands].
11726 ///
11727 /// # Example
11728 /// ```ignore,no_run
11729 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11730 /// use google_cloud_grafeas_v1::model::Command;
11731 /// let x = BuildProvenance::new()
11732 /// .set_commands([
11733 /// Command::default()/* use setters */,
11734 /// Command::default()/* use (different) setters */,
11735 /// ]);
11736 /// ```
11737 pub fn set_commands<T, V>(mut self, v: T) -> Self
11738 where
11739 T: std::iter::IntoIterator<Item = V>,
11740 V: std::convert::Into<crate::model::Command>,
11741 {
11742 use std::iter::Iterator;
11743 self.commands = v.into_iter().map(|i| i.into()).collect();
11744 self
11745 }
11746
11747 /// Sets the value of [built_artifacts][crate::model::BuildProvenance::built_artifacts].
11748 ///
11749 /// # Example
11750 /// ```ignore,no_run
11751 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11752 /// use google_cloud_grafeas_v1::model::Artifact;
11753 /// let x = BuildProvenance::new()
11754 /// .set_built_artifacts([
11755 /// Artifact::default()/* use setters */,
11756 /// Artifact::default()/* use (different) setters */,
11757 /// ]);
11758 /// ```
11759 pub fn set_built_artifacts<T, V>(mut self, v: T) -> Self
11760 where
11761 T: std::iter::IntoIterator<Item = V>,
11762 V: std::convert::Into<crate::model::Artifact>,
11763 {
11764 use std::iter::Iterator;
11765 self.built_artifacts = v.into_iter().map(|i| i.into()).collect();
11766 self
11767 }
11768
11769 /// Sets the value of [create_time][crate::model::BuildProvenance::create_time].
11770 ///
11771 /// # Example
11772 /// ```ignore,no_run
11773 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11774 /// use wkt::Timestamp;
11775 /// let x = BuildProvenance::new().set_create_time(Timestamp::default()/* use setters */);
11776 /// ```
11777 pub fn set_create_time<T>(mut self, v: T) -> Self
11778 where
11779 T: std::convert::Into<wkt::Timestamp>,
11780 {
11781 self.create_time = std::option::Option::Some(v.into());
11782 self
11783 }
11784
11785 /// Sets or clears the value of [create_time][crate::model::BuildProvenance::create_time].
11786 ///
11787 /// # Example
11788 /// ```ignore,no_run
11789 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11790 /// use wkt::Timestamp;
11791 /// let x = BuildProvenance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11792 /// let x = BuildProvenance::new().set_or_clear_create_time(None::<Timestamp>);
11793 /// ```
11794 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11795 where
11796 T: std::convert::Into<wkt::Timestamp>,
11797 {
11798 self.create_time = v.map(|x| x.into());
11799 self
11800 }
11801
11802 /// Sets the value of [start_time][crate::model::BuildProvenance::start_time].
11803 ///
11804 /// # Example
11805 /// ```ignore,no_run
11806 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11807 /// use wkt::Timestamp;
11808 /// let x = BuildProvenance::new().set_start_time(Timestamp::default()/* use setters */);
11809 /// ```
11810 pub fn set_start_time<T>(mut self, v: T) -> Self
11811 where
11812 T: std::convert::Into<wkt::Timestamp>,
11813 {
11814 self.start_time = std::option::Option::Some(v.into());
11815 self
11816 }
11817
11818 /// Sets or clears the value of [start_time][crate::model::BuildProvenance::start_time].
11819 ///
11820 /// # Example
11821 /// ```ignore,no_run
11822 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11823 /// use wkt::Timestamp;
11824 /// let x = BuildProvenance::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
11825 /// let x = BuildProvenance::new().set_or_clear_start_time(None::<Timestamp>);
11826 /// ```
11827 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
11828 where
11829 T: std::convert::Into<wkt::Timestamp>,
11830 {
11831 self.start_time = v.map(|x| x.into());
11832 self
11833 }
11834
11835 /// Sets the value of [end_time][crate::model::BuildProvenance::end_time].
11836 ///
11837 /// # Example
11838 /// ```ignore,no_run
11839 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11840 /// use wkt::Timestamp;
11841 /// let x = BuildProvenance::new().set_end_time(Timestamp::default()/* use setters */);
11842 /// ```
11843 pub fn set_end_time<T>(mut self, v: T) -> Self
11844 where
11845 T: std::convert::Into<wkt::Timestamp>,
11846 {
11847 self.end_time = std::option::Option::Some(v.into());
11848 self
11849 }
11850
11851 /// Sets or clears the value of [end_time][crate::model::BuildProvenance::end_time].
11852 ///
11853 /// # Example
11854 /// ```ignore,no_run
11855 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11856 /// use wkt::Timestamp;
11857 /// let x = BuildProvenance::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
11858 /// let x = BuildProvenance::new().set_or_clear_end_time(None::<Timestamp>);
11859 /// ```
11860 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
11861 where
11862 T: std::convert::Into<wkt::Timestamp>,
11863 {
11864 self.end_time = v.map(|x| x.into());
11865 self
11866 }
11867
11868 /// Sets the value of [creator][crate::model::BuildProvenance::creator].
11869 ///
11870 /// # Example
11871 /// ```ignore,no_run
11872 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11873 /// let x = BuildProvenance::new().set_creator("example");
11874 /// ```
11875 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11876 self.creator = v.into();
11877 self
11878 }
11879
11880 /// Sets the value of [logs_uri][crate::model::BuildProvenance::logs_uri].
11881 ///
11882 /// # Example
11883 /// ```ignore,no_run
11884 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11885 /// let x = BuildProvenance::new().set_logs_uri("example");
11886 /// ```
11887 pub fn set_logs_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11888 self.logs_uri = v.into();
11889 self
11890 }
11891
11892 /// Sets the value of [source_provenance][crate::model::BuildProvenance::source_provenance].
11893 ///
11894 /// # Example
11895 /// ```ignore,no_run
11896 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11897 /// use google_cloud_grafeas_v1::model::Source;
11898 /// let x = BuildProvenance::new().set_source_provenance(Source::default()/* use setters */);
11899 /// ```
11900 pub fn set_source_provenance<T>(mut self, v: T) -> Self
11901 where
11902 T: std::convert::Into<crate::model::Source>,
11903 {
11904 self.source_provenance = std::option::Option::Some(v.into());
11905 self
11906 }
11907
11908 /// Sets or clears the value of [source_provenance][crate::model::BuildProvenance::source_provenance].
11909 ///
11910 /// # Example
11911 /// ```ignore,no_run
11912 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11913 /// use google_cloud_grafeas_v1::model::Source;
11914 /// let x = BuildProvenance::new().set_or_clear_source_provenance(Some(Source::default()/* use setters */));
11915 /// let x = BuildProvenance::new().set_or_clear_source_provenance(None::<Source>);
11916 /// ```
11917 pub fn set_or_clear_source_provenance<T>(mut self, v: std::option::Option<T>) -> Self
11918 where
11919 T: std::convert::Into<crate::model::Source>,
11920 {
11921 self.source_provenance = v.map(|x| x.into());
11922 self
11923 }
11924
11925 /// Sets the value of [trigger_id][crate::model::BuildProvenance::trigger_id].
11926 ///
11927 /// # Example
11928 /// ```ignore,no_run
11929 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11930 /// let x = BuildProvenance::new().set_trigger_id("example");
11931 /// ```
11932 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11933 self.trigger_id = v.into();
11934 self
11935 }
11936
11937 /// Sets the value of [build_options][crate::model::BuildProvenance::build_options].
11938 ///
11939 /// # Example
11940 /// ```ignore,no_run
11941 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11942 /// let x = BuildProvenance::new().set_build_options([
11943 /// ("key0", "abc"),
11944 /// ("key1", "xyz"),
11945 /// ]);
11946 /// ```
11947 pub fn set_build_options<T, K, V>(mut self, v: T) -> Self
11948 where
11949 T: std::iter::IntoIterator<Item = (K, V)>,
11950 K: std::convert::Into<std::string::String>,
11951 V: std::convert::Into<std::string::String>,
11952 {
11953 use std::iter::Iterator;
11954 self.build_options = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11955 self
11956 }
11957
11958 /// Sets the value of [builder_version][crate::model::BuildProvenance::builder_version].
11959 ///
11960 /// # Example
11961 /// ```ignore,no_run
11962 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11963 /// let x = BuildProvenance::new().set_builder_version("example");
11964 /// ```
11965 pub fn set_builder_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11966 self.builder_version = v.into();
11967 self
11968 }
11969}
11970
11971impl wkt::message::Message for BuildProvenance {
11972 fn typename() -> &'static str {
11973 "type.googleapis.com/grafeas.v1.BuildProvenance"
11974 }
11975}
11976
11977/// Source describes the location of the source used for the build.
11978#[derive(Clone, Default, PartialEq)]
11979#[non_exhaustive]
11980pub struct Source {
11981 /// If provided, the input binary artifacts for the build came from this
11982 /// location.
11983 pub artifact_storage_source_uri: std::string::String,
11984
11985 /// Hash(es) of the build source, which can be used to verify that the original
11986 /// source integrity was maintained in the build.
11987 ///
11988 /// The keys to this map are file paths used as build source and the values
11989 /// contain the hash values for those files.
11990 ///
11991 /// If the build source came in a single package such as a gzipped tarfile
11992 /// (.tar.gz), the FileHash will be for the single path to that file.
11993 pub file_hashes: std::collections::HashMap<std::string::String, crate::model::FileHashes>,
11994
11995 /// If provided, the source code used for the build came from this location.
11996 pub context: std::option::Option<crate::model::SourceContext>,
11997
11998 /// If provided, some of the source code used for the build may be found in
11999 /// these locations, in the case where the source repository had multiple
12000 /// remotes or submodules. This list will not include the context specified in
12001 /// the context field.
12002 pub additional_contexts: std::vec::Vec<crate::model::SourceContext>,
12003
12004 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12005}
12006
12007impl Source {
12008 pub fn new() -> Self {
12009 std::default::Default::default()
12010 }
12011
12012 /// Sets the value of [artifact_storage_source_uri][crate::model::Source::artifact_storage_source_uri].
12013 ///
12014 /// # Example
12015 /// ```ignore,no_run
12016 /// # use google_cloud_grafeas_v1::model::Source;
12017 /// let x = Source::new().set_artifact_storage_source_uri("example");
12018 /// ```
12019 pub fn set_artifact_storage_source_uri<T: std::convert::Into<std::string::String>>(
12020 mut self,
12021 v: T,
12022 ) -> Self {
12023 self.artifact_storage_source_uri = v.into();
12024 self
12025 }
12026
12027 /// Sets the value of [file_hashes][crate::model::Source::file_hashes].
12028 ///
12029 /// # Example
12030 /// ```ignore,no_run
12031 /// # use google_cloud_grafeas_v1::model::Source;
12032 /// use google_cloud_grafeas_v1::model::FileHashes;
12033 /// let x = Source::new().set_file_hashes([
12034 /// ("key0", FileHashes::default()/* use setters */),
12035 /// ("key1", FileHashes::default()/* use (different) setters */),
12036 /// ]);
12037 /// ```
12038 pub fn set_file_hashes<T, K, V>(mut self, v: T) -> Self
12039 where
12040 T: std::iter::IntoIterator<Item = (K, V)>,
12041 K: std::convert::Into<std::string::String>,
12042 V: std::convert::Into<crate::model::FileHashes>,
12043 {
12044 use std::iter::Iterator;
12045 self.file_hashes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12046 self
12047 }
12048
12049 /// Sets the value of [context][crate::model::Source::context].
12050 ///
12051 /// # Example
12052 /// ```ignore,no_run
12053 /// # use google_cloud_grafeas_v1::model::Source;
12054 /// use google_cloud_grafeas_v1::model::SourceContext;
12055 /// let x = Source::new().set_context(SourceContext::default()/* use setters */);
12056 /// ```
12057 pub fn set_context<T>(mut self, v: T) -> Self
12058 where
12059 T: std::convert::Into<crate::model::SourceContext>,
12060 {
12061 self.context = std::option::Option::Some(v.into());
12062 self
12063 }
12064
12065 /// Sets or clears the value of [context][crate::model::Source::context].
12066 ///
12067 /// # Example
12068 /// ```ignore,no_run
12069 /// # use google_cloud_grafeas_v1::model::Source;
12070 /// use google_cloud_grafeas_v1::model::SourceContext;
12071 /// let x = Source::new().set_or_clear_context(Some(SourceContext::default()/* use setters */));
12072 /// let x = Source::new().set_or_clear_context(None::<SourceContext>);
12073 /// ```
12074 pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
12075 where
12076 T: std::convert::Into<crate::model::SourceContext>,
12077 {
12078 self.context = v.map(|x| x.into());
12079 self
12080 }
12081
12082 /// Sets the value of [additional_contexts][crate::model::Source::additional_contexts].
12083 ///
12084 /// # Example
12085 /// ```ignore,no_run
12086 /// # use google_cloud_grafeas_v1::model::Source;
12087 /// use google_cloud_grafeas_v1::model::SourceContext;
12088 /// let x = Source::new()
12089 /// .set_additional_contexts([
12090 /// SourceContext::default()/* use setters */,
12091 /// SourceContext::default()/* use (different) setters */,
12092 /// ]);
12093 /// ```
12094 pub fn set_additional_contexts<T, V>(mut self, v: T) -> Self
12095 where
12096 T: std::iter::IntoIterator<Item = V>,
12097 V: std::convert::Into<crate::model::SourceContext>,
12098 {
12099 use std::iter::Iterator;
12100 self.additional_contexts = v.into_iter().map(|i| i.into()).collect();
12101 self
12102 }
12103}
12104
12105impl wkt::message::Message for Source {
12106 fn typename() -> &'static str {
12107 "type.googleapis.com/grafeas.v1.Source"
12108 }
12109}
12110
12111/// Container message for hashes of byte content of files, used in source
12112/// messages to verify integrity of source input to the build.
12113#[derive(Clone, Default, PartialEq)]
12114#[non_exhaustive]
12115pub struct FileHashes {
12116 /// Required. Collection of file hashes.
12117 pub file_hash: std::vec::Vec<crate::model::Hash>,
12118
12119 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12120}
12121
12122impl FileHashes {
12123 pub fn new() -> Self {
12124 std::default::Default::default()
12125 }
12126
12127 /// Sets the value of [file_hash][crate::model::FileHashes::file_hash].
12128 ///
12129 /// # Example
12130 /// ```ignore,no_run
12131 /// # use google_cloud_grafeas_v1::model::FileHashes;
12132 /// use google_cloud_grafeas_v1::model::Hash;
12133 /// let x = FileHashes::new()
12134 /// .set_file_hash([
12135 /// Hash::default()/* use setters */,
12136 /// Hash::default()/* use (different) setters */,
12137 /// ]);
12138 /// ```
12139 pub fn set_file_hash<T, V>(mut self, v: T) -> Self
12140 where
12141 T: std::iter::IntoIterator<Item = V>,
12142 V: std::convert::Into<crate::model::Hash>,
12143 {
12144 use std::iter::Iterator;
12145 self.file_hash = v.into_iter().map(|i| i.into()).collect();
12146 self
12147 }
12148}
12149
12150impl wkt::message::Message for FileHashes {
12151 fn typename() -> &'static str {
12152 "type.googleapis.com/grafeas.v1.FileHashes"
12153 }
12154}
12155
12156/// Container message for hash values.
12157#[derive(Clone, Default, PartialEq)]
12158#[non_exhaustive]
12159pub struct Hash {
12160 /// Required. The type of hash that was performed, e.g. "SHA-256".
12161 pub r#type: std::string::String,
12162
12163 /// Required. The hash value.
12164 pub value: ::bytes::Bytes,
12165
12166 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12167}
12168
12169impl Hash {
12170 pub fn new() -> Self {
12171 std::default::Default::default()
12172 }
12173
12174 /// Sets the value of [r#type][crate::model::Hash::type].
12175 ///
12176 /// # Example
12177 /// ```ignore,no_run
12178 /// # use google_cloud_grafeas_v1::model::Hash;
12179 /// let x = Hash::new().set_type("example");
12180 /// ```
12181 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12182 self.r#type = v.into();
12183 self
12184 }
12185
12186 /// Sets the value of [value][crate::model::Hash::value].
12187 ///
12188 /// # Example
12189 /// ```ignore,no_run
12190 /// # use google_cloud_grafeas_v1::model::Hash;
12191 /// let x = Hash::new().set_value(bytes::Bytes::from_static(b"example"));
12192 /// ```
12193 pub fn set_value<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12194 self.value = v.into();
12195 self
12196 }
12197}
12198
12199impl wkt::message::Message for Hash {
12200 fn typename() -> &'static str {
12201 "type.googleapis.com/grafeas.v1.Hash"
12202 }
12203}
12204
12205/// Command describes a step performed as part of the build pipeline.
12206#[derive(Clone, Default, PartialEq)]
12207#[non_exhaustive]
12208pub struct Command {
12209 /// Required. Name of the command, as presented on the command line, or if the
12210 /// command is packaged as a Docker container, as presented to `docker pull`.
12211 pub name: std::string::String,
12212
12213 /// Environment variables set before running this command.
12214 pub env: std::vec::Vec<std::string::String>,
12215
12216 /// Command-line arguments used when executing this command.
12217 pub args: std::vec::Vec<std::string::String>,
12218
12219 /// Working directory (relative to project source root) used when running this
12220 /// command.
12221 pub dir: std::string::String,
12222
12223 /// Optional unique identifier for this command, used in wait_for to reference
12224 /// this command as a dependency.
12225 pub id: std::string::String,
12226
12227 /// The ID(s) of the command(s) that this command depends on.
12228 pub wait_for: std::vec::Vec<std::string::String>,
12229
12230 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12231}
12232
12233impl Command {
12234 pub fn new() -> Self {
12235 std::default::Default::default()
12236 }
12237
12238 /// Sets the value of [name][crate::model::Command::name].
12239 ///
12240 /// # Example
12241 /// ```ignore,no_run
12242 /// # use google_cloud_grafeas_v1::model::Command;
12243 /// let x = Command::new().set_name("example");
12244 /// ```
12245 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12246 self.name = v.into();
12247 self
12248 }
12249
12250 /// Sets the value of [env][crate::model::Command::env].
12251 ///
12252 /// # Example
12253 /// ```ignore,no_run
12254 /// # use google_cloud_grafeas_v1::model::Command;
12255 /// let x = Command::new().set_env(["a", "b", "c"]);
12256 /// ```
12257 pub fn set_env<T, V>(mut self, v: T) -> Self
12258 where
12259 T: std::iter::IntoIterator<Item = V>,
12260 V: std::convert::Into<std::string::String>,
12261 {
12262 use std::iter::Iterator;
12263 self.env = v.into_iter().map(|i| i.into()).collect();
12264 self
12265 }
12266
12267 /// Sets the value of [args][crate::model::Command::args].
12268 ///
12269 /// # Example
12270 /// ```ignore,no_run
12271 /// # use google_cloud_grafeas_v1::model::Command;
12272 /// let x = Command::new().set_args(["a", "b", "c"]);
12273 /// ```
12274 pub fn set_args<T, V>(mut self, v: T) -> Self
12275 where
12276 T: std::iter::IntoIterator<Item = V>,
12277 V: std::convert::Into<std::string::String>,
12278 {
12279 use std::iter::Iterator;
12280 self.args = v.into_iter().map(|i| i.into()).collect();
12281 self
12282 }
12283
12284 /// Sets the value of [dir][crate::model::Command::dir].
12285 ///
12286 /// # Example
12287 /// ```ignore,no_run
12288 /// # use google_cloud_grafeas_v1::model::Command;
12289 /// let x = Command::new().set_dir("example");
12290 /// ```
12291 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12292 self.dir = v.into();
12293 self
12294 }
12295
12296 /// Sets the value of [id][crate::model::Command::id].
12297 ///
12298 /// # Example
12299 /// ```ignore,no_run
12300 /// # use google_cloud_grafeas_v1::model::Command;
12301 /// let x = Command::new().set_id("example");
12302 /// ```
12303 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12304 self.id = v.into();
12305 self
12306 }
12307
12308 /// Sets the value of [wait_for][crate::model::Command::wait_for].
12309 ///
12310 /// # Example
12311 /// ```ignore,no_run
12312 /// # use google_cloud_grafeas_v1::model::Command;
12313 /// let x = Command::new().set_wait_for(["a", "b", "c"]);
12314 /// ```
12315 pub fn set_wait_for<T, V>(mut self, v: T) -> Self
12316 where
12317 T: std::iter::IntoIterator<Item = V>,
12318 V: std::convert::Into<std::string::String>,
12319 {
12320 use std::iter::Iterator;
12321 self.wait_for = v.into_iter().map(|i| i.into()).collect();
12322 self
12323 }
12324}
12325
12326impl wkt::message::Message for Command {
12327 fn typename() -> &'static str {
12328 "type.googleapis.com/grafeas.v1.Command"
12329 }
12330}
12331
12332/// Artifact describes a build product.
12333#[derive(Clone, Default, PartialEq)]
12334#[non_exhaustive]
12335pub struct Artifact {
12336 /// Hash or checksum value of a binary, or Docker Registry 2.0 digest of a
12337 /// container.
12338 pub checksum: std::string::String,
12339
12340 /// Artifact ID, if any; for container images, this will be a URL by digest
12341 /// like `gcr.io/projectID/imagename@sha256:123456`.
12342 pub id: std::string::String,
12343
12344 /// Related artifact names. This may be the path to a binary or jar file, or in
12345 /// the case of a container build, the name used to push the container image to
12346 /// Google Container Registry, as presented to `docker push`. Note that a
12347 /// single Artifact ID can have multiple names, for example if two tags are
12348 /// applied to one image.
12349 pub names: std::vec::Vec<std::string::String>,
12350
12351 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12352}
12353
12354impl Artifact {
12355 pub fn new() -> Self {
12356 std::default::Default::default()
12357 }
12358
12359 /// Sets the value of [checksum][crate::model::Artifact::checksum].
12360 ///
12361 /// # Example
12362 /// ```ignore,no_run
12363 /// # use google_cloud_grafeas_v1::model::Artifact;
12364 /// let x = Artifact::new().set_checksum("example");
12365 /// ```
12366 pub fn set_checksum<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12367 self.checksum = v.into();
12368 self
12369 }
12370
12371 /// Sets the value of [id][crate::model::Artifact::id].
12372 ///
12373 /// # Example
12374 /// ```ignore,no_run
12375 /// # use google_cloud_grafeas_v1::model::Artifact;
12376 /// let x = Artifact::new().set_id("example");
12377 /// ```
12378 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12379 self.id = v.into();
12380 self
12381 }
12382
12383 /// Sets the value of [names][crate::model::Artifact::names].
12384 ///
12385 /// # Example
12386 /// ```ignore,no_run
12387 /// # use google_cloud_grafeas_v1::model::Artifact;
12388 /// let x = Artifact::new().set_names(["a", "b", "c"]);
12389 /// ```
12390 pub fn set_names<T, V>(mut self, v: T) -> Self
12391 where
12392 T: std::iter::IntoIterator<Item = V>,
12393 V: std::convert::Into<std::string::String>,
12394 {
12395 use std::iter::Iterator;
12396 self.names = v.into_iter().map(|i| i.into()).collect();
12397 self
12398 }
12399}
12400
12401impl wkt::message::Message for Artifact {
12402 fn typename() -> &'static str {
12403 "type.googleapis.com/grafeas.v1.Artifact"
12404 }
12405}
12406
12407/// A SourceContext is a reference to a tree of files. A SourceContext together
12408/// with a path point to a unique revision of a single file or directory.
12409#[derive(Clone, Default, PartialEq)]
12410#[non_exhaustive]
12411pub struct SourceContext {
12412 /// Labels with user defined metadata.
12413 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
12414
12415 /// A SourceContext can refer any one of the following types of repositories.
12416 pub context: std::option::Option<crate::model::source_context::Context>,
12417
12418 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12419}
12420
12421impl SourceContext {
12422 pub fn new() -> Self {
12423 std::default::Default::default()
12424 }
12425
12426 /// Sets the value of [labels][crate::model::SourceContext::labels].
12427 ///
12428 /// # Example
12429 /// ```ignore,no_run
12430 /// # use google_cloud_grafeas_v1::model::SourceContext;
12431 /// let x = SourceContext::new().set_labels([
12432 /// ("key0", "abc"),
12433 /// ("key1", "xyz"),
12434 /// ]);
12435 /// ```
12436 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
12437 where
12438 T: std::iter::IntoIterator<Item = (K, V)>,
12439 K: std::convert::Into<std::string::String>,
12440 V: std::convert::Into<std::string::String>,
12441 {
12442 use std::iter::Iterator;
12443 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12444 self
12445 }
12446
12447 /// Sets the value of [context][crate::model::SourceContext::context].
12448 ///
12449 /// Note that all the setters affecting `context` are mutually
12450 /// exclusive.
12451 ///
12452 /// # Example
12453 /// ```ignore,no_run
12454 /// # use google_cloud_grafeas_v1::model::SourceContext;
12455 /// use google_cloud_grafeas_v1::model::CloudRepoSourceContext;
12456 /// let x = SourceContext::new().set_context(Some(
12457 /// google_cloud_grafeas_v1::model::source_context::Context::CloudRepo(CloudRepoSourceContext::default().into())));
12458 /// ```
12459 pub fn set_context<
12460 T: std::convert::Into<std::option::Option<crate::model::source_context::Context>>,
12461 >(
12462 mut self,
12463 v: T,
12464 ) -> Self {
12465 self.context = v.into();
12466 self
12467 }
12468
12469 /// The value of [context][crate::model::SourceContext::context]
12470 /// if it holds a `CloudRepo`, `None` if the field is not set or
12471 /// holds a different branch.
12472 pub fn cloud_repo(
12473 &self,
12474 ) -> std::option::Option<&std::boxed::Box<crate::model::CloudRepoSourceContext>> {
12475 #[allow(unreachable_patterns)]
12476 self.context.as_ref().and_then(|v| match v {
12477 crate::model::source_context::Context::CloudRepo(v) => std::option::Option::Some(v),
12478 _ => std::option::Option::None,
12479 })
12480 }
12481
12482 /// Sets the value of [context][crate::model::SourceContext::context]
12483 /// to hold a `CloudRepo`.
12484 ///
12485 /// Note that all the setters affecting `context` are
12486 /// mutually exclusive.
12487 ///
12488 /// # Example
12489 /// ```ignore,no_run
12490 /// # use google_cloud_grafeas_v1::model::SourceContext;
12491 /// use google_cloud_grafeas_v1::model::CloudRepoSourceContext;
12492 /// let x = SourceContext::new().set_cloud_repo(CloudRepoSourceContext::default()/* use setters */);
12493 /// assert!(x.cloud_repo().is_some());
12494 /// assert!(x.gerrit().is_none());
12495 /// assert!(x.git().is_none());
12496 /// ```
12497 pub fn set_cloud_repo<
12498 T: std::convert::Into<std::boxed::Box<crate::model::CloudRepoSourceContext>>,
12499 >(
12500 mut self,
12501 v: T,
12502 ) -> Self {
12503 self.context =
12504 std::option::Option::Some(crate::model::source_context::Context::CloudRepo(v.into()));
12505 self
12506 }
12507
12508 /// The value of [context][crate::model::SourceContext::context]
12509 /// if it holds a `Gerrit`, `None` if the field is not set or
12510 /// holds a different branch.
12511 pub fn gerrit(
12512 &self,
12513 ) -> std::option::Option<&std::boxed::Box<crate::model::GerritSourceContext>> {
12514 #[allow(unreachable_patterns)]
12515 self.context.as_ref().and_then(|v| match v {
12516 crate::model::source_context::Context::Gerrit(v) => std::option::Option::Some(v),
12517 _ => std::option::Option::None,
12518 })
12519 }
12520
12521 /// Sets the value of [context][crate::model::SourceContext::context]
12522 /// to hold a `Gerrit`.
12523 ///
12524 /// Note that all the setters affecting `context` are
12525 /// mutually exclusive.
12526 ///
12527 /// # Example
12528 /// ```ignore,no_run
12529 /// # use google_cloud_grafeas_v1::model::SourceContext;
12530 /// use google_cloud_grafeas_v1::model::GerritSourceContext;
12531 /// let x = SourceContext::new().set_gerrit(GerritSourceContext::default()/* use setters */);
12532 /// assert!(x.gerrit().is_some());
12533 /// assert!(x.cloud_repo().is_none());
12534 /// assert!(x.git().is_none());
12535 /// ```
12536 pub fn set_gerrit<T: std::convert::Into<std::boxed::Box<crate::model::GerritSourceContext>>>(
12537 mut self,
12538 v: T,
12539 ) -> Self {
12540 self.context =
12541 std::option::Option::Some(crate::model::source_context::Context::Gerrit(v.into()));
12542 self
12543 }
12544
12545 /// The value of [context][crate::model::SourceContext::context]
12546 /// if it holds a `Git`, `None` if the field is not set or
12547 /// holds a different branch.
12548 pub fn git(&self) -> std::option::Option<&std::boxed::Box<crate::model::GitSourceContext>> {
12549 #[allow(unreachable_patterns)]
12550 self.context.as_ref().and_then(|v| match v {
12551 crate::model::source_context::Context::Git(v) => std::option::Option::Some(v),
12552 _ => std::option::Option::None,
12553 })
12554 }
12555
12556 /// Sets the value of [context][crate::model::SourceContext::context]
12557 /// to hold a `Git`.
12558 ///
12559 /// Note that all the setters affecting `context` are
12560 /// mutually exclusive.
12561 ///
12562 /// # Example
12563 /// ```ignore,no_run
12564 /// # use google_cloud_grafeas_v1::model::SourceContext;
12565 /// use google_cloud_grafeas_v1::model::GitSourceContext;
12566 /// let x = SourceContext::new().set_git(GitSourceContext::default()/* use setters */);
12567 /// assert!(x.git().is_some());
12568 /// assert!(x.cloud_repo().is_none());
12569 /// assert!(x.gerrit().is_none());
12570 /// ```
12571 pub fn set_git<T: std::convert::Into<std::boxed::Box<crate::model::GitSourceContext>>>(
12572 mut self,
12573 v: T,
12574 ) -> Self {
12575 self.context =
12576 std::option::Option::Some(crate::model::source_context::Context::Git(v.into()));
12577 self
12578 }
12579}
12580
12581impl wkt::message::Message for SourceContext {
12582 fn typename() -> &'static str {
12583 "type.googleapis.com/grafeas.v1.SourceContext"
12584 }
12585}
12586
12587/// Defines additional types related to [SourceContext].
12588pub mod source_context {
12589 #[allow(unused_imports)]
12590 use super::*;
12591
12592 /// A SourceContext can refer any one of the following types of repositories.
12593 #[derive(Clone, Debug, PartialEq)]
12594 #[non_exhaustive]
12595 pub enum Context {
12596 /// A SourceContext referring to a revision in a Google Cloud Source Repo.
12597 CloudRepo(std::boxed::Box<crate::model::CloudRepoSourceContext>),
12598 /// A SourceContext referring to a Gerrit project.
12599 Gerrit(std::boxed::Box<crate::model::GerritSourceContext>),
12600 /// A SourceContext referring to any third party Git repo (e.g., GitHub).
12601 Git(std::boxed::Box<crate::model::GitSourceContext>),
12602 }
12603}
12604
12605/// An alias to a repo revision.
12606#[derive(Clone, Default, PartialEq)]
12607#[non_exhaustive]
12608pub struct AliasContext {
12609 /// The alias kind.
12610 pub kind: crate::model::alias_context::Kind,
12611
12612 /// The alias name.
12613 pub name: std::string::String,
12614
12615 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12616}
12617
12618impl AliasContext {
12619 pub fn new() -> Self {
12620 std::default::Default::default()
12621 }
12622
12623 /// Sets the value of [kind][crate::model::AliasContext::kind].
12624 ///
12625 /// # Example
12626 /// ```ignore,no_run
12627 /// # use google_cloud_grafeas_v1::model::AliasContext;
12628 /// use google_cloud_grafeas_v1::model::alias_context::Kind;
12629 /// let x0 = AliasContext::new().set_kind(Kind::Fixed);
12630 /// let x1 = AliasContext::new().set_kind(Kind::Movable);
12631 /// let x2 = AliasContext::new().set_kind(Kind::Other);
12632 /// ```
12633 pub fn set_kind<T: std::convert::Into<crate::model::alias_context::Kind>>(
12634 mut self,
12635 v: T,
12636 ) -> Self {
12637 self.kind = v.into();
12638 self
12639 }
12640
12641 /// Sets the value of [name][crate::model::AliasContext::name].
12642 ///
12643 /// # Example
12644 /// ```ignore,no_run
12645 /// # use google_cloud_grafeas_v1::model::AliasContext;
12646 /// let x = AliasContext::new().set_name("example");
12647 /// ```
12648 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12649 self.name = v.into();
12650 self
12651 }
12652}
12653
12654impl wkt::message::Message for AliasContext {
12655 fn typename() -> &'static str {
12656 "type.googleapis.com/grafeas.v1.AliasContext"
12657 }
12658}
12659
12660/// Defines additional types related to [AliasContext].
12661pub mod alias_context {
12662 #[allow(unused_imports)]
12663 use super::*;
12664
12665 /// The type of an alias.
12666 ///
12667 /// # Working with unknown values
12668 ///
12669 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12670 /// additional enum variants at any time. Adding new variants is not considered
12671 /// a breaking change. Applications should write their code in anticipation of:
12672 ///
12673 /// - New values appearing in future releases of the client library, **and**
12674 /// - New values received dynamically, without application changes.
12675 ///
12676 /// Please consult the [Working with enums] section in the user guide for some
12677 /// guidelines.
12678 ///
12679 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12680 #[derive(Clone, Debug, PartialEq)]
12681 #[non_exhaustive]
12682 pub enum Kind {
12683 /// Unknown.
12684 Unspecified,
12685 /// Git tag.
12686 Fixed,
12687 /// Git branch.
12688 Movable,
12689 /// Used to specify non-standard aliases. For example, if a Git repo has a
12690 /// ref named "refs/foo/bar".
12691 Other,
12692 /// If set, the enum was initialized with an unknown value.
12693 ///
12694 /// Applications can examine the value using [Kind::value] or
12695 /// [Kind::name].
12696 UnknownValue(kind::UnknownValue),
12697 }
12698
12699 #[doc(hidden)]
12700 pub mod kind {
12701 #[allow(unused_imports)]
12702 use super::*;
12703 #[derive(Clone, Debug, PartialEq)]
12704 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12705 }
12706
12707 impl Kind {
12708 /// Gets the enum value.
12709 ///
12710 /// Returns `None` if the enum contains an unknown value deserialized from
12711 /// the string representation of enums.
12712 pub fn value(&self) -> std::option::Option<i32> {
12713 match self {
12714 Self::Unspecified => std::option::Option::Some(0),
12715 Self::Fixed => std::option::Option::Some(1),
12716 Self::Movable => std::option::Option::Some(2),
12717 Self::Other => std::option::Option::Some(4),
12718 Self::UnknownValue(u) => u.0.value(),
12719 }
12720 }
12721
12722 /// Gets the enum value as a string.
12723 ///
12724 /// Returns `None` if the enum contains an unknown value deserialized from
12725 /// the integer representation of enums.
12726 pub fn name(&self) -> std::option::Option<&str> {
12727 match self {
12728 Self::Unspecified => std::option::Option::Some("KIND_UNSPECIFIED"),
12729 Self::Fixed => std::option::Option::Some("FIXED"),
12730 Self::Movable => std::option::Option::Some("MOVABLE"),
12731 Self::Other => std::option::Option::Some("OTHER"),
12732 Self::UnknownValue(u) => u.0.name(),
12733 }
12734 }
12735 }
12736
12737 impl std::default::Default for Kind {
12738 fn default() -> Self {
12739 use std::convert::From;
12740 Self::from(0)
12741 }
12742 }
12743
12744 impl std::fmt::Display for Kind {
12745 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12746 wkt::internal::display_enum(f, self.name(), self.value())
12747 }
12748 }
12749
12750 impl std::convert::From<i32> for Kind {
12751 fn from(value: i32) -> Self {
12752 match value {
12753 0 => Self::Unspecified,
12754 1 => Self::Fixed,
12755 2 => Self::Movable,
12756 4 => Self::Other,
12757 _ => Self::UnknownValue(kind::UnknownValue(
12758 wkt::internal::UnknownEnumValue::Integer(value),
12759 )),
12760 }
12761 }
12762 }
12763
12764 impl std::convert::From<&str> for Kind {
12765 fn from(value: &str) -> Self {
12766 use std::string::ToString;
12767 match value {
12768 "KIND_UNSPECIFIED" => Self::Unspecified,
12769 "FIXED" => Self::Fixed,
12770 "MOVABLE" => Self::Movable,
12771 "OTHER" => Self::Other,
12772 _ => Self::UnknownValue(kind::UnknownValue(
12773 wkt::internal::UnknownEnumValue::String(value.to_string()),
12774 )),
12775 }
12776 }
12777 }
12778
12779 impl serde::ser::Serialize for Kind {
12780 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12781 where
12782 S: serde::Serializer,
12783 {
12784 match self {
12785 Self::Unspecified => serializer.serialize_i32(0),
12786 Self::Fixed => serializer.serialize_i32(1),
12787 Self::Movable => serializer.serialize_i32(2),
12788 Self::Other => serializer.serialize_i32(4),
12789 Self::UnknownValue(u) => u.0.serialize(serializer),
12790 }
12791 }
12792 }
12793
12794 impl<'de> serde::de::Deserialize<'de> for Kind {
12795 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12796 where
12797 D: serde::Deserializer<'de>,
12798 {
12799 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Kind>::new(
12800 ".grafeas.v1.AliasContext.Kind",
12801 ))
12802 }
12803 }
12804}
12805
12806/// A CloudRepoSourceContext denotes a particular revision in a Google Cloud
12807/// Source Repo.
12808#[derive(Clone, Default, PartialEq)]
12809#[non_exhaustive]
12810pub struct CloudRepoSourceContext {
12811 /// The ID of the repo.
12812 pub repo_id: std::option::Option<crate::model::RepoId>,
12813
12814 /// A revision in a Cloud Repo can be identified by either its revision ID or
12815 /// its alias.
12816 pub revision: std::option::Option<crate::model::cloud_repo_source_context::Revision>,
12817
12818 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12819}
12820
12821impl CloudRepoSourceContext {
12822 pub fn new() -> Self {
12823 std::default::Default::default()
12824 }
12825
12826 /// Sets the value of [repo_id][crate::model::CloudRepoSourceContext::repo_id].
12827 ///
12828 /// # Example
12829 /// ```ignore,no_run
12830 /// # use google_cloud_grafeas_v1::model::CloudRepoSourceContext;
12831 /// use google_cloud_grafeas_v1::model::RepoId;
12832 /// let x = CloudRepoSourceContext::new().set_repo_id(RepoId::default()/* use setters */);
12833 /// ```
12834 pub fn set_repo_id<T>(mut self, v: T) -> Self
12835 where
12836 T: std::convert::Into<crate::model::RepoId>,
12837 {
12838 self.repo_id = std::option::Option::Some(v.into());
12839 self
12840 }
12841
12842 /// Sets or clears the value of [repo_id][crate::model::CloudRepoSourceContext::repo_id].
12843 ///
12844 /// # Example
12845 /// ```ignore,no_run
12846 /// # use google_cloud_grafeas_v1::model::CloudRepoSourceContext;
12847 /// use google_cloud_grafeas_v1::model::RepoId;
12848 /// let x = CloudRepoSourceContext::new().set_or_clear_repo_id(Some(RepoId::default()/* use setters */));
12849 /// let x = CloudRepoSourceContext::new().set_or_clear_repo_id(None::<RepoId>);
12850 /// ```
12851 pub fn set_or_clear_repo_id<T>(mut self, v: std::option::Option<T>) -> Self
12852 where
12853 T: std::convert::Into<crate::model::RepoId>,
12854 {
12855 self.repo_id = v.map(|x| x.into());
12856 self
12857 }
12858
12859 /// Sets the value of [revision][crate::model::CloudRepoSourceContext::revision].
12860 ///
12861 /// Note that all the setters affecting `revision` are mutually
12862 /// exclusive.
12863 ///
12864 /// # Example
12865 /// ```ignore,no_run
12866 /// # use google_cloud_grafeas_v1::model::CloudRepoSourceContext;
12867 /// use google_cloud_grafeas_v1::model::cloud_repo_source_context::Revision;
12868 /// let x = CloudRepoSourceContext::new().set_revision(Some(Revision::RevisionId("example".to_string())));
12869 /// ```
12870 pub fn set_revision<
12871 T: std::convert::Into<std::option::Option<crate::model::cloud_repo_source_context::Revision>>,
12872 >(
12873 mut self,
12874 v: T,
12875 ) -> Self {
12876 self.revision = v.into();
12877 self
12878 }
12879
12880 /// The value of [revision][crate::model::CloudRepoSourceContext::revision]
12881 /// if it holds a `RevisionId`, `None` if the field is not set or
12882 /// holds a different branch.
12883 pub fn revision_id(&self) -> std::option::Option<&std::string::String> {
12884 #[allow(unreachable_patterns)]
12885 self.revision.as_ref().and_then(|v| match v {
12886 crate::model::cloud_repo_source_context::Revision::RevisionId(v) => {
12887 std::option::Option::Some(v)
12888 }
12889 _ => std::option::Option::None,
12890 })
12891 }
12892
12893 /// Sets the value of [revision][crate::model::CloudRepoSourceContext::revision]
12894 /// to hold a `RevisionId`.
12895 ///
12896 /// Note that all the setters affecting `revision` are
12897 /// mutually exclusive.
12898 ///
12899 /// # Example
12900 /// ```ignore,no_run
12901 /// # use google_cloud_grafeas_v1::model::CloudRepoSourceContext;
12902 /// let x = CloudRepoSourceContext::new().set_revision_id("example");
12903 /// assert!(x.revision_id().is_some());
12904 /// assert!(x.alias_context().is_none());
12905 /// ```
12906 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12907 self.revision = std::option::Option::Some(
12908 crate::model::cloud_repo_source_context::Revision::RevisionId(v.into()),
12909 );
12910 self
12911 }
12912
12913 /// The value of [revision][crate::model::CloudRepoSourceContext::revision]
12914 /// if it holds a `AliasContext`, `None` if the field is not set or
12915 /// holds a different branch.
12916 pub fn alias_context(
12917 &self,
12918 ) -> std::option::Option<&std::boxed::Box<crate::model::AliasContext>> {
12919 #[allow(unreachable_patterns)]
12920 self.revision.as_ref().and_then(|v| match v {
12921 crate::model::cloud_repo_source_context::Revision::AliasContext(v) => {
12922 std::option::Option::Some(v)
12923 }
12924 _ => std::option::Option::None,
12925 })
12926 }
12927
12928 /// Sets the value of [revision][crate::model::CloudRepoSourceContext::revision]
12929 /// to hold a `AliasContext`.
12930 ///
12931 /// Note that all the setters affecting `revision` are
12932 /// mutually exclusive.
12933 ///
12934 /// # Example
12935 /// ```ignore,no_run
12936 /// # use google_cloud_grafeas_v1::model::CloudRepoSourceContext;
12937 /// use google_cloud_grafeas_v1::model::AliasContext;
12938 /// let x = CloudRepoSourceContext::new().set_alias_context(AliasContext::default()/* use setters */);
12939 /// assert!(x.alias_context().is_some());
12940 /// assert!(x.revision_id().is_none());
12941 /// ```
12942 pub fn set_alias_context<T: std::convert::Into<std::boxed::Box<crate::model::AliasContext>>>(
12943 mut self,
12944 v: T,
12945 ) -> Self {
12946 self.revision = std::option::Option::Some(
12947 crate::model::cloud_repo_source_context::Revision::AliasContext(v.into()),
12948 );
12949 self
12950 }
12951}
12952
12953impl wkt::message::Message for CloudRepoSourceContext {
12954 fn typename() -> &'static str {
12955 "type.googleapis.com/grafeas.v1.CloudRepoSourceContext"
12956 }
12957}
12958
12959/// Defines additional types related to [CloudRepoSourceContext].
12960pub mod cloud_repo_source_context {
12961 #[allow(unused_imports)]
12962 use super::*;
12963
12964 /// A revision in a Cloud Repo can be identified by either its revision ID or
12965 /// its alias.
12966 #[derive(Clone, Debug, PartialEq)]
12967 #[non_exhaustive]
12968 pub enum Revision {
12969 /// A revision ID.
12970 RevisionId(std::string::String),
12971 /// An alias, which may be a branch or tag.
12972 AliasContext(std::boxed::Box<crate::model::AliasContext>),
12973 }
12974}
12975
12976/// A SourceContext referring to a Gerrit project.
12977#[derive(Clone, Default, PartialEq)]
12978#[non_exhaustive]
12979pub struct GerritSourceContext {
12980 /// The URI of a running Gerrit instance.
12981 pub host_uri: std::string::String,
12982
12983 /// The full project name within the host. Projects may be nested, so
12984 /// "project/subproject" is a valid project name. The "repo name" is the
12985 /// hostURI/project.
12986 pub gerrit_project: std::string::String,
12987
12988 /// A revision in a Gerrit project can be identified by either its revision ID
12989 /// or its alias.
12990 pub revision: std::option::Option<crate::model::gerrit_source_context::Revision>,
12991
12992 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12993}
12994
12995impl GerritSourceContext {
12996 pub fn new() -> Self {
12997 std::default::Default::default()
12998 }
12999
13000 /// Sets the value of [host_uri][crate::model::GerritSourceContext::host_uri].
13001 ///
13002 /// # Example
13003 /// ```ignore,no_run
13004 /// # use google_cloud_grafeas_v1::model::GerritSourceContext;
13005 /// let x = GerritSourceContext::new().set_host_uri("example");
13006 /// ```
13007 pub fn set_host_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13008 self.host_uri = v.into();
13009 self
13010 }
13011
13012 /// Sets the value of [gerrit_project][crate::model::GerritSourceContext::gerrit_project].
13013 ///
13014 /// # Example
13015 /// ```ignore,no_run
13016 /// # use google_cloud_grafeas_v1::model::GerritSourceContext;
13017 /// let x = GerritSourceContext::new().set_gerrit_project("example");
13018 /// ```
13019 pub fn set_gerrit_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13020 self.gerrit_project = v.into();
13021 self
13022 }
13023
13024 /// Sets the value of [revision][crate::model::GerritSourceContext::revision].
13025 ///
13026 /// Note that all the setters affecting `revision` are mutually
13027 /// exclusive.
13028 ///
13029 /// # Example
13030 /// ```ignore,no_run
13031 /// # use google_cloud_grafeas_v1::model::GerritSourceContext;
13032 /// use google_cloud_grafeas_v1::model::gerrit_source_context::Revision;
13033 /// let x = GerritSourceContext::new().set_revision(Some(Revision::RevisionId("example".to_string())));
13034 /// ```
13035 pub fn set_revision<
13036 T: std::convert::Into<std::option::Option<crate::model::gerrit_source_context::Revision>>,
13037 >(
13038 mut self,
13039 v: T,
13040 ) -> Self {
13041 self.revision = v.into();
13042 self
13043 }
13044
13045 /// The value of [revision][crate::model::GerritSourceContext::revision]
13046 /// if it holds a `RevisionId`, `None` if the field is not set or
13047 /// holds a different branch.
13048 pub fn revision_id(&self) -> std::option::Option<&std::string::String> {
13049 #[allow(unreachable_patterns)]
13050 self.revision.as_ref().and_then(|v| match v {
13051 crate::model::gerrit_source_context::Revision::RevisionId(v) => {
13052 std::option::Option::Some(v)
13053 }
13054 _ => std::option::Option::None,
13055 })
13056 }
13057
13058 /// Sets the value of [revision][crate::model::GerritSourceContext::revision]
13059 /// to hold a `RevisionId`.
13060 ///
13061 /// Note that all the setters affecting `revision` are
13062 /// mutually exclusive.
13063 ///
13064 /// # Example
13065 /// ```ignore,no_run
13066 /// # use google_cloud_grafeas_v1::model::GerritSourceContext;
13067 /// let x = GerritSourceContext::new().set_revision_id("example");
13068 /// assert!(x.revision_id().is_some());
13069 /// assert!(x.alias_context().is_none());
13070 /// ```
13071 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13072 self.revision = std::option::Option::Some(
13073 crate::model::gerrit_source_context::Revision::RevisionId(v.into()),
13074 );
13075 self
13076 }
13077
13078 /// The value of [revision][crate::model::GerritSourceContext::revision]
13079 /// if it holds a `AliasContext`, `None` if the field is not set or
13080 /// holds a different branch.
13081 pub fn alias_context(
13082 &self,
13083 ) -> std::option::Option<&std::boxed::Box<crate::model::AliasContext>> {
13084 #[allow(unreachable_patterns)]
13085 self.revision.as_ref().and_then(|v| match v {
13086 crate::model::gerrit_source_context::Revision::AliasContext(v) => {
13087 std::option::Option::Some(v)
13088 }
13089 _ => std::option::Option::None,
13090 })
13091 }
13092
13093 /// Sets the value of [revision][crate::model::GerritSourceContext::revision]
13094 /// to hold a `AliasContext`.
13095 ///
13096 /// Note that all the setters affecting `revision` are
13097 /// mutually exclusive.
13098 ///
13099 /// # Example
13100 /// ```ignore,no_run
13101 /// # use google_cloud_grafeas_v1::model::GerritSourceContext;
13102 /// use google_cloud_grafeas_v1::model::AliasContext;
13103 /// let x = GerritSourceContext::new().set_alias_context(AliasContext::default()/* use setters */);
13104 /// assert!(x.alias_context().is_some());
13105 /// assert!(x.revision_id().is_none());
13106 /// ```
13107 pub fn set_alias_context<T: std::convert::Into<std::boxed::Box<crate::model::AliasContext>>>(
13108 mut self,
13109 v: T,
13110 ) -> Self {
13111 self.revision = std::option::Option::Some(
13112 crate::model::gerrit_source_context::Revision::AliasContext(v.into()),
13113 );
13114 self
13115 }
13116}
13117
13118impl wkt::message::Message for GerritSourceContext {
13119 fn typename() -> &'static str {
13120 "type.googleapis.com/grafeas.v1.GerritSourceContext"
13121 }
13122}
13123
13124/// Defines additional types related to [GerritSourceContext].
13125pub mod gerrit_source_context {
13126 #[allow(unused_imports)]
13127 use super::*;
13128
13129 /// A revision in a Gerrit project can be identified by either its revision ID
13130 /// or its alias.
13131 #[derive(Clone, Debug, PartialEq)]
13132 #[non_exhaustive]
13133 pub enum Revision {
13134 /// A revision (commit) ID.
13135 RevisionId(std::string::String),
13136 /// An alias, which may be a branch or tag.
13137 AliasContext(std::boxed::Box<crate::model::AliasContext>),
13138 }
13139}
13140
13141/// A GitSourceContext denotes a particular revision in a third party Git
13142/// repository (e.g., GitHub).
13143#[derive(Clone, Default, PartialEq)]
13144#[non_exhaustive]
13145pub struct GitSourceContext {
13146 /// Git repository URL.
13147 pub url: std::string::String,
13148
13149 /// Git commit hash.
13150 pub revision_id: std::string::String,
13151
13152 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13153}
13154
13155impl GitSourceContext {
13156 pub fn new() -> Self {
13157 std::default::Default::default()
13158 }
13159
13160 /// Sets the value of [url][crate::model::GitSourceContext::url].
13161 ///
13162 /// # Example
13163 /// ```ignore,no_run
13164 /// # use google_cloud_grafeas_v1::model::GitSourceContext;
13165 /// let x = GitSourceContext::new().set_url("example");
13166 /// ```
13167 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13168 self.url = v.into();
13169 self
13170 }
13171
13172 /// Sets the value of [revision_id][crate::model::GitSourceContext::revision_id].
13173 ///
13174 /// # Example
13175 /// ```ignore,no_run
13176 /// # use google_cloud_grafeas_v1::model::GitSourceContext;
13177 /// let x = GitSourceContext::new().set_revision_id("example");
13178 /// ```
13179 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13180 self.revision_id = v.into();
13181 self
13182 }
13183}
13184
13185impl wkt::message::Message for GitSourceContext {
13186 fn typename() -> &'static str {
13187 "type.googleapis.com/grafeas.v1.GitSourceContext"
13188 }
13189}
13190
13191/// A unique identifier for a Cloud Repo.
13192#[derive(Clone, Default, PartialEq)]
13193#[non_exhaustive]
13194pub struct RepoId {
13195 /// A cloud repo can be identified by either its project ID and repository name
13196 /// combination, or its globally unique identifier.
13197 pub id: std::option::Option<crate::model::repo_id::Id>,
13198
13199 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13200}
13201
13202impl RepoId {
13203 pub fn new() -> Self {
13204 std::default::Default::default()
13205 }
13206
13207 /// Sets the value of [id][crate::model::RepoId::id].
13208 ///
13209 /// Note that all the setters affecting `id` are mutually
13210 /// exclusive.
13211 ///
13212 /// # Example
13213 /// ```ignore,no_run
13214 /// # use google_cloud_grafeas_v1::model::RepoId;
13215 /// use google_cloud_grafeas_v1::model::repo_id::Id;
13216 /// let x = RepoId::new().set_id(Some(Id::Uid("example".to_string())));
13217 /// ```
13218 pub fn set_id<T: std::convert::Into<std::option::Option<crate::model::repo_id::Id>>>(
13219 mut self,
13220 v: T,
13221 ) -> Self {
13222 self.id = v.into();
13223 self
13224 }
13225
13226 /// The value of [id][crate::model::RepoId::id]
13227 /// if it holds a `ProjectRepoId`, `None` if the field is not set or
13228 /// holds a different branch.
13229 pub fn project_repo_id(
13230 &self,
13231 ) -> std::option::Option<&std::boxed::Box<crate::model::ProjectRepoId>> {
13232 #[allow(unreachable_patterns)]
13233 self.id.as_ref().and_then(|v| match v {
13234 crate::model::repo_id::Id::ProjectRepoId(v) => std::option::Option::Some(v),
13235 _ => std::option::Option::None,
13236 })
13237 }
13238
13239 /// Sets the value of [id][crate::model::RepoId::id]
13240 /// to hold a `ProjectRepoId`.
13241 ///
13242 /// Note that all the setters affecting `id` are
13243 /// mutually exclusive.
13244 ///
13245 /// # Example
13246 /// ```ignore,no_run
13247 /// # use google_cloud_grafeas_v1::model::RepoId;
13248 /// use google_cloud_grafeas_v1::model::ProjectRepoId;
13249 /// let x = RepoId::new().set_project_repo_id(ProjectRepoId::default()/* use setters */);
13250 /// assert!(x.project_repo_id().is_some());
13251 /// assert!(x.uid().is_none());
13252 /// ```
13253 pub fn set_project_repo_id<
13254 T: std::convert::Into<std::boxed::Box<crate::model::ProjectRepoId>>,
13255 >(
13256 mut self,
13257 v: T,
13258 ) -> Self {
13259 self.id = std::option::Option::Some(crate::model::repo_id::Id::ProjectRepoId(v.into()));
13260 self
13261 }
13262
13263 /// The value of [id][crate::model::RepoId::id]
13264 /// if it holds a `Uid`, `None` if the field is not set or
13265 /// holds a different branch.
13266 pub fn uid(&self) -> std::option::Option<&std::string::String> {
13267 #[allow(unreachable_patterns)]
13268 self.id.as_ref().and_then(|v| match v {
13269 crate::model::repo_id::Id::Uid(v) => std::option::Option::Some(v),
13270 _ => std::option::Option::None,
13271 })
13272 }
13273
13274 /// Sets the value of [id][crate::model::RepoId::id]
13275 /// to hold a `Uid`.
13276 ///
13277 /// Note that all the setters affecting `id` are
13278 /// mutually exclusive.
13279 ///
13280 /// # Example
13281 /// ```ignore,no_run
13282 /// # use google_cloud_grafeas_v1::model::RepoId;
13283 /// let x = RepoId::new().set_uid("example");
13284 /// assert!(x.uid().is_some());
13285 /// assert!(x.project_repo_id().is_none());
13286 /// ```
13287 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13288 self.id = std::option::Option::Some(crate::model::repo_id::Id::Uid(v.into()));
13289 self
13290 }
13291}
13292
13293impl wkt::message::Message for RepoId {
13294 fn typename() -> &'static str {
13295 "type.googleapis.com/grafeas.v1.RepoId"
13296 }
13297}
13298
13299/// Defines additional types related to [RepoId].
13300pub mod repo_id {
13301 #[allow(unused_imports)]
13302 use super::*;
13303
13304 /// A cloud repo can be identified by either its project ID and repository name
13305 /// combination, or its globally unique identifier.
13306 #[derive(Clone, Debug, PartialEq)]
13307 #[non_exhaustive]
13308 pub enum Id {
13309 /// A combination of a project ID and a repo name.
13310 ProjectRepoId(std::boxed::Box<crate::model::ProjectRepoId>),
13311 /// A server-assigned, globally unique identifier.
13312 Uid(std::string::String),
13313 }
13314}
13315
13316/// Selects a repo using a Google Cloud Platform project ID (e.g.,
13317/// winged-cargo-31) and a repo name within that project.
13318#[derive(Clone, Default, PartialEq)]
13319#[non_exhaustive]
13320pub struct ProjectRepoId {
13321 /// The ID of the project.
13322 pub project_id: std::string::String,
13323
13324 /// The name of the repo. Leave empty for the default repo.
13325 pub repo_name: std::string::String,
13326
13327 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13328}
13329
13330impl ProjectRepoId {
13331 pub fn new() -> Self {
13332 std::default::Default::default()
13333 }
13334
13335 /// Sets the value of [project_id][crate::model::ProjectRepoId::project_id].
13336 ///
13337 /// # Example
13338 /// ```ignore,no_run
13339 /// # use google_cloud_grafeas_v1::model::ProjectRepoId;
13340 /// let x = ProjectRepoId::new().set_project_id("example");
13341 /// ```
13342 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13343 self.project_id = v.into();
13344 self
13345 }
13346
13347 /// Sets the value of [repo_name][crate::model::ProjectRepoId::repo_name].
13348 ///
13349 /// # Example
13350 /// ```ignore,no_run
13351 /// # use google_cloud_grafeas_v1::model::ProjectRepoId;
13352 /// let x = ProjectRepoId::new().set_repo_name("example");
13353 /// ```
13354 pub fn set_repo_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13355 self.repo_name = v.into();
13356 self
13357 }
13358}
13359
13360impl wkt::message::Message for ProjectRepoId {
13361 fn typename() -> &'static str {
13362 "type.googleapis.com/grafeas.v1.ProjectRepoId"
13363 }
13364}
13365
13366#[derive(Clone, Default, PartialEq)]
13367#[non_exhaustive]
13368pub struct Risk {
13369 /// CISA maintains the authoritative source of vulnerabilities that have been
13370 /// exploited in the wild.
13371 pub cisa_kev: std::option::Option<crate::model::CISAKnownExploitedVulnerabilities>,
13372
13373 /// The Exploit Prediction Scoring System (EPSS) estimates the likelihood
13374 /// (probability) that a software vulnerability will be exploited in the wild.
13375 pub epss: std::option::Option<crate::model::ExploitPredictionScoringSystem>,
13376
13377 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13378}
13379
13380impl Risk {
13381 pub fn new() -> Self {
13382 std::default::Default::default()
13383 }
13384
13385 /// Sets the value of [cisa_kev][crate::model::Risk::cisa_kev].
13386 ///
13387 /// # Example
13388 /// ```ignore,no_run
13389 /// # use google_cloud_grafeas_v1::model::Risk;
13390 /// use google_cloud_grafeas_v1::model::CISAKnownExploitedVulnerabilities;
13391 /// let x = Risk::new().set_cisa_kev(CISAKnownExploitedVulnerabilities::default()/* use setters */);
13392 /// ```
13393 pub fn set_cisa_kev<T>(mut self, v: T) -> Self
13394 where
13395 T: std::convert::Into<crate::model::CISAKnownExploitedVulnerabilities>,
13396 {
13397 self.cisa_kev = std::option::Option::Some(v.into());
13398 self
13399 }
13400
13401 /// Sets or clears the value of [cisa_kev][crate::model::Risk::cisa_kev].
13402 ///
13403 /// # Example
13404 /// ```ignore,no_run
13405 /// # use google_cloud_grafeas_v1::model::Risk;
13406 /// use google_cloud_grafeas_v1::model::CISAKnownExploitedVulnerabilities;
13407 /// let x = Risk::new().set_or_clear_cisa_kev(Some(CISAKnownExploitedVulnerabilities::default()/* use setters */));
13408 /// let x = Risk::new().set_or_clear_cisa_kev(None::<CISAKnownExploitedVulnerabilities>);
13409 /// ```
13410 pub fn set_or_clear_cisa_kev<T>(mut self, v: std::option::Option<T>) -> Self
13411 where
13412 T: std::convert::Into<crate::model::CISAKnownExploitedVulnerabilities>,
13413 {
13414 self.cisa_kev = v.map(|x| x.into());
13415 self
13416 }
13417
13418 /// Sets the value of [epss][crate::model::Risk::epss].
13419 ///
13420 /// # Example
13421 /// ```ignore,no_run
13422 /// # use google_cloud_grafeas_v1::model::Risk;
13423 /// use google_cloud_grafeas_v1::model::ExploitPredictionScoringSystem;
13424 /// let x = Risk::new().set_epss(ExploitPredictionScoringSystem::default()/* use setters */);
13425 /// ```
13426 pub fn set_epss<T>(mut self, v: T) -> Self
13427 where
13428 T: std::convert::Into<crate::model::ExploitPredictionScoringSystem>,
13429 {
13430 self.epss = std::option::Option::Some(v.into());
13431 self
13432 }
13433
13434 /// Sets or clears the value of [epss][crate::model::Risk::epss].
13435 ///
13436 /// # Example
13437 /// ```ignore,no_run
13438 /// # use google_cloud_grafeas_v1::model::Risk;
13439 /// use google_cloud_grafeas_v1::model::ExploitPredictionScoringSystem;
13440 /// let x = Risk::new().set_or_clear_epss(Some(ExploitPredictionScoringSystem::default()/* use setters */));
13441 /// let x = Risk::new().set_or_clear_epss(None::<ExploitPredictionScoringSystem>);
13442 /// ```
13443 pub fn set_or_clear_epss<T>(mut self, v: std::option::Option<T>) -> Self
13444 where
13445 T: std::convert::Into<crate::model::ExploitPredictionScoringSystem>,
13446 {
13447 self.epss = v.map(|x| x.into());
13448 self
13449 }
13450}
13451
13452impl wkt::message::Message for Risk {
13453 fn typename() -> &'static str {
13454 "type.googleapis.com/grafeas.v1.Risk"
13455 }
13456}
13457
13458#[derive(Clone, Default, PartialEq)]
13459#[non_exhaustive]
13460pub struct CISAKnownExploitedVulnerabilities {
13461 /// Whether the vulnerability is known to have been leveraged as part of a
13462 /// ransomware campaign.
13463 pub known_ransomware_campaign_use: std::string::String,
13464
13465 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13466}
13467
13468impl CISAKnownExploitedVulnerabilities {
13469 pub fn new() -> Self {
13470 std::default::Default::default()
13471 }
13472
13473 /// Sets the value of [known_ransomware_campaign_use][crate::model::CISAKnownExploitedVulnerabilities::known_ransomware_campaign_use].
13474 ///
13475 /// # Example
13476 /// ```ignore,no_run
13477 /// # use google_cloud_grafeas_v1::model::CISAKnownExploitedVulnerabilities;
13478 /// let x = CISAKnownExploitedVulnerabilities::new().set_known_ransomware_campaign_use("example");
13479 /// ```
13480 pub fn set_known_ransomware_campaign_use<T: std::convert::Into<std::string::String>>(
13481 mut self,
13482 v: T,
13483 ) -> Self {
13484 self.known_ransomware_campaign_use = v.into();
13485 self
13486 }
13487}
13488
13489impl wkt::message::Message for CISAKnownExploitedVulnerabilities {
13490 fn typename() -> &'static str {
13491 "type.googleapis.com/grafeas.v1.CISAKnownExploitedVulnerabilities"
13492 }
13493}
13494
13495#[derive(Clone, Default, PartialEq)]
13496#[non_exhaustive]
13497pub struct ExploitPredictionScoringSystem {
13498 /// The percentile of the current score, the proportion of all scored
13499 /// vulnerabilities with the same or a lower EPSS score
13500 pub percentile: f64,
13501
13502 /// The EPSS score representing the probability [0-1] of exploitation in the
13503 /// wild in the next 30 days
13504 pub score: f64,
13505
13506 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13507}
13508
13509impl ExploitPredictionScoringSystem {
13510 pub fn new() -> Self {
13511 std::default::Default::default()
13512 }
13513
13514 /// Sets the value of [percentile][crate::model::ExploitPredictionScoringSystem::percentile].
13515 ///
13516 /// # Example
13517 /// ```ignore,no_run
13518 /// # use google_cloud_grafeas_v1::model::ExploitPredictionScoringSystem;
13519 /// let x = ExploitPredictionScoringSystem::new().set_percentile(42.0);
13520 /// ```
13521 pub fn set_percentile<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
13522 self.percentile = v.into();
13523 self
13524 }
13525
13526 /// Sets the value of [score][crate::model::ExploitPredictionScoringSystem::score].
13527 ///
13528 /// # Example
13529 /// ```ignore,no_run
13530 /// # use google_cloud_grafeas_v1::model::ExploitPredictionScoringSystem;
13531 /// let x = ExploitPredictionScoringSystem::new().set_score(42.0);
13532 /// ```
13533 pub fn set_score<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
13534 self.score = v.into();
13535 self
13536 }
13537}
13538
13539impl wkt::message::Message for ExploitPredictionScoringSystem {
13540 fn typename() -> &'static str {
13541 "type.googleapis.com/grafeas.v1.ExploitPredictionScoringSystem"
13542 }
13543}
13544
13545/// The note representing an SBOM reference.
13546#[derive(Clone, Default, PartialEq)]
13547#[non_exhaustive]
13548pub struct SBOMReferenceNote {
13549 /// The format that SBOM takes. E.g. may be spdx, cyclonedx, etc...
13550 pub format: std::string::String,
13551
13552 /// The version of the format that the SBOM takes. E.g. if the format
13553 /// is spdx, the version may be 2.3.
13554 pub version: std::string::String,
13555
13556 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13557}
13558
13559impl SBOMReferenceNote {
13560 pub fn new() -> Self {
13561 std::default::Default::default()
13562 }
13563
13564 /// Sets the value of [format][crate::model::SBOMReferenceNote::format].
13565 ///
13566 /// # Example
13567 /// ```ignore,no_run
13568 /// # use google_cloud_grafeas_v1::model::SBOMReferenceNote;
13569 /// let x = SBOMReferenceNote::new().set_format("example");
13570 /// ```
13571 pub fn set_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13572 self.format = v.into();
13573 self
13574 }
13575
13576 /// Sets the value of [version][crate::model::SBOMReferenceNote::version].
13577 ///
13578 /// # Example
13579 /// ```ignore,no_run
13580 /// # use google_cloud_grafeas_v1::model::SBOMReferenceNote;
13581 /// let x = SBOMReferenceNote::new().set_version("example");
13582 /// ```
13583 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13584 self.version = v.into();
13585 self
13586 }
13587}
13588
13589impl wkt::message::Message for SBOMReferenceNote {
13590 fn typename() -> &'static str {
13591 "type.googleapis.com/grafeas.v1.SBOMReferenceNote"
13592 }
13593}
13594
13595/// The occurrence representing an SBOM reference as applied to a specific
13596/// resource. The occurrence follows the DSSE specification. See
13597/// <https://github.com/secure-systems-lab/dsse/blob/master/envelope.md> for more
13598/// details.
13599#[derive(Clone, Default, PartialEq)]
13600#[non_exhaustive]
13601pub struct SBOMReferenceOccurrence {
13602 /// The actual payload that contains the SBOM reference data.
13603 pub payload: std::option::Option<crate::model::SbomReferenceIntotoPayload>,
13604
13605 /// The kind of payload that SbomReferenceIntotoPayload takes. Since it's in
13606 /// the intoto format, this value is expected to be
13607 /// 'application/vnd.in-toto+json'.
13608 pub payload_type: std::string::String,
13609
13610 /// The signatures over the payload.
13611 pub signatures: std::vec::Vec<crate::model::EnvelopeSignature>,
13612
13613 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13614}
13615
13616impl SBOMReferenceOccurrence {
13617 pub fn new() -> Self {
13618 std::default::Default::default()
13619 }
13620
13621 /// Sets the value of [payload][crate::model::SBOMReferenceOccurrence::payload].
13622 ///
13623 /// # Example
13624 /// ```ignore,no_run
13625 /// # use google_cloud_grafeas_v1::model::SBOMReferenceOccurrence;
13626 /// use google_cloud_grafeas_v1::model::SbomReferenceIntotoPayload;
13627 /// let x = SBOMReferenceOccurrence::new().set_payload(SbomReferenceIntotoPayload::default()/* use setters */);
13628 /// ```
13629 pub fn set_payload<T>(mut self, v: T) -> Self
13630 where
13631 T: std::convert::Into<crate::model::SbomReferenceIntotoPayload>,
13632 {
13633 self.payload = std::option::Option::Some(v.into());
13634 self
13635 }
13636
13637 /// Sets or clears the value of [payload][crate::model::SBOMReferenceOccurrence::payload].
13638 ///
13639 /// # Example
13640 /// ```ignore,no_run
13641 /// # use google_cloud_grafeas_v1::model::SBOMReferenceOccurrence;
13642 /// use google_cloud_grafeas_v1::model::SbomReferenceIntotoPayload;
13643 /// let x = SBOMReferenceOccurrence::new().set_or_clear_payload(Some(SbomReferenceIntotoPayload::default()/* use setters */));
13644 /// let x = SBOMReferenceOccurrence::new().set_or_clear_payload(None::<SbomReferenceIntotoPayload>);
13645 /// ```
13646 pub fn set_or_clear_payload<T>(mut self, v: std::option::Option<T>) -> Self
13647 where
13648 T: std::convert::Into<crate::model::SbomReferenceIntotoPayload>,
13649 {
13650 self.payload = v.map(|x| x.into());
13651 self
13652 }
13653
13654 /// Sets the value of [payload_type][crate::model::SBOMReferenceOccurrence::payload_type].
13655 ///
13656 /// # Example
13657 /// ```ignore,no_run
13658 /// # use google_cloud_grafeas_v1::model::SBOMReferenceOccurrence;
13659 /// let x = SBOMReferenceOccurrence::new().set_payload_type("example");
13660 /// ```
13661 pub fn set_payload_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13662 self.payload_type = v.into();
13663 self
13664 }
13665
13666 /// Sets the value of [signatures][crate::model::SBOMReferenceOccurrence::signatures].
13667 ///
13668 /// # Example
13669 /// ```ignore,no_run
13670 /// # use google_cloud_grafeas_v1::model::SBOMReferenceOccurrence;
13671 /// use google_cloud_grafeas_v1::model::EnvelopeSignature;
13672 /// let x = SBOMReferenceOccurrence::new()
13673 /// .set_signatures([
13674 /// EnvelopeSignature::default()/* use setters */,
13675 /// EnvelopeSignature::default()/* use (different) setters */,
13676 /// ]);
13677 /// ```
13678 pub fn set_signatures<T, V>(mut self, v: T) -> Self
13679 where
13680 T: std::iter::IntoIterator<Item = V>,
13681 V: std::convert::Into<crate::model::EnvelopeSignature>,
13682 {
13683 use std::iter::Iterator;
13684 self.signatures = v.into_iter().map(|i| i.into()).collect();
13685 self
13686 }
13687}
13688
13689impl wkt::message::Message for SBOMReferenceOccurrence {
13690 fn typename() -> &'static str {
13691 "type.googleapis.com/grafeas.v1.SBOMReferenceOccurrence"
13692 }
13693}
13694
13695/// The actual payload that contains the SBOM Reference data.
13696/// The payload follows the intoto statement specification. See
13697/// <https://github.com/in-toto/attestation/blob/main/spec/v1.0/statement.md>
13698/// for more details.
13699#[derive(Clone, Default, PartialEq)]
13700#[non_exhaustive]
13701pub struct SbomReferenceIntotoPayload {
13702 /// Identifier for the schema of the Statement.
13703 pub r#type: std::string::String,
13704
13705 /// URI identifying the type of the Predicate.
13706 pub predicate_type: std::string::String,
13707
13708 /// Set of software artifacts that the attestation applies to. Each element
13709 /// represents a single software artifact.
13710 pub subject: std::vec::Vec<crate::model::Subject>,
13711
13712 /// Additional parameters of the Predicate. Includes the actual data about the
13713 /// SBOM.
13714 pub predicate: std::option::Option<crate::model::SbomReferenceIntotoPredicate>,
13715
13716 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13717}
13718
13719impl SbomReferenceIntotoPayload {
13720 pub fn new() -> Self {
13721 std::default::Default::default()
13722 }
13723
13724 /// Sets the value of [r#type][crate::model::SbomReferenceIntotoPayload::type].
13725 ///
13726 /// # Example
13727 /// ```ignore,no_run
13728 /// # use google_cloud_grafeas_v1::model::SbomReferenceIntotoPayload;
13729 /// let x = SbomReferenceIntotoPayload::new().set_type("example");
13730 /// ```
13731 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13732 self.r#type = v.into();
13733 self
13734 }
13735
13736 /// Sets the value of [predicate_type][crate::model::SbomReferenceIntotoPayload::predicate_type].
13737 ///
13738 /// # Example
13739 /// ```ignore,no_run
13740 /// # use google_cloud_grafeas_v1::model::SbomReferenceIntotoPayload;
13741 /// let x = SbomReferenceIntotoPayload::new().set_predicate_type("example");
13742 /// ```
13743 pub fn set_predicate_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13744 self.predicate_type = v.into();
13745 self
13746 }
13747
13748 /// Sets the value of [subject][crate::model::SbomReferenceIntotoPayload::subject].
13749 ///
13750 /// # Example
13751 /// ```ignore,no_run
13752 /// # use google_cloud_grafeas_v1::model::SbomReferenceIntotoPayload;
13753 /// use google_cloud_grafeas_v1::model::Subject;
13754 /// let x = SbomReferenceIntotoPayload::new()
13755 /// .set_subject([
13756 /// Subject::default()/* use setters */,
13757 /// Subject::default()/* use (different) setters */,
13758 /// ]);
13759 /// ```
13760 pub fn set_subject<T, V>(mut self, v: T) -> Self
13761 where
13762 T: std::iter::IntoIterator<Item = V>,
13763 V: std::convert::Into<crate::model::Subject>,
13764 {
13765 use std::iter::Iterator;
13766 self.subject = v.into_iter().map(|i| i.into()).collect();
13767 self
13768 }
13769
13770 /// Sets the value of [predicate][crate::model::SbomReferenceIntotoPayload::predicate].
13771 ///
13772 /// # Example
13773 /// ```ignore,no_run
13774 /// # use google_cloud_grafeas_v1::model::SbomReferenceIntotoPayload;
13775 /// use google_cloud_grafeas_v1::model::SbomReferenceIntotoPredicate;
13776 /// let x = SbomReferenceIntotoPayload::new().set_predicate(SbomReferenceIntotoPredicate::default()/* use setters */);
13777 /// ```
13778 pub fn set_predicate<T>(mut self, v: T) -> Self
13779 where
13780 T: std::convert::Into<crate::model::SbomReferenceIntotoPredicate>,
13781 {
13782 self.predicate = std::option::Option::Some(v.into());
13783 self
13784 }
13785
13786 /// Sets or clears the value of [predicate][crate::model::SbomReferenceIntotoPayload::predicate].
13787 ///
13788 /// # Example
13789 /// ```ignore,no_run
13790 /// # use google_cloud_grafeas_v1::model::SbomReferenceIntotoPayload;
13791 /// use google_cloud_grafeas_v1::model::SbomReferenceIntotoPredicate;
13792 /// let x = SbomReferenceIntotoPayload::new().set_or_clear_predicate(Some(SbomReferenceIntotoPredicate::default()/* use setters */));
13793 /// let x = SbomReferenceIntotoPayload::new().set_or_clear_predicate(None::<SbomReferenceIntotoPredicate>);
13794 /// ```
13795 pub fn set_or_clear_predicate<T>(mut self, v: std::option::Option<T>) -> Self
13796 where
13797 T: std::convert::Into<crate::model::SbomReferenceIntotoPredicate>,
13798 {
13799 self.predicate = v.map(|x| x.into());
13800 self
13801 }
13802}
13803
13804impl wkt::message::Message for SbomReferenceIntotoPayload {
13805 fn typename() -> &'static str {
13806 "type.googleapis.com/grafeas.v1.SbomReferenceIntotoPayload"
13807 }
13808}
13809
13810/// A predicate which describes the SBOM being referenced.
13811#[derive(Clone, Default, PartialEq)]
13812#[non_exhaustive]
13813pub struct SbomReferenceIntotoPredicate {
13814 /// The person or system referring this predicate to the consumer.
13815 pub referrer_id: std::string::String,
13816
13817 /// The location of the SBOM.
13818 pub location: std::string::String,
13819
13820 /// The mime type of the SBOM.
13821 pub mime_type: std::string::String,
13822
13823 /// A map of algorithm to digest of the contents of the SBOM.
13824 pub digest: std::collections::HashMap<std::string::String, std::string::String>,
13825
13826 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13827}
13828
13829impl SbomReferenceIntotoPredicate {
13830 pub fn new() -> Self {
13831 std::default::Default::default()
13832 }
13833
13834 /// Sets the value of [referrer_id][crate::model::SbomReferenceIntotoPredicate::referrer_id].
13835 ///
13836 /// # Example
13837 /// ```ignore,no_run
13838 /// # use google_cloud_grafeas_v1::model::SbomReferenceIntotoPredicate;
13839 /// let x = SbomReferenceIntotoPredicate::new().set_referrer_id("example");
13840 /// ```
13841 pub fn set_referrer_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13842 self.referrer_id = v.into();
13843 self
13844 }
13845
13846 /// Sets the value of [location][crate::model::SbomReferenceIntotoPredicate::location].
13847 ///
13848 /// # Example
13849 /// ```ignore,no_run
13850 /// # use google_cloud_grafeas_v1::model::SbomReferenceIntotoPredicate;
13851 /// let x = SbomReferenceIntotoPredicate::new().set_location("example");
13852 /// ```
13853 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13854 self.location = v.into();
13855 self
13856 }
13857
13858 /// Sets the value of [mime_type][crate::model::SbomReferenceIntotoPredicate::mime_type].
13859 ///
13860 /// # Example
13861 /// ```ignore,no_run
13862 /// # use google_cloud_grafeas_v1::model::SbomReferenceIntotoPredicate;
13863 /// let x = SbomReferenceIntotoPredicate::new().set_mime_type("example");
13864 /// ```
13865 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13866 self.mime_type = v.into();
13867 self
13868 }
13869
13870 /// Sets the value of [digest][crate::model::SbomReferenceIntotoPredicate::digest].
13871 ///
13872 /// # Example
13873 /// ```ignore,no_run
13874 /// # use google_cloud_grafeas_v1::model::SbomReferenceIntotoPredicate;
13875 /// let x = SbomReferenceIntotoPredicate::new().set_digest([
13876 /// ("key0", "abc"),
13877 /// ("key1", "xyz"),
13878 /// ]);
13879 /// ```
13880 pub fn set_digest<T, K, V>(mut self, v: T) -> Self
13881 where
13882 T: std::iter::IntoIterator<Item = (K, V)>,
13883 K: std::convert::Into<std::string::String>,
13884 V: std::convert::Into<std::string::String>,
13885 {
13886 use std::iter::Iterator;
13887 self.digest = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13888 self
13889 }
13890}
13891
13892impl wkt::message::Message for SbomReferenceIntotoPredicate {
13893 fn typename() -> &'static str {
13894 "type.googleapis.com/grafeas.v1.SbomReferenceIntotoPredicate"
13895 }
13896}
13897
13898/// The note representing a secret.
13899#[derive(Clone, Default, PartialEq)]
13900#[non_exhaustive]
13901pub struct SecretNote {
13902 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13903}
13904
13905impl SecretNote {
13906 pub fn new() -> Self {
13907 std::default::Default::default()
13908 }
13909}
13910
13911impl wkt::message::Message for SecretNote {
13912 fn typename() -> &'static str {
13913 "type.googleapis.com/grafeas.v1.SecretNote"
13914 }
13915}
13916
13917/// The occurrence provides details of a secret.
13918#[derive(Clone, Default, PartialEq)]
13919#[non_exhaustive]
13920pub struct SecretOccurrence {
13921 /// Type of secret.
13922 pub kind: crate::model::SecretKind,
13923
13924 /// Locations where the secret is detected.
13925 pub locations: std::vec::Vec<crate::model::SecretLocation>,
13926
13927 /// Status of the secret.
13928 pub statuses: std::vec::Vec<crate::model::SecretStatus>,
13929
13930 /// Scan result of the secret.
13931 pub data: std::option::Option<wkt::Any>,
13932
13933 /// Hash value, typically a digest for the secret data, that allows unique
13934 /// identification of a specific secret.
13935 pub digest: std::option::Option<crate::model::Digest>,
13936
13937 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13938}
13939
13940impl SecretOccurrence {
13941 pub fn new() -> Self {
13942 std::default::Default::default()
13943 }
13944
13945 /// Sets the value of [kind][crate::model::SecretOccurrence::kind].
13946 ///
13947 /// # Example
13948 /// ```ignore,no_run
13949 /// # use google_cloud_grafeas_v1::model::SecretOccurrence;
13950 /// use google_cloud_grafeas_v1::model::SecretKind;
13951 /// let x0 = SecretOccurrence::new().set_kind(SecretKind::Unknown);
13952 /// let x1 = SecretOccurrence::new().set_kind(SecretKind::GcpServiceAccountKey);
13953 /// let x2 = SecretOccurrence::new().set_kind(SecretKind::GcpApiKey);
13954 /// ```
13955 pub fn set_kind<T: std::convert::Into<crate::model::SecretKind>>(mut self, v: T) -> Self {
13956 self.kind = v.into();
13957 self
13958 }
13959
13960 /// Sets the value of [locations][crate::model::SecretOccurrence::locations].
13961 ///
13962 /// # Example
13963 /// ```ignore,no_run
13964 /// # use google_cloud_grafeas_v1::model::SecretOccurrence;
13965 /// use google_cloud_grafeas_v1::model::SecretLocation;
13966 /// let x = SecretOccurrence::new()
13967 /// .set_locations([
13968 /// SecretLocation::default()/* use setters */,
13969 /// SecretLocation::default()/* use (different) setters */,
13970 /// ]);
13971 /// ```
13972 pub fn set_locations<T, V>(mut self, v: T) -> Self
13973 where
13974 T: std::iter::IntoIterator<Item = V>,
13975 V: std::convert::Into<crate::model::SecretLocation>,
13976 {
13977 use std::iter::Iterator;
13978 self.locations = v.into_iter().map(|i| i.into()).collect();
13979 self
13980 }
13981
13982 /// Sets the value of [statuses][crate::model::SecretOccurrence::statuses].
13983 ///
13984 /// # Example
13985 /// ```ignore,no_run
13986 /// # use google_cloud_grafeas_v1::model::SecretOccurrence;
13987 /// use google_cloud_grafeas_v1::model::SecretStatus;
13988 /// let x = SecretOccurrence::new()
13989 /// .set_statuses([
13990 /// SecretStatus::default()/* use setters */,
13991 /// SecretStatus::default()/* use (different) setters */,
13992 /// ]);
13993 /// ```
13994 pub fn set_statuses<T, V>(mut self, v: T) -> Self
13995 where
13996 T: std::iter::IntoIterator<Item = V>,
13997 V: std::convert::Into<crate::model::SecretStatus>,
13998 {
13999 use std::iter::Iterator;
14000 self.statuses = v.into_iter().map(|i| i.into()).collect();
14001 self
14002 }
14003
14004 /// Sets the value of [data][crate::model::SecretOccurrence::data].
14005 ///
14006 /// # Example
14007 /// ```ignore,no_run
14008 /// # use google_cloud_grafeas_v1::model::SecretOccurrence;
14009 /// use wkt::Any;
14010 /// let x = SecretOccurrence::new().set_data(Any::default()/* use setters */);
14011 /// ```
14012 pub fn set_data<T>(mut self, v: T) -> Self
14013 where
14014 T: std::convert::Into<wkt::Any>,
14015 {
14016 self.data = std::option::Option::Some(v.into());
14017 self
14018 }
14019
14020 /// Sets or clears the value of [data][crate::model::SecretOccurrence::data].
14021 ///
14022 /// # Example
14023 /// ```ignore,no_run
14024 /// # use google_cloud_grafeas_v1::model::SecretOccurrence;
14025 /// use wkt::Any;
14026 /// let x = SecretOccurrence::new().set_or_clear_data(Some(Any::default()/* use setters */));
14027 /// let x = SecretOccurrence::new().set_or_clear_data(None::<Any>);
14028 /// ```
14029 pub fn set_or_clear_data<T>(mut self, v: std::option::Option<T>) -> Self
14030 where
14031 T: std::convert::Into<wkt::Any>,
14032 {
14033 self.data = v.map(|x| x.into());
14034 self
14035 }
14036
14037 /// Sets the value of [digest][crate::model::SecretOccurrence::digest].
14038 ///
14039 /// # Example
14040 /// ```ignore,no_run
14041 /// # use google_cloud_grafeas_v1::model::SecretOccurrence;
14042 /// use google_cloud_grafeas_v1::model::Digest;
14043 /// let x = SecretOccurrence::new().set_digest(Digest::default()/* use setters */);
14044 /// ```
14045 pub fn set_digest<T>(mut self, v: T) -> Self
14046 where
14047 T: std::convert::Into<crate::model::Digest>,
14048 {
14049 self.digest = std::option::Option::Some(v.into());
14050 self
14051 }
14052
14053 /// Sets or clears the value of [digest][crate::model::SecretOccurrence::digest].
14054 ///
14055 /// # Example
14056 /// ```ignore,no_run
14057 /// # use google_cloud_grafeas_v1::model::SecretOccurrence;
14058 /// use google_cloud_grafeas_v1::model::Digest;
14059 /// let x = SecretOccurrence::new().set_or_clear_digest(Some(Digest::default()/* use setters */));
14060 /// let x = SecretOccurrence::new().set_or_clear_digest(None::<Digest>);
14061 /// ```
14062 pub fn set_or_clear_digest<T>(mut self, v: std::option::Option<T>) -> Self
14063 where
14064 T: std::convert::Into<crate::model::Digest>,
14065 {
14066 self.digest = v.map(|x| x.into());
14067 self
14068 }
14069}
14070
14071impl wkt::message::Message for SecretOccurrence {
14072 fn typename() -> &'static str {
14073 "type.googleapis.com/grafeas.v1.SecretOccurrence"
14074 }
14075}
14076
14077/// The location of the secret.
14078#[derive(Clone, Default, PartialEq)]
14079#[non_exhaustive]
14080pub struct SecretLocation {
14081 /// The detailed location of the secret.
14082 pub location: std::option::Option<crate::model::secret_location::Location>,
14083
14084 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14085}
14086
14087impl SecretLocation {
14088 pub fn new() -> Self {
14089 std::default::Default::default()
14090 }
14091
14092 /// Sets the value of [location][crate::model::SecretLocation::location].
14093 ///
14094 /// Note that all the setters affecting `location` are mutually
14095 /// exclusive.
14096 ///
14097 /// # Example
14098 /// ```ignore,no_run
14099 /// # use google_cloud_grafeas_v1::model::SecretLocation;
14100 /// use google_cloud_grafeas_v1::model::FileLocation;
14101 /// let x = SecretLocation::new().set_location(Some(
14102 /// google_cloud_grafeas_v1::model::secret_location::Location::FileLocation(FileLocation::default().into())));
14103 /// ```
14104 pub fn set_location<
14105 T: std::convert::Into<std::option::Option<crate::model::secret_location::Location>>,
14106 >(
14107 mut self,
14108 v: T,
14109 ) -> Self {
14110 self.location = v.into();
14111 self
14112 }
14113
14114 /// The value of [location][crate::model::SecretLocation::location]
14115 /// if it holds a `FileLocation`, `None` if the field is not set or
14116 /// holds a different branch.
14117 pub fn file_location(
14118 &self,
14119 ) -> std::option::Option<&std::boxed::Box<crate::model::FileLocation>> {
14120 #[allow(unreachable_patterns)]
14121 self.location.as_ref().and_then(|v| match v {
14122 crate::model::secret_location::Location::FileLocation(v) => {
14123 std::option::Option::Some(v)
14124 }
14125 _ => std::option::Option::None,
14126 })
14127 }
14128
14129 /// Sets the value of [location][crate::model::SecretLocation::location]
14130 /// to hold a `FileLocation`.
14131 ///
14132 /// Note that all the setters affecting `location` are
14133 /// mutually exclusive.
14134 ///
14135 /// # Example
14136 /// ```ignore,no_run
14137 /// # use google_cloud_grafeas_v1::model::SecretLocation;
14138 /// use google_cloud_grafeas_v1::model::FileLocation;
14139 /// let x = SecretLocation::new().set_file_location(FileLocation::default()/* use setters */);
14140 /// assert!(x.file_location().is_some());
14141 /// ```
14142 pub fn set_file_location<T: std::convert::Into<std::boxed::Box<crate::model::FileLocation>>>(
14143 mut self,
14144 v: T,
14145 ) -> Self {
14146 self.location = std::option::Option::Some(
14147 crate::model::secret_location::Location::FileLocation(v.into()),
14148 );
14149 self
14150 }
14151}
14152
14153impl wkt::message::Message for SecretLocation {
14154 fn typename() -> &'static str {
14155 "type.googleapis.com/grafeas.v1.SecretLocation"
14156 }
14157}
14158
14159/// Defines additional types related to [SecretLocation].
14160pub mod secret_location {
14161 #[allow(unused_imports)]
14162 use super::*;
14163
14164 /// The detailed location of the secret.
14165 #[derive(Clone, Debug, PartialEq)]
14166 #[non_exhaustive]
14167 pub enum Location {
14168 /// The secret is found from a file.
14169 FileLocation(std::boxed::Box<crate::model::FileLocation>),
14170 }
14171}
14172
14173/// The status of the secret with a timestamp.
14174#[derive(Clone, Default, PartialEq)]
14175#[non_exhaustive]
14176pub struct SecretStatus {
14177 /// The status of the secret.
14178 pub status: crate::model::secret_status::Status,
14179
14180 /// The time the secret status was last updated.
14181 pub update_time: std::option::Option<wkt::Timestamp>,
14182
14183 /// Optional message about the status code.
14184 pub message: std::string::String,
14185
14186 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14187}
14188
14189impl SecretStatus {
14190 pub fn new() -> Self {
14191 std::default::Default::default()
14192 }
14193
14194 /// Sets the value of [status][crate::model::SecretStatus::status].
14195 ///
14196 /// # Example
14197 /// ```ignore,no_run
14198 /// # use google_cloud_grafeas_v1::model::SecretStatus;
14199 /// use google_cloud_grafeas_v1::model::secret_status::Status;
14200 /// let x0 = SecretStatus::new().set_status(Status::Unknown);
14201 /// let x1 = SecretStatus::new().set_status(Status::Valid);
14202 /// let x2 = SecretStatus::new().set_status(Status::Invalid);
14203 /// ```
14204 pub fn set_status<T: std::convert::Into<crate::model::secret_status::Status>>(
14205 mut self,
14206 v: T,
14207 ) -> Self {
14208 self.status = v.into();
14209 self
14210 }
14211
14212 /// Sets the value of [update_time][crate::model::SecretStatus::update_time].
14213 ///
14214 /// # Example
14215 /// ```ignore,no_run
14216 /// # use google_cloud_grafeas_v1::model::SecretStatus;
14217 /// use wkt::Timestamp;
14218 /// let x = SecretStatus::new().set_update_time(Timestamp::default()/* use setters */);
14219 /// ```
14220 pub fn set_update_time<T>(mut self, v: T) -> Self
14221 where
14222 T: std::convert::Into<wkt::Timestamp>,
14223 {
14224 self.update_time = std::option::Option::Some(v.into());
14225 self
14226 }
14227
14228 /// Sets or clears the value of [update_time][crate::model::SecretStatus::update_time].
14229 ///
14230 /// # Example
14231 /// ```ignore,no_run
14232 /// # use google_cloud_grafeas_v1::model::SecretStatus;
14233 /// use wkt::Timestamp;
14234 /// let x = SecretStatus::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
14235 /// let x = SecretStatus::new().set_or_clear_update_time(None::<Timestamp>);
14236 /// ```
14237 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
14238 where
14239 T: std::convert::Into<wkt::Timestamp>,
14240 {
14241 self.update_time = v.map(|x| x.into());
14242 self
14243 }
14244
14245 /// Sets the value of [message][crate::model::SecretStatus::message].
14246 ///
14247 /// # Example
14248 /// ```ignore,no_run
14249 /// # use google_cloud_grafeas_v1::model::SecretStatus;
14250 /// let x = SecretStatus::new().set_message("example");
14251 /// ```
14252 pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14253 self.message = v.into();
14254 self
14255 }
14256}
14257
14258impl wkt::message::Message for SecretStatus {
14259 fn typename() -> &'static str {
14260 "type.googleapis.com/grafeas.v1.SecretStatus"
14261 }
14262}
14263
14264/// Defines additional types related to [SecretStatus].
14265pub mod secret_status {
14266 #[allow(unused_imports)]
14267 use super::*;
14268
14269 /// The status of the secret.
14270 ///
14271 /// # Working with unknown values
14272 ///
14273 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14274 /// additional enum variants at any time. Adding new variants is not considered
14275 /// a breaking change. Applications should write their code in anticipation of:
14276 ///
14277 /// - New values appearing in future releases of the client library, **and**
14278 /// - New values received dynamically, without application changes.
14279 ///
14280 /// Please consult the [Working with enums] section in the user guide for some
14281 /// guidelines.
14282 ///
14283 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14284 #[derive(Clone, Debug, PartialEq)]
14285 #[non_exhaustive]
14286 pub enum Status {
14287 /// Unspecified
14288 Unspecified,
14289 /// The status of the secret is unknown.
14290 Unknown,
14291 /// The secret is valid.
14292 Valid,
14293 /// The secret is invalid.
14294 Invalid,
14295 /// If set, the enum was initialized with an unknown value.
14296 ///
14297 /// Applications can examine the value using [Status::value] or
14298 /// [Status::name].
14299 UnknownValue(status::UnknownValue),
14300 }
14301
14302 #[doc(hidden)]
14303 pub mod status {
14304 #[allow(unused_imports)]
14305 use super::*;
14306 #[derive(Clone, Debug, PartialEq)]
14307 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14308 }
14309
14310 impl Status {
14311 /// Gets the enum value.
14312 ///
14313 /// Returns `None` if the enum contains an unknown value deserialized from
14314 /// the string representation of enums.
14315 pub fn value(&self) -> std::option::Option<i32> {
14316 match self {
14317 Self::Unspecified => std::option::Option::Some(0),
14318 Self::Unknown => std::option::Option::Some(1),
14319 Self::Valid => std::option::Option::Some(2),
14320 Self::Invalid => std::option::Option::Some(3),
14321 Self::UnknownValue(u) => u.0.value(),
14322 }
14323 }
14324
14325 /// Gets the enum value as a string.
14326 ///
14327 /// Returns `None` if the enum contains an unknown value deserialized from
14328 /// the integer representation of enums.
14329 pub fn name(&self) -> std::option::Option<&str> {
14330 match self {
14331 Self::Unspecified => std::option::Option::Some("STATUS_UNSPECIFIED"),
14332 Self::Unknown => std::option::Option::Some("UNKNOWN"),
14333 Self::Valid => std::option::Option::Some("VALID"),
14334 Self::Invalid => std::option::Option::Some("INVALID"),
14335 Self::UnknownValue(u) => u.0.name(),
14336 }
14337 }
14338 }
14339
14340 impl std::default::Default for Status {
14341 fn default() -> Self {
14342 use std::convert::From;
14343 Self::from(0)
14344 }
14345 }
14346
14347 impl std::fmt::Display for Status {
14348 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14349 wkt::internal::display_enum(f, self.name(), self.value())
14350 }
14351 }
14352
14353 impl std::convert::From<i32> for Status {
14354 fn from(value: i32) -> Self {
14355 match value {
14356 0 => Self::Unspecified,
14357 1 => Self::Unknown,
14358 2 => Self::Valid,
14359 3 => Self::Invalid,
14360 _ => Self::UnknownValue(status::UnknownValue(
14361 wkt::internal::UnknownEnumValue::Integer(value),
14362 )),
14363 }
14364 }
14365 }
14366
14367 impl std::convert::From<&str> for Status {
14368 fn from(value: &str) -> Self {
14369 use std::string::ToString;
14370 match value {
14371 "STATUS_UNSPECIFIED" => Self::Unspecified,
14372 "UNKNOWN" => Self::Unknown,
14373 "VALID" => Self::Valid,
14374 "INVALID" => Self::Invalid,
14375 _ => Self::UnknownValue(status::UnknownValue(
14376 wkt::internal::UnknownEnumValue::String(value.to_string()),
14377 )),
14378 }
14379 }
14380 }
14381
14382 impl serde::ser::Serialize for Status {
14383 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14384 where
14385 S: serde::Serializer,
14386 {
14387 match self {
14388 Self::Unspecified => serializer.serialize_i32(0),
14389 Self::Unknown => serializer.serialize_i32(1),
14390 Self::Valid => serializer.serialize_i32(2),
14391 Self::Invalid => serializer.serialize_i32(3),
14392 Self::UnknownValue(u) => u.0.serialize(serializer),
14393 }
14394 }
14395 }
14396
14397 impl<'de> serde::de::Deserialize<'de> for Status {
14398 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14399 where
14400 D: serde::Deserializer<'de>,
14401 {
14402 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Status>::new(
14403 ".grafeas.v1.SecretStatus.Status",
14404 ))
14405 }
14406 }
14407}
14408
14409#[derive(Clone, Default, PartialEq)]
14410#[non_exhaustive]
14411pub struct SlsaProvenance {
14412 pub builder: std::option::Option<crate::model::slsa_provenance::SlsaBuilder>,
14413
14414 /// Identifies the configuration used for the build.
14415 /// When combined with materials, this SHOULD fully describe the build,
14416 /// such that re-running this recipe results in bit-for-bit identical output
14417 /// (if the build is reproducible).
14418 pub recipe: std::option::Option<crate::model::slsa_provenance::SlsaRecipe>,
14419
14420 pub metadata: std::option::Option<crate::model::slsa_provenance::SlsaMetadata>,
14421
14422 /// The collection of artifacts that influenced the build including sources,
14423 /// dependencies, build tools, base images, and so on. This is considered to be
14424 /// incomplete unless metadata.completeness.materials is true. Unset or null is
14425 /// equivalent to empty.
14426 pub materials: std::vec::Vec<crate::model::slsa_provenance::Material>,
14427
14428 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14429}
14430
14431impl SlsaProvenance {
14432 pub fn new() -> Self {
14433 std::default::Default::default()
14434 }
14435
14436 /// Sets the value of [builder][crate::model::SlsaProvenance::builder].
14437 ///
14438 /// # Example
14439 /// ```ignore,no_run
14440 /// # use google_cloud_grafeas_v1::model::SlsaProvenance;
14441 /// use google_cloud_grafeas_v1::model::slsa_provenance::SlsaBuilder;
14442 /// let x = SlsaProvenance::new().set_builder(SlsaBuilder::default()/* use setters */);
14443 /// ```
14444 pub fn set_builder<T>(mut self, v: T) -> Self
14445 where
14446 T: std::convert::Into<crate::model::slsa_provenance::SlsaBuilder>,
14447 {
14448 self.builder = std::option::Option::Some(v.into());
14449 self
14450 }
14451
14452 /// Sets or clears the value of [builder][crate::model::SlsaProvenance::builder].
14453 ///
14454 /// # Example
14455 /// ```ignore,no_run
14456 /// # use google_cloud_grafeas_v1::model::SlsaProvenance;
14457 /// use google_cloud_grafeas_v1::model::slsa_provenance::SlsaBuilder;
14458 /// let x = SlsaProvenance::new().set_or_clear_builder(Some(SlsaBuilder::default()/* use setters */));
14459 /// let x = SlsaProvenance::new().set_or_clear_builder(None::<SlsaBuilder>);
14460 /// ```
14461 pub fn set_or_clear_builder<T>(mut self, v: std::option::Option<T>) -> Self
14462 where
14463 T: std::convert::Into<crate::model::slsa_provenance::SlsaBuilder>,
14464 {
14465 self.builder = v.map(|x| x.into());
14466 self
14467 }
14468
14469 /// Sets the value of [recipe][crate::model::SlsaProvenance::recipe].
14470 ///
14471 /// # Example
14472 /// ```ignore,no_run
14473 /// # use google_cloud_grafeas_v1::model::SlsaProvenance;
14474 /// use google_cloud_grafeas_v1::model::slsa_provenance::SlsaRecipe;
14475 /// let x = SlsaProvenance::new().set_recipe(SlsaRecipe::default()/* use setters */);
14476 /// ```
14477 pub fn set_recipe<T>(mut self, v: T) -> Self
14478 where
14479 T: std::convert::Into<crate::model::slsa_provenance::SlsaRecipe>,
14480 {
14481 self.recipe = std::option::Option::Some(v.into());
14482 self
14483 }
14484
14485 /// Sets or clears the value of [recipe][crate::model::SlsaProvenance::recipe].
14486 ///
14487 /// # Example
14488 /// ```ignore,no_run
14489 /// # use google_cloud_grafeas_v1::model::SlsaProvenance;
14490 /// use google_cloud_grafeas_v1::model::slsa_provenance::SlsaRecipe;
14491 /// let x = SlsaProvenance::new().set_or_clear_recipe(Some(SlsaRecipe::default()/* use setters */));
14492 /// let x = SlsaProvenance::new().set_or_clear_recipe(None::<SlsaRecipe>);
14493 /// ```
14494 pub fn set_or_clear_recipe<T>(mut self, v: std::option::Option<T>) -> Self
14495 where
14496 T: std::convert::Into<crate::model::slsa_provenance::SlsaRecipe>,
14497 {
14498 self.recipe = v.map(|x| x.into());
14499 self
14500 }
14501
14502 /// Sets the value of [metadata][crate::model::SlsaProvenance::metadata].
14503 ///
14504 /// # Example
14505 /// ```ignore,no_run
14506 /// # use google_cloud_grafeas_v1::model::SlsaProvenance;
14507 /// use google_cloud_grafeas_v1::model::slsa_provenance::SlsaMetadata;
14508 /// let x = SlsaProvenance::new().set_metadata(SlsaMetadata::default()/* use setters */);
14509 /// ```
14510 pub fn set_metadata<T>(mut self, v: T) -> Self
14511 where
14512 T: std::convert::Into<crate::model::slsa_provenance::SlsaMetadata>,
14513 {
14514 self.metadata = std::option::Option::Some(v.into());
14515 self
14516 }
14517
14518 /// Sets or clears the value of [metadata][crate::model::SlsaProvenance::metadata].
14519 ///
14520 /// # Example
14521 /// ```ignore,no_run
14522 /// # use google_cloud_grafeas_v1::model::SlsaProvenance;
14523 /// use google_cloud_grafeas_v1::model::slsa_provenance::SlsaMetadata;
14524 /// let x = SlsaProvenance::new().set_or_clear_metadata(Some(SlsaMetadata::default()/* use setters */));
14525 /// let x = SlsaProvenance::new().set_or_clear_metadata(None::<SlsaMetadata>);
14526 /// ```
14527 pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
14528 where
14529 T: std::convert::Into<crate::model::slsa_provenance::SlsaMetadata>,
14530 {
14531 self.metadata = v.map(|x| x.into());
14532 self
14533 }
14534
14535 /// Sets the value of [materials][crate::model::SlsaProvenance::materials].
14536 ///
14537 /// # Example
14538 /// ```ignore,no_run
14539 /// # use google_cloud_grafeas_v1::model::SlsaProvenance;
14540 /// use google_cloud_grafeas_v1::model::slsa_provenance::Material;
14541 /// let x = SlsaProvenance::new()
14542 /// .set_materials([
14543 /// Material::default()/* use setters */,
14544 /// Material::default()/* use (different) setters */,
14545 /// ]);
14546 /// ```
14547 pub fn set_materials<T, V>(mut self, v: T) -> Self
14548 where
14549 T: std::iter::IntoIterator<Item = V>,
14550 V: std::convert::Into<crate::model::slsa_provenance::Material>,
14551 {
14552 use std::iter::Iterator;
14553 self.materials = v.into_iter().map(|i| i.into()).collect();
14554 self
14555 }
14556}
14557
14558impl wkt::message::Message for SlsaProvenance {
14559 fn typename() -> &'static str {
14560 "type.googleapis.com/grafeas.v1.SlsaProvenance"
14561 }
14562}
14563
14564/// Defines additional types related to [SlsaProvenance].
14565pub mod slsa_provenance {
14566 #[allow(unused_imports)]
14567 use super::*;
14568
14569 /// Steps taken to build the artifact.
14570 /// For a TaskRun, typically each container corresponds to one step in the
14571 /// recipe.
14572 #[derive(Clone, Default, PartialEq)]
14573 #[non_exhaustive]
14574 pub struct SlsaRecipe {
14575 /// URI indicating what type of recipe was performed. It determines the
14576 /// meaning of recipe.entryPoint, recipe.arguments, recipe.environment, and
14577 /// materials.
14578 pub r#type: std::string::String,
14579
14580 /// Index in materials containing the recipe steps that are not implied by
14581 /// recipe.type. For example, if the recipe type were "make", then this would
14582 /// point to the source containing the Makefile, not the make program itself.
14583 /// Set to -1 if the recipe doesn't come from a material, as zero is default
14584 /// unset value for int64.
14585 pub defined_in_material: i64,
14586
14587 /// String identifying the entry point into the build.
14588 /// This is often a path to a configuration file and/or a target label within
14589 /// that file. The syntax and meaning are defined by recipe.type. For
14590 /// example, if the recipe type were "make", then this would reference the
14591 /// directory in which to run make as well as which target to use.
14592 pub entry_point: std::string::String,
14593
14594 /// Collection of all external inputs that influenced the build on top of
14595 /// recipe.definedInMaterial and recipe.entryPoint. For example, if the
14596 /// recipe type were "make", then this might be the flags passed to make
14597 /// aside from the target, which is captured in recipe.entryPoint. Depending
14598 /// on the recipe Type, the structure may be different.
14599 pub arguments: std::option::Option<wkt::Any>,
14600
14601 /// Any other builder-controlled inputs necessary for correctly evaluating
14602 /// the recipe. Usually only needed for reproducing the build but not
14603 /// evaluated as part of policy. Depending on the recipe Type, the structure
14604 /// may be different.
14605 pub environment: std::option::Option<wkt::Any>,
14606
14607 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14608 }
14609
14610 impl SlsaRecipe {
14611 pub fn new() -> Self {
14612 std::default::Default::default()
14613 }
14614
14615 /// Sets the value of [r#type][crate::model::slsa_provenance::SlsaRecipe::type].
14616 ///
14617 /// # Example
14618 /// ```ignore,no_run
14619 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaRecipe;
14620 /// let x = SlsaRecipe::new().set_type("example");
14621 /// ```
14622 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14623 self.r#type = v.into();
14624 self
14625 }
14626
14627 /// Sets the value of [defined_in_material][crate::model::slsa_provenance::SlsaRecipe::defined_in_material].
14628 ///
14629 /// # Example
14630 /// ```ignore,no_run
14631 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaRecipe;
14632 /// let x = SlsaRecipe::new().set_defined_in_material(42);
14633 /// ```
14634 pub fn set_defined_in_material<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
14635 self.defined_in_material = v.into();
14636 self
14637 }
14638
14639 /// Sets the value of [entry_point][crate::model::slsa_provenance::SlsaRecipe::entry_point].
14640 ///
14641 /// # Example
14642 /// ```ignore,no_run
14643 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaRecipe;
14644 /// let x = SlsaRecipe::new().set_entry_point("example");
14645 /// ```
14646 pub fn set_entry_point<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14647 self.entry_point = v.into();
14648 self
14649 }
14650
14651 /// Sets the value of [arguments][crate::model::slsa_provenance::SlsaRecipe::arguments].
14652 ///
14653 /// # Example
14654 /// ```ignore,no_run
14655 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaRecipe;
14656 /// use wkt::Any;
14657 /// let x = SlsaRecipe::new().set_arguments(Any::default()/* use setters */);
14658 /// ```
14659 pub fn set_arguments<T>(mut self, v: T) -> Self
14660 where
14661 T: std::convert::Into<wkt::Any>,
14662 {
14663 self.arguments = std::option::Option::Some(v.into());
14664 self
14665 }
14666
14667 /// Sets or clears the value of [arguments][crate::model::slsa_provenance::SlsaRecipe::arguments].
14668 ///
14669 /// # Example
14670 /// ```ignore,no_run
14671 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaRecipe;
14672 /// use wkt::Any;
14673 /// let x = SlsaRecipe::new().set_or_clear_arguments(Some(Any::default()/* use setters */));
14674 /// let x = SlsaRecipe::new().set_or_clear_arguments(None::<Any>);
14675 /// ```
14676 pub fn set_or_clear_arguments<T>(mut self, v: std::option::Option<T>) -> Self
14677 where
14678 T: std::convert::Into<wkt::Any>,
14679 {
14680 self.arguments = v.map(|x| x.into());
14681 self
14682 }
14683
14684 /// Sets the value of [environment][crate::model::slsa_provenance::SlsaRecipe::environment].
14685 ///
14686 /// # Example
14687 /// ```ignore,no_run
14688 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaRecipe;
14689 /// use wkt::Any;
14690 /// let x = SlsaRecipe::new().set_environment(Any::default()/* use setters */);
14691 /// ```
14692 pub fn set_environment<T>(mut self, v: T) -> Self
14693 where
14694 T: std::convert::Into<wkt::Any>,
14695 {
14696 self.environment = std::option::Option::Some(v.into());
14697 self
14698 }
14699
14700 /// Sets or clears the value of [environment][crate::model::slsa_provenance::SlsaRecipe::environment].
14701 ///
14702 /// # Example
14703 /// ```ignore,no_run
14704 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaRecipe;
14705 /// use wkt::Any;
14706 /// let x = SlsaRecipe::new().set_or_clear_environment(Some(Any::default()/* use setters */));
14707 /// let x = SlsaRecipe::new().set_or_clear_environment(None::<Any>);
14708 /// ```
14709 pub fn set_or_clear_environment<T>(mut self, v: std::option::Option<T>) -> Self
14710 where
14711 T: std::convert::Into<wkt::Any>,
14712 {
14713 self.environment = v.map(|x| x.into());
14714 self
14715 }
14716 }
14717
14718 impl wkt::message::Message for SlsaRecipe {
14719 fn typename() -> &'static str {
14720 "type.googleapis.com/grafeas.v1.SlsaProvenance.SlsaRecipe"
14721 }
14722 }
14723
14724 /// Indicates that the builder claims certain fields in this message to be
14725 /// complete.
14726 #[derive(Clone, Default, PartialEq)]
14727 #[non_exhaustive]
14728 pub struct SlsaCompleteness {
14729 /// If true, the builder claims that recipe.arguments is complete, meaning
14730 /// that all external inputs are properly captured in the recipe.
14731 pub arguments: bool,
14732
14733 /// If true, the builder claims that recipe.environment is claimed to be
14734 /// complete.
14735 pub environment: bool,
14736
14737 /// If true, the builder claims that materials are complete, usually through
14738 /// some controls to prevent network access. Sometimes called "hermetic".
14739 pub materials: bool,
14740
14741 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14742 }
14743
14744 impl SlsaCompleteness {
14745 pub fn new() -> Self {
14746 std::default::Default::default()
14747 }
14748
14749 /// Sets the value of [arguments][crate::model::slsa_provenance::SlsaCompleteness::arguments].
14750 ///
14751 /// # Example
14752 /// ```ignore,no_run
14753 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaCompleteness;
14754 /// let x = SlsaCompleteness::new().set_arguments(true);
14755 /// ```
14756 pub fn set_arguments<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14757 self.arguments = v.into();
14758 self
14759 }
14760
14761 /// Sets the value of [environment][crate::model::slsa_provenance::SlsaCompleteness::environment].
14762 ///
14763 /// # Example
14764 /// ```ignore,no_run
14765 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaCompleteness;
14766 /// let x = SlsaCompleteness::new().set_environment(true);
14767 /// ```
14768 pub fn set_environment<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14769 self.environment = v.into();
14770 self
14771 }
14772
14773 /// Sets the value of [materials][crate::model::slsa_provenance::SlsaCompleteness::materials].
14774 ///
14775 /// # Example
14776 /// ```ignore,no_run
14777 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaCompleteness;
14778 /// let x = SlsaCompleteness::new().set_materials(true);
14779 /// ```
14780 pub fn set_materials<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14781 self.materials = v.into();
14782 self
14783 }
14784 }
14785
14786 impl wkt::message::Message for SlsaCompleteness {
14787 fn typename() -> &'static str {
14788 "type.googleapis.com/grafeas.v1.SlsaProvenance.SlsaCompleteness"
14789 }
14790 }
14791
14792 /// Other properties of the build.
14793 #[derive(Clone, Default, PartialEq)]
14794 #[non_exhaustive]
14795 pub struct SlsaMetadata {
14796 /// Identifies the particular build invocation, which can be useful for
14797 /// finding associated logs or other ad-hoc analysis. The value SHOULD be
14798 /// globally unique, per in-toto Provenance spec.
14799 pub build_invocation_id: std::string::String,
14800
14801 /// The timestamp of when the build started.
14802 pub build_started_on: std::option::Option<wkt::Timestamp>,
14803
14804 /// The timestamp of when the build completed.
14805 pub build_finished_on: std::option::Option<wkt::Timestamp>,
14806
14807 /// Indicates that the builder claims certain fields in this message to be
14808 /// complete.
14809 pub completeness: std::option::Option<crate::model::slsa_provenance::SlsaCompleteness>,
14810
14811 /// If true, the builder claims that running the recipe on materials will
14812 /// produce bit-for-bit identical output.
14813 pub reproducible: bool,
14814
14815 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14816 }
14817
14818 impl SlsaMetadata {
14819 pub fn new() -> Self {
14820 std::default::Default::default()
14821 }
14822
14823 /// Sets the value of [build_invocation_id][crate::model::slsa_provenance::SlsaMetadata::build_invocation_id].
14824 ///
14825 /// # Example
14826 /// ```ignore,no_run
14827 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaMetadata;
14828 /// let x = SlsaMetadata::new().set_build_invocation_id("example");
14829 /// ```
14830 pub fn set_build_invocation_id<T: std::convert::Into<std::string::String>>(
14831 mut self,
14832 v: T,
14833 ) -> Self {
14834 self.build_invocation_id = v.into();
14835 self
14836 }
14837
14838 /// Sets the value of [build_started_on][crate::model::slsa_provenance::SlsaMetadata::build_started_on].
14839 ///
14840 /// # Example
14841 /// ```ignore,no_run
14842 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaMetadata;
14843 /// use wkt::Timestamp;
14844 /// let x = SlsaMetadata::new().set_build_started_on(Timestamp::default()/* use setters */);
14845 /// ```
14846 pub fn set_build_started_on<T>(mut self, v: T) -> Self
14847 where
14848 T: std::convert::Into<wkt::Timestamp>,
14849 {
14850 self.build_started_on = std::option::Option::Some(v.into());
14851 self
14852 }
14853
14854 /// Sets or clears the value of [build_started_on][crate::model::slsa_provenance::SlsaMetadata::build_started_on].
14855 ///
14856 /// # Example
14857 /// ```ignore,no_run
14858 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaMetadata;
14859 /// use wkt::Timestamp;
14860 /// let x = SlsaMetadata::new().set_or_clear_build_started_on(Some(Timestamp::default()/* use setters */));
14861 /// let x = SlsaMetadata::new().set_or_clear_build_started_on(None::<Timestamp>);
14862 /// ```
14863 pub fn set_or_clear_build_started_on<T>(mut self, v: std::option::Option<T>) -> Self
14864 where
14865 T: std::convert::Into<wkt::Timestamp>,
14866 {
14867 self.build_started_on = v.map(|x| x.into());
14868 self
14869 }
14870
14871 /// Sets the value of [build_finished_on][crate::model::slsa_provenance::SlsaMetadata::build_finished_on].
14872 ///
14873 /// # Example
14874 /// ```ignore,no_run
14875 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaMetadata;
14876 /// use wkt::Timestamp;
14877 /// let x = SlsaMetadata::new().set_build_finished_on(Timestamp::default()/* use setters */);
14878 /// ```
14879 pub fn set_build_finished_on<T>(mut self, v: T) -> Self
14880 where
14881 T: std::convert::Into<wkt::Timestamp>,
14882 {
14883 self.build_finished_on = std::option::Option::Some(v.into());
14884 self
14885 }
14886
14887 /// Sets or clears the value of [build_finished_on][crate::model::slsa_provenance::SlsaMetadata::build_finished_on].
14888 ///
14889 /// # Example
14890 /// ```ignore,no_run
14891 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaMetadata;
14892 /// use wkt::Timestamp;
14893 /// let x = SlsaMetadata::new().set_or_clear_build_finished_on(Some(Timestamp::default()/* use setters */));
14894 /// let x = SlsaMetadata::new().set_or_clear_build_finished_on(None::<Timestamp>);
14895 /// ```
14896 pub fn set_or_clear_build_finished_on<T>(mut self, v: std::option::Option<T>) -> Self
14897 where
14898 T: std::convert::Into<wkt::Timestamp>,
14899 {
14900 self.build_finished_on = v.map(|x| x.into());
14901 self
14902 }
14903
14904 /// Sets the value of [completeness][crate::model::slsa_provenance::SlsaMetadata::completeness].
14905 ///
14906 /// # Example
14907 /// ```ignore,no_run
14908 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaMetadata;
14909 /// use google_cloud_grafeas_v1::model::slsa_provenance::SlsaCompleteness;
14910 /// let x = SlsaMetadata::new().set_completeness(SlsaCompleteness::default()/* use setters */);
14911 /// ```
14912 pub fn set_completeness<T>(mut self, v: T) -> Self
14913 where
14914 T: std::convert::Into<crate::model::slsa_provenance::SlsaCompleteness>,
14915 {
14916 self.completeness = std::option::Option::Some(v.into());
14917 self
14918 }
14919
14920 /// Sets or clears the value of [completeness][crate::model::slsa_provenance::SlsaMetadata::completeness].
14921 ///
14922 /// # Example
14923 /// ```ignore,no_run
14924 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaMetadata;
14925 /// use google_cloud_grafeas_v1::model::slsa_provenance::SlsaCompleteness;
14926 /// let x = SlsaMetadata::new().set_or_clear_completeness(Some(SlsaCompleteness::default()/* use setters */));
14927 /// let x = SlsaMetadata::new().set_or_clear_completeness(None::<SlsaCompleteness>);
14928 /// ```
14929 pub fn set_or_clear_completeness<T>(mut self, v: std::option::Option<T>) -> Self
14930 where
14931 T: std::convert::Into<crate::model::slsa_provenance::SlsaCompleteness>,
14932 {
14933 self.completeness = v.map(|x| x.into());
14934 self
14935 }
14936
14937 /// Sets the value of [reproducible][crate::model::slsa_provenance::SlsaMetadata::reproducible].
14938 ///
14939 /// # Example
14940 /// ```ignore,no_run
14941 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaMetadata;
14942 /// let x = SlsaMetadata::new().set_reproducible(true);
14943 /// ```
14944 pub fn set_reproducible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14945 self.reproducible = v.into();
14946 self
14947 }
14948 }
14949
14950 impl wkt::message::Message for SlsaMetadata {
14951 fn typename() -> &'static str {
14952 "type.googleapis.com/grafeas.v1.SlsaProvenance.SlsaMetadata"
14953 }
14954 }
14955
14956 #[derive(Clone, Default, PartialEq)]
14957 #[non_exhaustive]
14958 pub struct SlsaBuilder {
14959 pub id: std::string::String,
14960
14961 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14962 }
14963
14964 impl SlsaBuilder {
14965 pub fn new() -> Self {
14966 std::default::Default::default()
14967 }
14968
14969 /// Sets the value of [id][crate::model::slsa_provenance::SlsaBuilder::id].
14970 ///
14971 /// # Example
14972 /// ```ignore,no_run
14973 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaBuilder;
14974 /// let x = SlsaBuilder::new().set_id("example");
14975 /// ```
14976 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14977 self.id = v.into();
14978 self
14979 }
14980 }
14981
14982 impl wkt::message::Message for SlsaBuilder {
14983 fn typename() -> &'static str {
14984 "type.googleapis.com/grafeas.v1.SlsaProvenance.SlsaBuilder"
14985 }
14986 }
14987
14988 #[derive(Clone, Default, PartialEq)]
14989 #[non_exhaustive]
14990 pub struct Material {
14991 pub uri: std::string::String,
14992
14993 pub digest: std::collections::HashMap<std::string::String, std::string::String>,
14994
14995 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14996 }
14997
14998 impl Material {
14999 pub fn new() -> Self {
15000 std::default::Default::default()
15001 }
15002
15003 /// Sets the value of [uri][crate::model::slsa_provenance::Material::uri].
15004 ///
15005 /// # Example
15006 /// ```ignore,no_run
15007 /// # use google_cloud_grafeas_v1::model::slsa_provenance::Material;
15008 /// let x = Material::new().set_uri("example");
15009 /// ```
15010 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15011 self.uri = v.into();
15012 self
15013 }
15014
15015 /// Sets the value of [digest][crate::model::slsa_provenance::Material::digest].
15016 ///
15017 /// # Example
15018 /// ```ignore,no_run
15019 /// # use google_cloud_grafeas_v1::model::slsa_provenance::Material;
15020 /// let x = Material::new().set_digest([
15021 /// ("key0", "abc"),
15022 /// ("key1", "xyz"),
15023 /// ]);
15024 /// ```
15025 pub fn set_digest<T, K, V>(mut self, v: T) -> Self
15026 where
15027 T: std::iter::IntoIterator<Item = (K, V)>,
15028 K: std::convert::Into<std::string::String>,
15029 V: std::convert::Into<std::string::String>,
15030 {
15031 use std::iter::Iterator;
15032 self.digest = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15033 self
15034 }
15035 }
15036
15037 impl wkt::message::Message for Material {
15038 fn typename() -> &'static str {
15039 "type.googleapis.com/grafeas.v1.SlsaProvenance.Material"
15040 }
15041 }
15042}
15043
15044#[derive(Clone, Default, PartialEq)]
15045#[non_exhaustive]
15046pub struct SlsaProvenanceZeroTwo {
15047 pub builder: std::option::Option<crate::model::slsa_provenance_zero_two::SlsaBuilder>,
15048
15049 pub build_type: std::string::String,
15050
15051 pub invocation: std::option::Option<crate::model::slsa_provenance_zero_two::SlsaInvocation>,
15052
15053 pub build_config: std::option::Option<wkt::Struct>,
15054
15055 pub metadata: std::option::Option<crate::model::slsa_provenance_zero_two::SlsaMetadata>,
15056
15057 pub materials: std::vec::Vec<crate::model::slsa_provenance_zero_two::SlsaMaterial>,
15058
15059 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15060}
15061
15062impl SlsaProvenanceZeroTwo {
15063 pub fn new() -> Self {
15064 std::default::Default::default()
15065 }
15066
15067 /// Sets the value of [builder][crate::model::SlsaProvenanceZeroTwo::builder].
15068 ///
15069 /// # Example
15070 /// ```ignore,no_run
15071 /// # use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
15072 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaBuilder;
15073 /// let x = SlsaProvenanceZeroTwo::new().set_builder(SlsaBuilder::default()/* use setters */);
15074 /// ```
15075 pub fn set_builder<T>(mut self, v: T) -> Self
15076 where
15077 T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaBuilder>,
15078 {
15079 self.builder = std::option::Option::Some(v.into());
15080 self
15081 }
15082
15083 /// Sets or clears the value of [builder][crate::model::SlsaProvenanceZeroTwo::builder].
15084 ///
15085 /// # Example
15086 /// ```ignore,no_run
15087 /// # use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
15088 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaBuilder;
15089 /// let x = SlsaProvenanceZeroTwo::new().set_or_clear_builder(Some(SlsaBuilder::default()/* use setters */));
15090 /// let x = SlsaProvenanceZeroTwo::new().set_or_clear_builder(None::<SlsaBuilder>);
15091 /// ```
15092 pub fn set_or_clear_builder<T>(mut self, v: std::option::Option<T>) -> Self
15093 where
15094 T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaBuilder>,
15095 {
15096 self.builder = v.map(|x| x.into());
15097 self
15098 }
15099
15100 /// Sets the value of [build_type][crate::model::SlsaProvenanceZeroTwo::build_type].
15101 ///
15102 /// # Example
15103 /// ```ignore,no_run
15104 /// # use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
15105 /// let x = SlsaProvenanceZeroTwo::new().set_build_type("example");
15106 /// ```
15107 pub fn set_build_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15108 self.build_type = v.into();
15109 self
15110 }
15111
15112 /// Sets the value of [invocation][crate::model::SlsaProvenanceZeroTwo::invocation].
15113 ///
15114 /// # Example
15115 /// ```ignore,no_run
15116 /// # use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
15117 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaInvocation;
15118 /// let x = SlsaProvenanceZeroTwo::new().set_invocation(SlsaInvocation::default()/* use setters */);
15119 /// ```
15120 pub fn set_invocation<T>(mut self, v: T) -> Self
15121 where
15122 T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaInvocation>,
15123 {
15124 self.invocation = std::option::Option::Some(v.into());
15125 self
15126 }
15127
15128 /// Sets or clears the value of [invocation][crate::model::SlsaProvenanceZeroTwo::invocation].
15129 ///
15130 /// # Example
15131 /// ```ignore,no_run
15132 /// # use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
15133 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaInvocation;
15134 /// let x = SlsaProvenanceZeroTwo::new().set_or_clear_invocation(Some(SlsaInvocation::default()/* use setters */));
15135 /// let x = SlsaProvenanceZeroTwo::new().set_or_clear_invocation(None::<SlsaInvocation>);
15136 /// ```
15137 pub fn set_or_clear_invocation<T>(mut self, v: std::option::Option<T>) -> Self
15138 where
15139 T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaInvocation>,
15140 {
15141 self.invocation = v.map(|x| x.into());
15142 self
15143 }
15144
15145 /// Sets the value of [build_config][crate::model::SlsaProvenanceZeroTwo::build_config].
15146 ///
15147 /// # Example
15148 /// ```ignore,no_run
15149 /// # use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
15150 /// use wkt::Struct;
15151 /// let x = SlsaProvenanceZeroTwo::new().set_build_config(Struct::default()/* use setters */);
15152 /// ```
15153 pub fn set_build_config<T>(mut self, v: T) -> Self
15154 where
15155 T: std::convert::Into<wkt::Struct>,
15156 {
15157 self.build_config = std::option::Option::Some(v.into());
15158 self
15159 }
15160
15161 /// Sets or clears the value of [build_config][crate::model::SlsaProvenanceZeroTwo::build_config].
15162 ///
15163 /// # Example
15164 /// ```ignore,no_run
15165 /// # use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
15166 /// use wkt::Struct;
15167 /// let x = SlsaProvenanceZeroTwo::new().set_or_clear_build_config(Some(Struct::default()/* use setters */));
15168 /// let x = SlsaProvenanceZeroTwo::new().set_or_clear_build_config(None::<Struct>);
15169 /// ```
15170 pub fn set_or_clear_build_config<T>(mut self, v: std::option::Option<T>) -> Self
15171 where
15172 T: std::convert::Into<wkt::Struct>,
15173 {
15174 self.build_config = v.map(|x| x.into());
15175 self
15176 }
15177
15178 /// Sets the value of [metadata][crate::model::SlsaProvenanceZeroTwo::metadata].
15179 ///
15180 /// # Example
15181 /// ```ignore,no_run
15182 /// # use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
15183 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMetadata;
15184 /// let x = SlsaProvenanceZeroTwo::new().set_metadata(SlsaMetadata::default()/* use setters */);
15185 /// ```
15186 pub fn set_metadata<T>(mut self, v: T) -> Self
15187 where
15188 T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaMetadata>,
15189 {
15190 self.metadata = std::option::Option::Some(v.into());
15191 self
15192 }
15193
15194 /// Sets or clears the value of [metadata][crate::model::SlsaProvenanceZeroTwo::metadata].
15195 ///
15196 /// # Example
15197 /// ```ignore,no_run
15198 /// # use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
15199 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMetadata;
15200 /// let x = SlsaProvenanceZeroTwo::new().set_or_clear_metadata(Some(SlsaMetadata::default()/* use setters */));
15201 /// let x = SlsaProvenanceZeroTwo::new().set_or_clear_metadata(None::<SlsaMetadata>);
15202 /// ```
15203 pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
15204 where
15205 T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaMetadata>,
15206 {
15207 self.metadata = v.map(|x| x.into());
15208 self
15209 }
15210
15211 /// Sets the value of [materials][crate::model::SlsaProvenanceZeroTwo::materials].
15212 ///
15213 /// # Example
15214 /// ```ignore,no_run
15215 /// # use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
15216 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMaterial;
15217 /// let x = SlsaProvenanceZeroTwo::new()
15218 /// .set_materials([
15219 /// SlsaMaterial::default()/* use setters */,
15220 /// SlsaMaterial::default()/* use (different) setters */,
15221 /// ]);
15222 /// ```
15223 pub fn set_materials<T, V>(mut self, v: T) -> Self
15224 where
15225 T: std::iter::IntoIterator<Item = V>,
15226 V: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaMaterial>,
15227 {
15228 use std::iter::Iterator;
15229 self.materials = v.into_iter().map(|i| i.into()).collect();
15230 self
15231 }
15232}
15233
15234impl wkt::message::Message for SlsaProvenanceZeroTwo {
15235 fn typename() -> &'static str {
15236 "type.googleapis.com/grafeas.v1.SlsaProvenanceZeroTwo"
15237 }
15238}
15239
15240/// Defines additional types related to [SlsaProvenanceZeroTwo].
15241pub mod slsa_provenance_zero_two {
15242 #[allow(unused_imports)]
15243 use super::*;
15244
15245 /// Identifies the entity that executed the recipe, which is trusted to have
15246 /// correctly performed the operation and populated this provenance.
15247 #[derive(Clone, Default, PartialEq)]
15248 #[non_exhaustive]
15249 pub struct SlsaBuilder {
15250 pub id: std::string::String,
15251
15252 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15253 }
15254
15255 impl SlsaBuilder {
15256 pub fn new() -> Self {
15257 std::default::Default::default()
15258 }
15259
15260 /// Sets the value of [id][crate::model::slsa_provenance_zero_two::SlsaBuilder::id].
15261 ///
15262 /// # Example
15263 /// ```ignore,no_run
15264 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaBuilder;
15265 /// let x = SlsaBuilder::new().set_id("example");
15266 /// ```
15267 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15268 self.id = v.into();
15269 self
15270 }
15271 }
15272
15273 impl wkt::message::Message for SlsaBuilder {
15274 fn typename() -> &'static str {
15275 "type.googleapis.com/grafeas.v1.SlsaProvenanceZeroTwo.SlsaBuilder"
15276 }
15277 }
15278
15279 /// The collection of artifacts that influenced the build including sources,
15280 /// dependencies, build tools, base images, and so on.
15281 #[derive(Clone, Default, PartialEq)]
15282 #[non_exhaustive]
15283 pub struct SlsaMaterial {
15284 pub uri: std::string::String,
15285
15286 pub digest: std::collections::HashMap<std::string::String, std::string::String>,
15287
15288 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15289 }
15290
15291 impl SlsaMaterial {
15292 pub fn new() -> Self {
15293 std::default::Default::default()
15294 }
15295
15296 /// Sets the value of [uri][crate::model::slsa_provenance_zero_two::SlsaMaterial::uri].
15297 ///
15298 /// # Example
15299 /// ```ignore,no_run
15300 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMaterial;
15301 /// let x = SlsaMaterial::new().set_uri("example");
15302 /// ```
15303 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15304 self.uri = v.into();
15305 self
15306 }
15307
15308 /// Sets the value of [digest][crate::model::slsa_provenance_zero_two::SlsaMaterial::digest].
15309 ///
15310 /// # Example
15311 /// ```ignore,no_run
15312 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMaterial;
15313 /// let x = SlsaMaterial::new().set_digest([
15314 /// ("key0", "abc"),
15315 /// ("key1", "xyz"),
15316 /// ]);
15317 /// ```
15318 pub fn set_digest<T, K, V>(mut self, v: T) -> Self
15319 where
15320 T: std::iter::IntoIterator<Item = (K, V)>,
15321 K: std::convert::Into<std::string::String>,
15322 V: std::convert::Into<std::string::String>,
15323 {
15324 use std::iter::Iterator;
15325 self.digest = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15326 self
15327 }
15328 }
15329
15330 impl wkt::message::Message for SlsaMaterial {
15331 fn typename() -> &'static str {
15332 "type.googleapis.com/grafeas.v1.SlsaProvenanceZeroTwo.SlsaMaterial"
15333 }
15334 }
15335
15336 /// Identifies the event that kicked off the build.
15337 #[derive(Clone, Default, PartialEq)]
15338 #[non_exhaustive]
15339 pub struct SlsaInvocation {
15340 pub config_source:
15341 std::option::Option<crate::model::slsa_provenance_zero_two::SlsaConfigSource>,
15342
15343 pub parameters: std::option::Option<wkt::Struct>,
15344
15345 pub environment: std::option::Option<wkt::Struct>,
15346
15347 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15348 }
15349
15350 impl SlsaInvocation {
15351 pub fn new() -> Self {
15352 std::default::Default::default()
15353 }
15354
15355 /// Sets the value of [config_source][crate::model::slsa_provenance_zero_two::SlsaInvocation::config_source].
15356 ///
15357 /// # Example
15358 /// ```ignore,no_run
15359 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaInvocation;
15360 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaConfigSource;
15361 /// let x = SlsaInvocation::new().set_config_source(SlsaConfigSource::default()/* use setters */);
15362 /// ```
15363 pub fn set_config_source<T>(mut self, v: T) -> Self
15364 where
15365 T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaConfigSource>,
15366 {
15367 self.config_source = std::option::Option::Some(v.into());
15368 self
15369 }
15370
15371 /// Sets or clears the value of [config_source][crate::model::slsa_provenance_zero_two::SlsaInvocation::config_source].
15372 ///
15373 /// # Example
15374 /// ```ignore,no_run
15375 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaInvocation;
15376 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaConfigSource;
15377 /// let x = SlsaInvocation::new().set_or_clear_config_source(Some(SlsaConfigSource::default()/* use setters */));
15378 /// let x = SlsaInvocation::new().set_or_clear_config_source(None::<SlsaConfigSource>);
15379 /// ```
15380 pub fn set_or_clear_config_source<T>(mut self, v: std::option::Option<T>) -> Self
15381 where
15382 T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaConfigSource>,
15383 {
15384 self.config_source = v.map(|x| x.into());
15385 self
15386 }
15387
15388 /// Sets the value of [parameters][crate::model::slsa_provenance_zero_two::SlsaInvocation::parameters].
15389 ///
15390 /// # Example
15391 /// ```ignore,no_run
15392 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaInvocation;
15393 /// use wkt::Struct;
15394 /// let x = SlsaInvocation::new().set_parameters(Struct::default()/* use setters */);
15395 /// ```
15396 pub fn set_parameters<T>(mut self, v: T) -> Self
15397 where
15398 T: std::convert::Into<wkt::Struct>,
15399 {
15400 self.parameters = std::option::Option::Some(v.into());
15401 self
15402 }
15403
15404 /// Sets or clears the value of [parameters][crate::model::slsa_provenance_zero_two::SlsaInvocation::parameters].
15405 ///
15406 /// # Example
15407 /// ```ignore,no_run
15408 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaInvocation;
15409 /// use wkt::Struct;
15410 /// let x = SlsaInvocation::new().set_or_clear_parameters(Some(Struct::default()/* use setters */));
15411 /// let x = SlsaInvocation::new().set_or_clear_parameters(None::<Struct>);
15412 /// ```
15413 pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
15414 where
15415 T: std::convert::Into<wkt::Struct>,
15416 {
15417 self.parameters = v.map(|x| x.into());
15418 self
15419 }
15420
15421 /// Sets the value of [environment][crate::model::slsa_provenance_zero_two::SlsaInvocation::environment].
15422 ///
15423 /// # Example
15424 /// ```ignore,no_run
15425 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaInvocation;
15426 /// use wkt::Struct;
15427 /// let x = SlsaInvocation::new().set_environment(Struct::default()/* use setters */);
15428 /// ```
15429 pub fn set_environment<T>(mut self, v: T) -> Self
15430 where
15431 T: std::convert::Into<wkt::Struct>,
15432 {
15433 self.environment = std::option::Option::Some(v.into());
15434 self
15435 }
15436
15437 /// Sets or clears the value of [environment][crate::model::slsa_provenance_zero_two::SlsaInvocation::environment].
15438 ///
15439 /// # Example
15440 /// ```ignore,no_run
15441 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaInvocation;
15442 /// use wkt::Struct;
15443 /// let x = SlsaInvocation::new().set_or_clear_environment(Some(Struct::default()/* use setters */));
15444 /// let x = SlsaInvocation::new().set_or_clear_environment(None::<Struct>);
15445 /// ```
15446 pub fn set_or_clear_environment<T>(mut self, v: std::option::Option<T>) -> Self
15447 where
15448 T: std::convert::Into<wkt::Struct>,
15449 {
15450 self.environment = v.map(|x| x.into());
15451 self
15452 }
15453 }
15454
15455 impl wkt::message::Message for SlsaInvocation {
15456 fn typename() -> &'static str {
15457 "type.googleapis.com/grafeas.v1.SlsaProvenanceZeroTwo.SlsaInvocation"
15458 }
15459 }
15460
15461 /// Describes where the config file that kicked off the build came from.
15462 /// This is effectively a pointer to the source where buildConfig came from.
15463 #[derive(Clone, Default, PartialEq)]
15464 #[non_exhaustive]
15465 pub struct SlsaConfigSource {
15466 pub uri: std::string::String,
15467
15468 pub digest: std::collections::HashMap<std::string::String, std::string::String>,
15469
15470 pub entry_point: std::string::String,
15471
15472 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15473 }
15474
15475 impl SlsaConfigSource {
15476 pub fn new() -> Self {
15477 std::default::Default::default()
15478 }
15479
15480 /// Sets the value of [uri][crate::model::slsa_provenance_zero_two::SlsaConfigSource::uri].
15481 ///
15482 /// # Example
15483 /// ```ignore,no_run
15484 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaConfigSource;
15485 /// let x = SlsaConfigSource::new().set_uri("example");
15486 /// ```
15487 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15488 self.uri = v.into();
15489 self
15490 }
15491
15492 /// Sets the value of [digest][crate::model::slsa_provenance_zero_two::SlsaConfigSource::digest].
15493 ///
15494 /// # Example
15495 /// ```ignore,no_run
15496 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaConfigSource;
15497 /// let x = SlsaConfigSource::new().set_digest([
15498 /// ("key0", "abc"),
15499 /// ("key1", "xyz"),
15500 /// ]);
15501 /// ```
15502 pub fn set_digest<T, K, V>(mut self, v: T) -> Self
15503 where
15504 T: std::iter::IntoIterator<Item = (K, V)>,
15505 K: std::convert::Into<std::string::String>,
15506 V: std::convert::Into<std::string::String>,
15507 {
15508 use std::iter::Iterator;
15509 self.digest = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15510 self
15511 }
15512
15513 /// Sets the value of [entry_point][crate::model::slsa_provenance_zero_two::SlsaConfigSource::entry_point].
15514 ///
15515 /// # Example
15516 /// ```ignore,no_run
15517 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaConfigSource;
15518 /// let x = SlsaConfigSource::new().set_entry_point("example");
15519 /// ```
15520 pub fn set_entry_point<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15521 self.entry_point = v.into();
15522 self
15523 }
15524 }
15525
15526 impl wkt::message::Message for SlsaConfigSource {
15527 fn typename() -> &'static str {
15528 "type.googleapis.com/grafeas.v1.SlsaProvenanceZeroTwo.SlsaConfigSource"
15529 }
15530 }
15531
15532 /// Other properties of the build.
15533 #[derive(Clone, Default, PartialEq)]
15534 #[non_exhaustive]
15535 pub struct SlsaMetadata {
15536 pub build_invocation_id: std::string::String,
15537
15538 pub build_started_on: std::option::Option<wkt::Timestamp>,
15539
15540 pub build_finished_on: std::option::Option<wkt::Timestamp>,
15541
15542 pub completeness:
15543 std::option::Option<crate::model::slsa_provenance_zero_two::SlsaCompleteness>,
15544
15545 pub reproducible: bool,
15546
15547 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15548 }
15549
15550 impl SlsaMetadata {
15551 pub fn new() -> Self {
15552 std::default::Default::default()
15553 }
15554
15555 /// Sets the value of [build_invocation_id][crate::model::slsa_provenance_zero_two::SlsaMetadata::build_invocation_id].
15556 ///
15557 /// # Example
15558 /// ```ignore,no_run
15559 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMetadata;
15560 /// let x = SlsaMetadata::new().set_build_invocation_id("example");
15561 /// ```
15562 pub fn set_build_invocation_id<T: std::convert::Into<std::string::String>>(
15563 mut self,
15564 v: T,
15565 ) -> Self {
15566 self.build_invocation_id = v.into();
15567 self
15568 }
15569
15570 /// Sets the value of [build_started_on][crate::model::slsa_provenance_zero_two::SlsaMetadata::build_started_on].
15571 ///
15572 /// # Example
15573 /// ```ignore,no_run
15574 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMetadata;
15575 /// use wkt::Timestamp;
15576 /// let x = SlsaMetadata::new().set_build_started_on(Timestamp::default()/* use setters */);
15577 /// ```
15578 pub fn set_build_started_on<T>(mut self, v: T) -> Self
15579 where
15580 T: std::convert::Into<wkt::Timestamp>,
15581 {
15582 self.build_started_on = std::option::Option::Some(v.into());
15583 self
15584 }
15585
15586 /// Sets or clears the value of [build_started_on][crate::model::slsa_provenance_zero_two::SlsaMetadata::build_started_on].
15587 ///
15588 /// # Example
15589 /// ```ignore,no_run
15590 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMetadata;
15591 /// use wkt::Timestamp;
15592 /// let x = SlsaMetadata::new().set_or_clear_build_started_on(Some(Timestamp::default()/* use setters */));
15593 /// let x = SlsaMetadata::new().set_or_clear_build_started_on(None::<Timestamp>);
15594 /// ```
15595 pub fn set_or_clear_build_started_on<T>(mut self, v: std::option::Option<T>) -> Self
15596 where
15597 T: std::convert::Into<wkt::Timestamp>,
15598 {
15599 self.build_started_on = v.map(|x| x.into());
15600 self
15601 }
15602
15603 /// Sets the value of [build_finished_on][crate::model::slsa_provenance_zero_two::SlsaMetadata::build_finished_on].
15604 ///
15605 /// # Example
15606 /// ```ignore,no_run
15607 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMetadata;
15608 /// use wkt::Timestamp;
15609 /// let x = SlsaMetadata::new().set_build_finished_on(Timestamp::default()/* use setters */);
15610 /// ```
15611 pub fn set_build_finished_on<T>(mut self, v: T) -> Self
15612 where
15613 T: std::convert::Into<wkt::Timestamp>,
15614 {
15615 self.build_finished_on = std::option::Option::Some(v.into());
15616 self
15617 }
15618
15619 /// Sets or clears the value of [build_finished_on][crate::model::slsa_provenance_zero_two::SlsaMetadata::build_finished_on].
15620 ///
15621 /// # Example
15622 /// ```ignore,no_run
15623 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMetadata;
15624 /// use wkt::Timestamp;
15625 /// let x = SlsaMetadata::new().set_or_clear_build_finished_on(Some(Timestamp::default()/* use setters */));
15626 /// let x = SlsaMetadata::new().set_or_clear_build_finished_on(None::<Timestamp>);
15627 /// ```
15628 pub fn set_or_clear_build_finished_on<T>(mut self, v: std::option::Option<T>) -> Self
15629 where
15630 T: std::convert::Into<wkt::Timestamp>,
15631 {
15632 self.build_finished_on = v.map(|x| x.into());
15633 self
15634 }
15635
15636 /// Sets the value of [completeness][crate::model::slsa_provenance_zero_two::SlsaMetadata::completeness].
15637 ///
15638 /// # Example
15639 /// ```ignore,no_run
15640 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMetadata;
15641 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaCompleteness;
15642 /// let x = SlsaMetadata::new().set_completeness(SlsaCompleteness::default()/* use setters */);
15643 /// ```
15644 pub fn set_completeness<T>(mut self, v: T) -> Self
15645 where
15646 T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaCompleteness>,
15647 {
15648 self.completeness = std::option::Option::Some(v.into());
15649 self
15650 }
15651
15652 /// Sets or clears the value of [completeness][crate::model::slsa_provenance_zero_two::SlsaMetadata::completeness].
15653 ///
15654 /// # Example
15655 /// ```ignore,no_run
15656 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMetadata;
15657 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaCompleteness;
15658 /// let x = SlsaMetadata::new().set_or_clear_completeness(Some(SlsaCompleteness::default()/* use setters */));
15659 /// let x = SlsaMetadata::new().set_or_clear_completeness(None::<SlsaCompleteness>);
15660 /// ```
15661 pub fn set_or_clear_completeness<T>(mut self, v: std::option::Option<T>) -> Self
15662 where
15663 T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaCompleteness>,
15664 {
15665 self.completeness = v.map(|x| x.into());
15666 self
15667 }
15668
15669 /// Sets the value of [reproducible][crate::model::slsa_provenance_zero_two::SlsaMetadata::reproducible].
15670 ///
15671 /// # Example
15672 /// ```ignore,no_run
15673 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMetadata;
15674 /// let x = SlsaMetadata::new().set_reproducible(true);
15675 /// ```
15676 pub fn set_reproducible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15677 self.reproducible = v.into();
15678 self
15679 }
15680 }
15681
15682 impl wkt::message::Message for SlsaMetadata {
15683 fn typename() -> &'static str {
15684 "type.googleapis.com/grafeas.v1.SlsaProvenanceZeroTwo.SlsaMetadata"
15685 }
15686 }
15687
15688 /// Indicates that the builder claims certain fields in this message to be
15689 /// complete.
15690 #[derive(Clone, Default, PartialEq)]
15691 #[non_exhaustive]
15692 pub struct SlsaCompleteness {
15693 pub parameters: bool,
15694
15695 pub environment: bool,
15696
15697 pub materials: bool,
15698
15699 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15700 }
15701
15702 impl SlsaCompleteness {
15703 pub fn new() -> Self {
15704 std::default::Default::default()
15705 }
15706
15707 /// Sets the value of [parameters][crate::model::slsa_provenance_zero_two::SlsaCompleteness::parameters].
15708 ///
15709 /// # Example
15710 /// ```ignore,no_run
15711 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaCompleteness;
15712 /// let x = SlsaCompleteness::new().set_parameters(true);
15713 /// ```
15714 pub fn set_parameters<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15715 self.parameters = v.into();
15716 self
15717 }
15718
15719 /// Sets the value of [environment][crate::model::slsa_provenance_zero_two::SlsaCompleteness::environment].
15720 ///
15721 /// # Example
15722 /// ```ignore,no_run
15723 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaCompleteness;
15724 /// let x = SlsaCompleteness::new().set_environment(true);
15725 /// ```
15726 pub fn set_environment<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15727 self.environment = v.into();
15728 self
15729 }
15730
15731 /// Sets the value of [materials][crate::model::slsa_provenance_zero_two::SlsaCompleteness::materials].
15732 ///
15733 /// # Example
15734 /// ```ignore,no_run
15735 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaCompleteness;
15736 /// let x = SlsaCompleteness::new().set_materials(true);
15737 /// ```
15738 pub fn set_materials<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15739 self.materials = v.into();
15740 self
15741 }
15742 }
15743
15744 impl wkt::message::Message for SlsaCompleteness {
15745 fn typename() -> &'static str {
15746 "type.googleapis.com/grafeas.v1.SlsaProvenanceZeroTwo.SlsaCompleteness"
15747 }
15748 }
15749}
15750
15751/// An Upgrade Note represents a potential upgrade of a package to a given
15752/// version. For each package version combination (i.e. bash 4.0, bash 4.1,
15753/// bash 4.1.2), there will be an Upgrade Note. For Windows, windows_update field
15754/// represents the information related to the update.
15755#[derive(Clone, Default, PartialEq)]
15756#[non_exhaustive]
15757pub struct UpgradeNote {
15758 /// Required for non-Windows OS. The package this Upgrade is for.
15759 pub package: std::string::String,
15760
15761 /// Required for non-Windows OS. The version of the package in machine + human
15762 /// readable form.
15763 pub version: std::option::Option<crate::model::Version>,
15764
15765 /// Metadata about the upgrade for each specific operating system.
15766 pub distributions: std::vec::Vec<crate::model::UpgradeDistribution>,
15767
15768 /// Required for Windows OS. Represents the metadata about the Windows update.
15769 pub windows_update: std::option::Option<crate::model::WindowsUpdate>,
15770
15771 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15772}
15773
15774impl UpgradeNote {
15775 pub fn new() -> Self {
15776 std::default::Default::default()
15777 }
15778
15779 /// Sets the value of [package][crate::model::UpgradeNote::package].
15780 ///
15781 /// # Example
15782 /// ```ignore,no_run
15783 /// # use google_cloud_grafeas_v1::model::UpgradeNote;
15784 /// let x = UpgradeNote::new().set_package("example");
15785 /// ```
15786 pub fn set_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15787 self.package = v.into();
15788 self
15789 }
15790
15791 /// Sets the value of [version][crate::model::UpgradeNote::version].
15792 ///
15793 /// # Example
15794 /// ```ignore,no_run
15795 /// # use google_cloud_grafeas_v1::model::UpgradeNote;
15796 /// use google_cloud_grafeas_v1::model::Version;
15797 /// let x = UpgradeNote::new().set_version(Version::default()/* use setters */);
15798 /// ```
15799 pub fn set_version<T>(mut self, v: T) -> Self
15800 where
15801 T: std::convert::Into<crate::model::Version>,
15802 {
15803 self.version = std::option::Option::Some(v.into());
15804 self
15805 }
15806
15807 /// Sets or clears the value of [version][crate::model::UpgradeNote::version].
15808 ///
15809 /// # Example
15810 /// ```ignore,no_run
15811 /// # use google_cloud_grafeas_v1::model::UpgradeNote;
15812 /// use google_cloud_grafeas_v1::model::Version;
15813 /// let x = UpgradeNote::new().set_or_clear_version(Some(Version::default()/* use setters */));
15814 /// let x = UpgradeNote::new().set_or_clear_version(None::<Version>);
15815 /// ```
15816 pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
15817 where
15818 T: std::convert::Into<crate::model::Version>,
15819 {
15820 self.version = v.map(|x| x.into());
15821 self
15822 }
15823
15824 /// Sets the value of [distributions][crate::model::UpgradeNote::distributions].
15825 ///
15826 /// # Example
15827 /// ```ignore,no_run
15828 /// # use google_cloud_grafeas_v1::model::UpgradeNote;
15829 /// use google_cloud_grafeas_v1::model::UpgradeDistribution;
15830 /// let x = UpgradeNote::new()
15831 /// .set_distributions([
15832 /// UpgradeDistribution::default()/* use setters */,
15833 /// UpgradeDistribution::default()/* use (different) setters */,
15834 /// ]);
15835 /// ```
15836 pub fn set_distributions<T, V>(mut self, v: T) -> Self
15837 where
15838 T: std::iter::IntoIterator<Item = V>,
15839 V: std::convert::Into<crate::model::UpgradeDistribution>,
15840 {
15841 use std::iter::Iterator;
15842 self.distributions = v.into_iter().map(|i| i.into()).collect();
15843 self
15844 }
15845
15846 /// Sets the value of [windows_update][crate::model::UpgradeNote::windows_update].
15847 ///
15848 /// # Example
15849 /// ```ignore,no_run
15850 /// # use google_cloud_grafeas_v1::model::UpgradeNote;
15851 /// use google_cloud_grafeas_v1::model::WindowsUpdate;
15852 /// let x = UpgradeNote::new().set_windows_update(WindowsUpdate::default()/* use setters */);
15853 /// ```
15854 pub fn set_windows_update<T>(mut self, v: T) -> Self
15855 where
15856 T: std::convert::Into<crate::model::WindowsUpdate>,
15857 {
15858 self.windows_update = std::option::Option::Some(v.into());
15859 self
15860 }
15861
15862 /// Sets or clears the value of [windows_update][crate::model::UpgradeNote::windows_update].
15863 ///
15864 /// # Example
15865 /// ```ignore,no_run
15866 /// # use google_cloud_grafeas_v1::model::UpgradeNote;
15867 /// use google_cloud_grafeas_v1::model::WindowsUpdate;
15868 /// let x = UpgradeNote::new().set_or_clear_windows_update(Some(WindowsUpdate::default()/* use setters */));
15869 /// let x = UpgradeNote::new().set_or_clear_windows_update(None::<WindowsUpdate>);
15870 /// ```
15871 pub fn set_or_clear_windows_update<T>(mut self, v: std::option::Option<T>) -> Self
15872 where
15873 T: std::convert::Into<crate::model::WindowsUpdate>,
15874 {
15875 self.windows_update = v.map(|x| x.into());
15876 self
15877 }
15878}
15879
15880impl wkt::message::Message for UpgradeNote {
15881 fn typename() -> &'static str {
15882 "type.googleapis.com/grafeas.v1.UpgradeNote"
15883 }
15884}
15885
15886/// The Upgrade Distribution represents metadata about the Upgrade for each
15887/// operating system (CPE). Some distributions have additional metadata around
15888/// updates, classifying them into various categories and severities.
15889#[derive(Clone, Default, PartialEq)]
15890#[non_exhaustive]
15891pub struct UpgradeDistribution {
15892 /// Required - The specific operating system this metadata applies to. See
15893 /// <https://cpe.mitre.org/specification/>.
15894 pub cpe_uri: std::string::String,
15895
15896 /// The operating system classification of this Upgrade, as specified by the
15897 /// upstream operating system upgrade feed. For Windows the classification is
15898 /// one of the category_ids listed at
15899 /// <https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ff357803>(v=vs.85)
15900 pub classification: std::string::String,
15901
15902 /// The severity as specified by the upstream operating system.
15903 pub severity: std::string::String,
15904
15905 /// The cve tied to this Upgrade.
15906 pub cve: std::vec::Vec<std::string::String>,
15907
15908 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15909}
15910
15911impl UpgradeDistribution {
15912 pub fn new() -> Self {
15913 std::default::Default::default()
15914 }
15915
15916 /// Sets the value of [cpe_uri][crate::model::UpgradeDistribution::cpe_uri].
15917 ///
15918 /// # Example
15919 /// ```ignore,no_run
15920 /// # use google_cloud_grafeas_v1::model::UpgradeDistribution;
15921 /// let x = UpgradeDistribution::new().set_cpe_uri("example");
15922 /// ```
15923 pub fn set_cpe_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15924 self.cpe_uri = v.into();
15925 self
15926 }
15927
15928 /// Sets the value of [classification][crate::model::UpgradeDistribution::classification].
15929 ///
15930 /// # Example
15931 /// ```ignore,no_run
15932 /// # use google_cloud_grafeas_v1::model::UpgradeDistribution;
15933 /// let x = UpgradeDistribution::new().set_classification("example");
15934 /// ```
15935 pub fn set_classification<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15936 self.classification = v.into();
15937 self
15938 }
15939
15940 /// Sets the value of [severity][crate::model::UpgradeDistribution::severity].
15941 ///
15942 /// # Example
15943 /// ```ignore,no_run
15944 /// # use google_cloud_grafeas_v1::model::UpgradeDistribution;
15945 /// let x = UpgradeDistribution::new().set_severity("example");
15946 /// ```
15947 pub fn set_severity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15948 self.severity = v.into();
15949 self
15950 }
15951
15952 /// Sets the value of [cve][crate::model::UpgradeDistribution::cve].
15953 ///
15954 /// # Example
15955 /// ```ignore,no_run
15956 /// # use google_cloud_grafeas_v1::model::UpgradeDistribution;
15957 /// let x = UpgradeDistribution::new().set_cve(["a", "b", "c"]);
15958 /// ```
15959 pub fn set_cve<T, V>(mut self, v: T) -> Self
15960 where
15961 T: std::iter::IntoIterator<Item = V>,
15962 V: std::convert::Into<std::string::String>,
15963 {
15964 use std::iter::Iterator;
15965 self.cve = v.into_iter().map(|i| i.into()).collect();
15966 self
15967 }
15968}
15969
15970impl wkt::message::Message for UpgradeDistribution {
15971 fn typename() -> &'static str {
15972 "type.googleapis.com/grafeas.v1.UpgradeDistribution"
15973 }
15974}
15975
15976/// Windows Update represents the metadata about the update for the Windows
15977/// operating system. The fields in this message come from the Windows Update API
15978/// documented at
15979/// <https://docs.microsoft.com/en-us/windows/win32/api/wuapi/nn-wuapi-iupdate>.
15980#[derive(Clone, Default, PartialEq)]
15981#[non_exhaustive]
15982pub struct WindowsUpdate {
15983 /// Required - The unique identifier for the update.
15984 pub identity: std::option::Option<crate::model::windows_update::Identity>,
15985
15986 /// The localized title of the update.
15987 pub title: std::string::String,
15988
15989 /// The localized description of the update.
15990 pub description: std::string::String,
15991
15992 /// The list of categories to which the update belongs.
15993 pub categories: std::vec::Vec<crate::model::windows_update::Category>,
15994
15995 /// The Microsoft Knowledge Base article IDs that are associated with the
15996 /// update.
15997 pub kb_article_ids: std::vec::Vec<std::string::String>,
15998
15999 /// The hyperlink to the support information for the update.
16000 pub support_url: std::string::String,
16001
16002 /// The last published timestamp of the update.
16003 pub last_published_timestamp: std::option::Option<wkt::Timestamp>,
16004
16005 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16006}
16007
16008impl WindowsUpdate {
16009 pub fn new() -> Self {
16010 std::default::Default::default()
16011 }
16012
16013 /// Sets the value of [identity][crate::model::WindowsUpdate::identity].
16014 ///
16015 /// # Example
16016 /// ```ignore,no_run
16017 /// # use google_cloud_grafeas_v1::model::WindowsUpdate;
16018 /// use google_cloud_grafeas_v1::model::windows_update::Identity;
16019 /// let x = WindowsUpdate::new().set_identity(Identity::default()/* use setters */);
16020 /// ```
16021 pub fn set_identity<T>(mut self, v: T) -> Self
16022 where
16023 T: std::convert::Into<crate::model::windows_update::Identity>,
16024 {
16025 self.identity = std::option::Option::Some(v.into());
16026 self
16027 }
16028
16029 /// Sets or clears the value of [identity][crate::model::WindowsUpdate::identity].
16030 ///
16031 /// # Example
16032 /// ```ignore,no_run
16033 /// # use google_cloud_grafeas_v1::model::WindowsUpdate;
16034 /// use google_cloud_grafeas_v1::model::windows_update::Identity;
16035 /// let x = WindowsUpdate::new().set_or_clear_identity(Some(Identity::default()/* use setters */));
16036 /// let x = WindowsUpdate::new().set_or_clear_identity(None::<Identity>);
16037 /// ```
16038 pub fn set_or_clear_identity<T>(mut self, v: std::option::Option<T>) -> Self
16039 where
16040 T: std::convert::Into<crate::model::windows_update::Identity>,
16041 {
16042 self.identity = v.map(|x| x.into());
16043 self
16044 }
16045
16046 /// Sets the value of [title][crate::model::WindowsUpdate::title].
16047 ///
16048 /// # Example
16049 /// ```ignore,no_run
16050 /// # use google_cloud_grafeas_v1::model::WindowsUpdate;
16051 /// let x = WindowsUpdate::new().set_title("example");
16052 /// ```
16053 pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16054 self.title = v.into();
16055 self
16056 }
16057
16058 /// Sets the value of [description][crate::model::WindowsUpdate::description].
16059 ///
16060 /// # Example
16061 /// ```ignore,no_run
16062 /// # use google_cloud_grafeas_v1::model::WindowsUpdate;
16063 /// let x = WindowsUpdate::new().set_description("example");
16064 /// ```
16065 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16066 self.description = v.into();
16067 self
16068 }
16069
16070 /// Sets the value of [categories][crate::model::WindowsUpdate::categories].
16071 ///
16072 /// # Example
16073 /// ```ignore,no_run
16074 /// # use google_cloud_grafeas_v1::model::WindowsUpdate;
16075 /// use google_cloud_grafeas_v1::model::windows_update::Category;
16076 /// let x = WindowsUpdate::new()
16077 /// .set_categories([
16078 /// Category::default()/* use setters */,
16079 /// Category::default()/* use (different) setters */,
16080 /// ]);
16081 /// ```
16082 pub fn set_categories<T, V>(mut self, v: T) -> Self
16083 where
16084 T: std::iter::IntoIterator<Item = V>,
16085 V: std::convert::Into<crate::model::windows_update::Category>,
16086 {
16087 use std::iter::Iterator;
16088 self.categories = v.into_iter().map(|i| i.into()).collect();
16089 self
16090 }
16091
16092 /// Sets the value of [kb_article_ids][crate::model::WindowsUpdate::kb_article_ids].
16093 ///
16094 /// # Example
16095 /// ```ignore,no_run
16096 /// # use google_cloud_grafeas_v1::model::WindowsUpdate;
16097 /// let x = WindowsUpdate::new().set_kb_article_ids(["a", "b", "c"]);
16098 /// ```
16099 pub fn set_kb_article_ids<T, V>(mut self, v: T) -> Self
16100 where
16101 T: std::iter::IntoIterator<Item = V>,
16102 V: std::convert::Into<std::string::String>,
16103 {
16104 use std::iter::Iterator;
16105 self.kb_article_ids = v.into_iter().map(|i| i.into()).collect();
16106 self
16107 }
16108
16109 /// Sets the value of [support_url][crate::model::WindowsUpdate::support_url].
16110 ///
16111 /// # Example
16112 /// ```ignore,no_run
16113 /// # use google_cloud_grafeas_v1::model::WindowsUpdate;
16114 /// let x = WindowsUpdate::new().set_support_url("example");
16115 /// ```
16116 pub fn set_support_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16117 self.support_url = v.into();
16118 self
16119 }
16120
16121 /// Sets the value of [last_published_timestamp][crate::model::WindowsUpdate::last_published_timestamp].
16122 ///
16123 /// # Example
16124 /// ```ignore,no_run
16125 /// # use google_cloud_grafeas_v1::model::WindowsUpdate;
16126 /// use wkt::Timestamp;
16127 /// let x = WindowsUpdate::new().set_last_published_timestamp(Timestamp::default()/* use setters */);
16128 /// ```
16129 pub fn set_last_published_timestamp<T>(mut self, v: T) -> Self
16130 where
16131 T: std::convert::Into<wkt::Timestamp>,
16132 {
16133 self.last_published_timestamp = std::option::Option::Some(v.into());
16134 self
16135 }
16136
16137 /// Sets or clears the value of [last_published_timestamp][crate::model::WindowsUpdate::last_published_timestamp].
16138 ///
16139 /// # Example
16140 /// ```ignore,no_run
16141 /// # use google_cloud_grafeas_v1::model::WindowsUpdate;
16142 /// use wkt::Timestamp;
16143 /// let x = WindowsUpdate::new().set_or_clear_last_published_timestamp(Some(Timestamp::default()/* use setters */));
16144 /// let x = WindowsUpdate::new().set_or_clear_last_published_timestamp(None::<Timestamp>);
16145 /// ```
16146 pub fn set_or_clear_last_published_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
16147 where
16148 T: std::convert::Into<wkt::Timestamp>,
16149 {
16150 self.last_published_timestamp = v.map(|x| x.into());
16151 self
16152 }
16153}
16154
16155impl wkt::message::Message for WindowsUpdate {
16156 fn typename() -> &'static str {
16157 "type.googleapis.com/grafeas.v1.WindowsUpdate"
16158 }
16159}
16160
16161/// Defines additional types related to [WindowsUpdate].
16162pub mod windows_update {
16163 #[allow(unused_imports)]
16164 use super::*;
16165
16166 /// The unique identifier of the update.
16167 #[derive(Clone, Default, PartialEq)]
16168 #[non_exhaustive]
16169 pub struct Identity {
16170 /// The revision independent identifier of the update.
16171 pub update_id: std::string::String,
16172
16173 /// The revision number of the update.
16174 pub revision: i32,
16175
16176 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16177 }
16178
16179 impl Identity {
16180 pub fn new() -> Self {
16181 std::default::Default::default()
16182 }
16183
16184 /// Sets the value of [update_id][crate::model::windows_update::Identity::update_id].
16185 ///
16186 /// # Example
16187 /// ```ignore,no_run
16188 /// # use google_cloud_grafeas_v1::model::windows_update::Identity;
16189 /// let x = Identity::new().set_update_id("example");
16190 /// ```
16191 pub fn set_update_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16192 self.update_id = v.into();
16193 self
16194 }
16195
16196 /// Sets the value of [revision][crate::model::windows_update::Identity::revision].
16197 ///
16198 /// # Example
16199 /// ```ignore,no_run
16200 /// # use google_cloud_grafeas_v1::model::windows_update::Identity;
16201 /// let x = Identity::new().set_revision(42);
16202 /// ```
16203 pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16204 self.revision = v.into();
16205 self
16206 }
16207 }
16208
16209 impl wkt::message::Message for Identity {
16210 fn typename() -> &'static str {
16211 "type.googleapis.com/grafeas.v1.WindowsUpdate.Identity"
16212 }
16213 }
16214
16215 /// The category to which the update belongs.
16216 #[derive(Clone, Default, PartialEq)]
16217 #[non_exhaustive]
16218 pub struct Category {
16219 /// The identifier of the category.
16220 pub category_id: std::string::String,
16221
16222 /// The localized name of the category.
16223 pub name: std::string::String,
16224
16225 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16226 }
16227
16228 impl Category {
16229 pub fn new() -> Self {
16230 std::default::Default::default()
16231 }
16232
16233 /// Sets the value of [category_id][crate::model::windows_update::Category::category_id].
16234 ///
16235 /// # Example
16236 /// ```ignore,no_run
16237 /// # use google_cloud_grafeas_v1::model::windows_update::Category;
16238 /// let x = Category::new().set_category_id("example");
16239 /// ```
16240 pub fn set_category_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16241 self.category_id = v.into();
16242 self
16243 }
16244
16245 /// Sets the value of [name][crate::model::windows_update::Category::name].
16246 ///
16247 /// # Example
16248 /// ```ignore,no_run
16249 /// # use google_cloud_grafeas_v1::model::windows_update::Category;
16250 /// let x = Category::new().set_name("example");
16251 /// ```
16252 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16253 self.name = v.into();
16254 self
16255 }
16256 }
16257
16258 impl wkt::message::Message for Category {
16259 fn typename() -> &'static str {
16260 "type.googleapis.com/grafeas.v1.WindowsUpdate.Category"
16261 }
16262 }
16263}
16264
16265/// An Upgrade Occurrence represents that a specific resource_url could install a
16266/// specific upgrade. This presence is supplied via local sources (i.e. it is
16267/// present in the mirror and the running system has noticed its availability).
16268/// For Windows, both distribution and windows_update contain information for the
16269/// Windows update.
16270#[derive(Clone, Default, PartialEq)]
16271#[non_exhaustive]
16272pub struct UpgradeOccurrence {
16273 /// Required for non-Windows OS. The package this Upgrade is for.
16274 pub package: std::string::String,
16275
16276 /// Required for non-Windows OS. The version of the package in a machine +
16277 /// human readable form.
16278 pub parsed_version: std::option::Option<crate::model::Version>,
16279
16280 /// Metadata about the upgrade for available for the specific operating system
16281 /// for the resource_url. This allows efficient filtering, as well as
16282 /// making it easier to use the occurrence.
16283 pub distribution: std::option::Option<crate::model::UpgradeDistribution>,
16284
16285 /// Required for Windows OS. Represents the metadata about the Windows update.
16286 pub windows_update: std::option::Option<crate::model::WindowsUpdate>,
16287
16288 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16289}
16290
16291impl UpgradeOccurrence {
16292 pub fn new() -> Self {
16293 std::default::Default::default()
16294 }
16295
16296 /// Sets the value of [package][crate::model::UpgradeOccurrence::package].
16297 ///
16298 /// # Example
16299 /// ```ignore,no_run
16300 /// # use google_cloud_grafeas_v1::model::UpgradeOccurrence;
16301 /// let x = UpgradeOccurrence::new().set_package("example");
16302 /// ```
16303 pub fn set_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16304 self.package = v.into();
16305 self
16306 }
16307
16308 /// Sets the value of [parsed_version][crate::model::UpgradeOccurrence::parsed_version].
16309 ///
16310 /// # Example
16311 /// ```ignore,no_run
16312 /// # use google_cloud_grafeas_v1::model::UpgradeOccurrence;
16313 /// use google_cloud_grafeas_v1::model::Version;
16314 /// let x = UpgradeOccurrence::new().set_parsed_version(Version::default()/* use setters */);
16315 /// ```
16316 pub fn set_parsed_version<T>(mut self, v: T) -> Self
16317 where
16318 T: std::convert::Into<crate::model::Version>,
16319 {
16320 self.parsed_version = std::option::Option::Some(v.into());
16321 self
16322 }
16323
16324 /// Sets or clears the value of [parsed_version][crate::model::UpgradeOccurrence::parsed_version].
16325 ///
16326 /// # Example
16327 /// ```ignore,no_run
16328 /// # use google_cloud_grafeas_v1::model::UpgradeOccurrence;
16329 /// use google_cloud_grafeas_v1::model::Version;
16330 /// let x = UpgradeOccurrence::new().set_or_clear_parsed_version(Some(Version::default()/* use setters */));
16331 /// let x = UpgradeOccurrence::new().set_or_clear_parsed_version(None::<Version>);
16332 /// ```
16333 pub fn set_or_clear_parsed_version<T>(mut self, v: std::option::Option<T>) -> Self
16334 where
16335 T: std::convert::Into<crate::model::Version>,
16336 {
16337 self.parsed_version = v.map(|x| x.into());
16338 self
16339 }
16340
16341 /// Sets the value of [distribution][crate::model::UpgradeOccurrence::distribution].
16342 ///
16343 /// # Example
16344 /// ```ignore,no_run
16345 /// # use google_cloud_grafeas_v1::model::UpgradeOccurrence;
16346 /// use google_cloud_grafeas_v1::model::UpgradeDistribution;
16347 /// let x = UpgradeOccurrence::new().set_distribution(UpgradeDistribution::default()/* use setters */);
16348 /// ```
16349 pub fn set_distribution<T>(mut self, v: T) -> Self
16350 where
16351 T: std::convert::Into<crate::model::UpgradeDistribution>,
16352 {
16353 self.distribution = std::option::Option::Some(v.into());
16354 self
16355 }
16356
16357 /// Sets or clears the value of [distribution][crate::model::UpgradeOccurrence::distribution].
16358 ///
16359 /// # Example
16360 /// ```ignore,no_run
16361 /// # use google_cloud_grafeas_v1::model::UpgradeOccurrence;
16362 /// use google_cloud_grafeas_v1::model::UpgradeDistribution;
16363 /// let x = UpgradeOccurrence::new().set_or_clear_distribution(Some(UpgradeDistribution::default()/* use setters */));
16364 /// let x = UpgradeOccurrence::new().set_or_clear_distribution(None::<UpgradeDistribution>);
16365 /// ```
16366 pub fn set_or_clear_distribution<T>(mut self, v: std::option::Option<T>) -> Self
16367 where
16368 T: std::convert::Into<crate::model::UpgradeDistribution>,
16369 {
16370 self.distribution = v.map(|x| x.into());
16371 self
16372 }
16373
16374 /// Sets the value of [windows_update][crate::model::UpgradeOccurrence::windows_update].
16375 ///
16376 /// # Example
16377 /// ```ignore,no_run
16378 /// # use google_cloud_grafeas_v1::model::UpgradeOccurrence;
16379 /// use google_cloud_grafeas_v1::model::WindowsUpdate;
16380 /// let x = UpgradeOccurrence::new().set_windows_update(WindowsUpdate::default()/* use setters */);
16381 /// ```
16382 pub fn set_windows_update<T>(mut self, v: T) -> Self
16383 where
16384 T: std::convert::Into<crate::model::WindowsUpdate>,
16385 {
16386 self.windows_update = std::option::Option::Some(v.into());
16387 self
16388 }
16389
16390 /// Sets or clears the value of [windows_update][crate::model::UpgradeOccurrence::windows_update].
16391 ///
16392 /// # Example
16393 /// ```ignore,no_run
16394 /// # use google_cloud_grafeas_v1::model::UpgradeOccurrence;
16395 /// use google_cloud_grafeas_v1::model::WindowsUpdate;
16396 /// let x = UpgradeOccurrence::new().set_or_clear_windows_update(Some(WindowsUpdate::default()/* use setters */));
16397 /// let x = UpgradeOccurrence::new().set_or_clear_windows_update(None::<WindowsUpdate>);
16398 /// ```
16399 pub fn set_or_clear_windows_update<T>(mut self, v: std::option::Option<T>) -> Self
16400 where
16401 T: std::convert::Into<crate::model::WindowsUpdate>,
16402 {
16403 self.windows_update = v.map(|x| x.into());
16404 self
16405 }
16406}
16407
16408impl wkt::message::Message for UpgradeOccurrence {
16409 fn typename() -> &'static str {
16410 "type.googleapis.com/grafeas.v1.UpgradeOccurrence"
16411 }
16412}
16413
16414/// A single VulnerabilityAssessmentNote represents
16415/// one particular product's vulnerability assessment for one CVE.
16416#[derive(Clone, Default, PartialEq)]
16417#[non_exhaustive]
16418pub struct VulnerabilityAssessmentNote {
16419 /// The title of the note. E.g. `Vex-Debian-11.4`
16420 pub title: std::string::String,
16421
16422 /// A one sentence description of this Vex.
16423 pub short_description: std::string::String,
16424
16425 /// A detailed description of this Vex.
16426 pub long_description: std::string::String,
16427
16428 /// Identifies the language used by this document,
16429 /// corresponding to IETF BCP 47 / RFC 5646.
16430 pub language_code: std::string::String,
16431
16432 /// Publisher details of this Note.
16433 pub publisher: std::option::Option<crate::model::vulnerability_assessment_note::Publisher>,
16434
16435 /// The product affected by this vex.
16436 pub product: std::option::Option<crate::model::vulnerability_assessment_note::Product>,
16437
16438 /// Represents a vulnerability assessment for the product.
16439 pub assessment: std::option::Option<crate::model::vulnerability_assessment_note::Assessment>,
16440
16441 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16442}
16443
16444impl VulnerabilityAssessmentNote {
16445 pub fn new() -> Self {
16446 std::default::Default::default()
16447 }
16448
16449 /// Sets the value of [title][crate::model::VulnerabilityAssessmentNote::title].
16450 ///
16451 /// # Example
16452 /// ```ignore,no_run
16453 /// # use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
16454 /// let x = VulnerabilityAssessmentNote::new().set_title("example");
16455 /// ```
16456 pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16457 self.title = v.into();
16458 self
16459 }
16460
16461 /// Sets the value of [short_description][crate::model::VulnerabilityAssessmentNote::short_description].
16462 ///
16463 /// # Example
16464 /// ```ignore,no_run
16465 /// # use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
16466 /// let x = VulnerabilityAssessmentNote::new().set_short_description("example");
16467 /// ```
16468 pub fn set_short_description<T: std::convert::Into<std::string::String>>(
16469 mut self,
16470 v: T,
16471 ) -> Self {
16472 self.short_description = v.into();
16473 self
16474 }
16475
16476 /// Sets the value of [long_description][crate::model::VulnerabilityAssessmentNote::long_description].
16477 ///
16478 /// # Example
16479 /// ```ignore,no_run
16480 /// # use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
16481 /// let x = VulnerabilityAssessmentNote::new().set_long_description("example");
16482 /// ```
16483 pub fn set_long_description<T: std::convert::Into<std::string::String>>(
16484 mut self,
16485 v: T,
16486 ) -> Self {
16487 self.long_description = v.into();
16488 self
16489 }
16490
16491 /// Sets the value of [language_code][crate::model::VulnerabilityAssessmentNote::language_code].
16492 ///
16493 /// # Example
16494 /// ```ignore,no_run
16495 /// # use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
16496 /// let x = VulnerabilityAssessmentNote::new().set_language_code("example");
16497 /// ```
16498 pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16499 self.language_code = v.into();
16500 self
16501 }
16502
16503 /// Sets the value of [publisher][crate::model::VulnerabilityAssessmentNote::publisher].
16504 ///
16505 /// # Example
16506 /// ```ignore,no_run
16507 /// # use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
16508 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Publisher;
16509 /// let x = VulnerabilityAssessmentNote::new().set_publisher(Publisher::default()/* use setters */);
16510 /// ```
16511 pub fn set_publisher<T>(mut self, v: T) -> Self
16512 where
16513 T: std::convert::Into<crate::model::vulnerability_assessment_note::Publisher>,
16514 {
16515 self.publisher = std::option::Option::Some(v.into());
16516 self
16517 }
16518
16519 /// Sets or clears the value of [publisher][crate::model::VulnerabilityAssessmentNote::publisher].
16520 ///
16521 /// # Example
16522 /// ```ignore,no_run
16523 /// # use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
16524 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Publisher;
16525 /// let x = VulnerabilityAssessmentNote::new().set_or_clear_publisher(Some(Publisher::default()/* use setters */));
16526 /// let x = VulnerabilityAssessmentNote::new().set_or_clear_publisher(None::<Publisher>);
16527 /// ```
16528 pub fn set_or_clear_publisher<T>(mut self, v: std::option::Option<T>) -> Self
16529 where
16530 T: std::convert::Into<crate::model::vulnerability_assessment_note::Publisher>,
16531 {
16532 self.publisher = v.map(|x| x.into());
16533 self
16534 }
16535
16536 /// Sets the value of [product][crate::model::VulnerabilityAssessmentNote::product].
16537 ///
16538 /// # Example
16539 /// ```ignore,no_run
16540 /// # use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
16541 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Product;
16542 /// let x = VulnerabilityAssessmentNote::new().set_product(Product::default()/* use setters */);
16543 /// ```
16544 pub fn set_product<T>(mut self, v: T) -> Self
16545 where
16546 T: std::convert::Into<crate::model::vulnerability_assessment_note::Product>,
16547 {
16548 self.product = std::option::Option::Some(v.into());
16549 self
16550 }
16551
16552 /// Sets or clears the value of [product][crate::model::VulnerabilityAssessmentNote::product].
16553 ///
16554 /// # Example
16555 /// ```ignore,no_run
16556 /// # use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
16557 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Product;
16558 /// let x = VulnerabilityAssessmentNote::new().set_or_clear_product(Some(Product::default()/* use setters */));
16559 /// let x = VulnerabilityAssessmentNote::new().set_or_clear_product(None::<Product>);
16560 /// ```
16561 pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
16562 where
16563 T: std::convert::Into<crate::model::vulnerability_assessment_note::Product>,
16564 {
16565 self.product = v.map(|x| x.into());
16566 self
16567 }
16568
16569 /// Sets the value of [assessment][crate::model::VulnerabilityAssessmentNote::assessment].
16570 ///
16571 /// # Example
16572 /// ```ignore,no_run
16573 /// # use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
16574 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
16575 /// let x = VulnerabilityAssessmentNote::new().set_assessment(Assessment::default()/* use setters */);
16576 /// ```
16577 pub fn set_assessment<T>(mut self, v: T) -> Self
16578 where
16579 T: std::convert::Into<crate::model::vulnerability_assessment_note::Assessment>,
16580 {
16581 self.assessment = std::option::Option::Some(v.into());
16582 self
16583 }
16584
16585 /// Sets or clears the value of [assessment][crate::model::VulnerabilityAssessmentNote::assessment].
16586 ///
16587 /// # Example
16588 /// ```ignore,no_run
16589 /// # use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
16590 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
16591 /// let x = VulnerabilityAssessmentNote::new().set_or_clear_assessment(Some(Assessment::default()/* use setters */));
16592 /// let x = VulnerabilityAssessmentNote::new().set_or_clear_assessment(None::<Assessment>);
16593 /// ```
16594 pub fn set_or_clear_assessment<T>(mut self, v: std::option::Option<T>) -> Self
16595 where
16596 T: std::convert::Into<crate::model::vulnerability_assessment_note::Assessment>,
16597 {
16598 self.assessment = v.map(|x| x.into());
16599 self
16600 }
16601}
16602
16603impl wkt::message::Message for VulnerabilityAssessmentNote {
16604 fn typename() -> &'static str {
16605 "type.googleapis.com/grafeas.v1.VulnerabilityAssessmentNote"
16606 }
16607}
16608
16609/// Defines additional types related to [VulnerabilityAssessmentNote].
16610pub mod vulnerability_assessment_note {
16611 #[allow(unused_imports)]
16612 use super::*;
16613
16614 /// Publisher contains information about the publisher of
16615 /// this Note.
16616 /// (-- api-linter: core::0123::resource-annotation=disabled
16617 /// aip.dev/not-precedent: Publisher is not a separate resource. --)
16618 #[derive(Clone, Default, PartialEq)]
16619 #[non_exhaustive]
16620 pub struct Publisher {
16621 /// Name of the publisher.
16622 /// Examples: 'Google', 'Google Cloud Platform'.
16623 pub name: std::string::String,
16624
16625 /// Provides information about the authority of the issuing party to
16626 /// release the document, in particular, the party's constituency and
16627 /// responsibilities or other obligations.
16628 pub issuing_authority: std::string::String,
16629
16630 /// The context or namespace.
16631 /// Contains a URL which is under control of the issuing party and can
16632 /// be used as a globally unique identifier for that issuing party.
16633 /// Example: <https://csaf.io>
16634 pub publisher_namespace: std::string::String,
16635
16636 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16637 }
16638
16639 impl Publisher {
16640 pub fn new() -> Self {
16641 std::default::Default::default()
16642 }
16643
16644 /// Sets the value of [name][crate::model::vulnerability_assessment_note::Publisher::name].
16645 ///
16646 /// # Example
16647 /// ```ignore,no_run
16648 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Publisher;
16649 /// let x = Publisher::new().set_name("example");
16650 /// ```
16651 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16652 self.name = v.into();
16653 self
16654 }
16655
16656 /// Sets the value of [issuing_authority][crate::model::vulnerability_assessment_note::Publisher::issuing_authority].
16657 ///
16658 /// # Example
16659 /// ```ignore,no_run
16660 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Publisher;
16661 /// let x = Publisher::new().set_issuing_authority("example");
16662 /// ```
16663 pub fn set_issuing_authority<T: std::convert::Into<std::string::String>>(
16664 mut self,
16665 v: T,
16666 ) -> Self {
16667 self.issuing_authority = v.into();
16668 self
16669 }
16670
16671 /// Sets the value of [publisher_namespace][crate::model::vulnerability_assessment_note::Publisher::publisher_namespace].
16672 ///
16673 /// # Example
16674 /// ```ignore,no_run
16675 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Publisher;
16676 /// let x = Publisher::new().set_publisher_namespace("example");
16677 /// ```
16678 pub fn set_publisher_namespace<T: std::convert::Into<std::string::String>>(
16679 mut self,
16680 v: T,
16681 ) -> Self {
16682 self.publisher_namespace = v.into();
16683 self
16684 }
16685 }
16686
16687 impl wkt::message::Message for Publisher {
16688 fn typename() -> &'static str {
16689 "type.googleapis.com/grafeas.v1.VulnerabilityAssessmentNote.Publisher"
16690 }
16691 }
16692
16693 /// Product contains information about a product and how to uniquely identify
16694 /// it.
16695 /// (-- api-linter: core::0123::resource-annotation=disabled
16696 /// aip.dev/not-precedent: Product is not a separate resource. --)
16697 #[derive(Clone, Default, PartialEq)]
16698 #[non_exhaustive]
16699 pub struct Product {
16700 /// Name of the product.
16701 pub name: std::string::String,
16702
16703 /// Token that identifies a product so that it can be referred to from other
16704 /// parts in the document. There is no predefined format as long as it
16705 /// uniquely identifies a group in the context of the current document.
16706 pub id: std::string::String,
16707
16708 pub identifier:
16709 std::option::Option<crate::model::vulnerability_assessment_note::product::Identifier>,
16710
16711 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16712 }
16713
16714 impl Product {
16715 pub fn new() -> Self {
16716 std::default::Default::default()
16717 }
16718
16719 /// Sets the value of [name][crate::model::vulnerability_assessment_note::Product::name].
16720 ///
16721 /// # Example
16722 /// ```ignore,no_run
16723 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Product;
16724 /// let x = Product::new().set_name("example");
16725 /// ```
16726 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16727 self.name = v.into();
16728 self
16729 }
16730
16731 /// Sets the value of [id][crate::model::vulnerability_assessment_note::Product::id].
16732 ///
16733 /// # Example
16734 /// ```ignore,no_run
16735 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Product;
16736 /// let x = Product::new().set_id("example");
16737 /// ```
16738 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16739 self.id = v.into();
16740 self
16741 }
16742
16743 /// Sets the value of [identifier][crate::model::vulnerability_assessment_note::Product::identifier].
16744 ///
16745 /// Note that all the setters affecting `identifier` are mutually
16746 /// exclusive.
16747 ///
16748 /// # Example
16749 /// ```ignore,no_run
16750 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Product;
16751 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::product::Identifier;
16752 /// let x = Product::new().set_identifier(Some(Identifier::GenericUri("example".to_string())));
16753 /// ```
16754 pub fn set_identifier<
16755 T: std::convert::Into<
16756 std::option::Option<
16757 crate::model::vulnerability_assessment_note::product::Identifier,
16758 >,
16759 >,
16760 >(
16761 mut self,
16762 v: T,
16763 ) -> Self {
16764 self.identifier = v.into();
16765 self
16766 }
16767
16768 /// The value of [identifier][crate::model::vulnerability_assessment_note::Product::identifier]
16769 /// if it holds a `GenericUri`, `None` if the field is not set or
16770 /// holds a different branch.
16771 pub fn generic_uri(&self) -> std::option::Option<&std::string::String> {
16772 #[allow(unreachable_patterns)]
16773 self.identifier.as_ref().and_then(|v| match v {
16774 crate::model::vulnerability_assessment_note::product::Identifier::GenericUri(v) => {
16775 std::option::Option::Some(v)
16776 }
16777 _ => std::option::Option::None,
16778 })
16779 }
16780
16781 /// Sets the value of [identifier][crate::model::vulnerability_assessment_note::Product::identifier]
16782 /// to hold a `GenericUri`.
16783 ///
16784 /// Note that all the setters affecting `identifier` are
16785 /// mutually exclusive.
16786 ///
16787 /// # Example
16788 /// ```ignore,no_run
16789 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Product;
16790 /// let x = Product::new().set_generic_uri("example");
16791 /// assert!(x.generic_uri().is_some());
16792 /// ```
16793 pub fn set_generic_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16794 self.identifier = std::option::Option::Some(
16795 crate::model::vulnerability_assessment_note::product::Identifier::GenericUri(
16796 v.into(),
16797 ),
16798 );
16799 self
16800 }
16801 }
16802
16803 impl wkt::message::Message for Product {
16804 fn typename() -> &'static str {
16805 "type.googleapis.com/grafeas.v1.VulnerabilityAssessmentNote.Product"
16806 }
16807 }
16808
16809 /// Defines additional types related to [Product].
16810 pub mod product {
16811 #[allow(unused_imports)]
16812 use super::*;
16813
16814 #[derive(Clone, Debug, PartialEq)]
16815 #[non_exhaustive]
16816 pub enum Identifier {
16817 /// Contains a URI which is vendor-specific.
16818 /// Example: The artifact repository URL of an image.
16819 GenericUri(std::string::String),
16820 }
16821 }
16822
16823 /// Assessment provides all information that is related to a single
16824 /// vulnerability for this product.
16825 #[derive(Clone, Default, PartialEq)]
16826 #[non_exhaustive]
16827 pub struct Assessment {
16828 /// Holds the MITRE standard Common Vulnerabilities and Exposures (CVE)
16829 /// tracking number for the vulnerability.
16830 /// Deprecated: Use vulnerability_id instead to denote CVEs.
16831 #[deprecated]
16832 pub cve: std::string::String,
16833
16834 /// The vulnerability identifier for this Assessment. Will hold one of
16835 /// common identifiers e.g. CVE, GHSA etc.
16836 pub vulnerability_id: std::string::String,
16837
16838 /// A one sentence description of this Vex.
16839 pub short_description: std::string::String,
16840
16841 /// A detailed description of this Vex.
16842 pub long_description: std::string::String,
16843
16844 /// Holds a list of references associated with this vulnerability item and
16845 /// assessment. These uris have additional information about the
16846 /// vulnerability and the assessment itself. E.g. Link to a document which
16847 /// details how this assessment concluded the state of this vulnerability.
16848 pub related_uris: std::vec::Vec<crate::model::RelatedUrl>,
16849
16850 /// Provides the state of this Vulnerability assessment.
16851 pub state: crate::model::vulnerability_assessment_note::assessment::State,
16852
16853 /// Contains information about the impact of this vulnerability,
16854 /// this will change with time.
16855 pub impacts: std::vec::Vec<std::string::String>,
16856
16857 /// Justification provides the justification when the state of the
16858 /// assessment if NOT_AFFECTED.
16859 pub justification: std::option::Option<
16860 crate::model::vulnerability_assessment_note::assessment::Justification,
16861 >,
16862
16863 /// Specifies details on how to handle (and presumably, fix) a vulnerability.
16864 pub remediations:
16865 std::vec::Vec<crate::model::vulnerability_assessment_note::assessment::Remediation>,
16866
16867 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16868 }
16869
16870 impl Assessment {
16871 pub fn new() -> Self {
16872 std::default::Default::default()
16873 }
16874
16875 /// Sets the value of [cve][crate::model::vulnerability_assessment_note::Assessment::cve].
16876 ///
16877 /// # Example
16878 /// ```ignore,no_run
16879 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
16880 /// let x = Assessment::new().set_cve("example");
16881 /// ```
16882 #[deprecated]
16883 pub fn set_cve<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16884 self.cve = v.into();
16885 self
16886 }
16887
16888 /// Sets the value of [vulnerability_id][crate::model::vulnerability_assessment_note::Assessment::vulnerability_id].
16889 ///
16890 /// # Example
16891 /// ```ignore,no_run
16892 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
16893 /// let x = Assessment::new().set_vulnerability_id("example");
16894 /// ```
16895 pub fn set_vulnerability_id<T: std::convert::Into<std::string::String>>(
16896 mut self,
16897 v: T,
16898 ) -> Self {
16899 self.vulnerability_id = v.into();
16900 self
16901 }
16902
16903 /// Sets the value of [short_description][crate::model::vulnerability_assessment_note::Assessment::short_description].
16904 ///
16905 /// # Example
16906 /// ```ignore,no_run
16907 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
16908 /// let x = Assessment::new().set_short_description("example");
16909 /// ```
16910 pub fn set_short_description<T: std::convert::Into<std::string::String>>(
16911 mut self,
16912 v: T,
16913 ) -> Self {
16914 self.short_description = v.into();
16915 self
16916 }
16917
16918 /// Sets the value of [long_description][crate::model::vulnerability_assessment_note::Assessment::long_description].
16919 ///
16920 /// # Example
16921 /// ```ignore,no_run
16922 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
16923 /// let x = Assessment::new().set_long_description("example");
16924 /// ```
16925 pub fn set_long_description<T: std::convert::Into<std::string::String>>(
16926 mut self,
16927 v: T,
16928 ) -> Self {
16929 self.long_description = v.into();
16930 self
16931 }
16932
16933 /// Sets the value of [related_uris][crate::model::vulnerability_assessment_note::Assessment::related_uris].
16934 ///
16935 /// # Example
16936 /// ```ignore,no_run
16937 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
16938 /// use google_cloud_grafeas_v1::model::RelatedUrl;
16939 /// let x = Assessment::new()
16940 /// .set_related_uris([
16941 /// RelatedUrl::default()/* use setters */,
16942 /// RelatedUrl::default()/* use (different) setters */,
16943 /// ]);
16944 /// ```
16945 pub fn set_related_uris<T, V>(mut self, v: T) -> Self
16946 where
16947 T: std::iter::IntoIterator<Item = V>,
16948 V: std::convert::Into<crate::model::RelatedUrl>,
16949 {
16950 use std::iter::Iterator;
16951 self.related_uris = v.into_iter().map(|i| i.into()).collect();
16952 self
16953 }
16954
16955 /// Sets the value of [state][crate::model::vulnerability_assessment_note::Assessment::state].
16956 ///
16957 /// # Example
16958 /// ```ignore,no_run
16959 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
16960 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::State;
16961 /// let x0 = Assessment::new().set_state(State::Affected);
16962 /// let x1 = Assessment::new().set_state(State::NotAffected);
16963 /// let x2 = Assessment::new().set_state(State::Fixed);
16964 /// ```
16965 pub fn set_state<
16966 T: std::convert::Into<crate::model::vulnerability_assessment_note::assessment::State>,
16967 >(
16968 mut self,
16969 v: T,
16970 ) -> Self {
16971 self.state = v.into();
16972 self
16973 }
16974
16975 /// Sets the value of [impacts][crate::model::vulnerability_assessment_note::Assessment::impacts].
16976 ///
16977 /// # Example
16978 /// ```ignore,no_run
16979 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
16980 /// let x = Assessment::new().set_impacts(["a", "b", "c"]);
16981 /// ```
16982 pub fn set_impacts<T, V>(mut self, v: T) -> Self
16983 where
16984 T: std::iter::IntoIterator<Item = V>,
16985 V: std::convert::Into<std::string::String>,
16986 {
16987 use std::iter::Iterator;
16988 self.impacts = v.into_iter().map(|i| i.into()).collect();
16989 self
16990 }
16991
16992 /// Sets the value of [justification][crate::model::vulnerability_assessment_note::Assessment::justification].
16993 ///
16994 /// # Example
16995 /// ```ignore,no_run
16996 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
16997 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Justification;
16998 /// let x = Assessment::new().set_justification(Justification::default()/* use setters */);
16999 /// ```
17000 pub fn set_justification<T>(mut self, v: T) -> Self
17001 where
17002 T: std::convert::Into<
17003 crate::model::vulnerability_assessment_note::assessment::Justification,
17004 >,
17005 {
17006 self.justification = std::option::Option::Some(v.into());
17007 self
17008 }
17009
17010 /// Sets or clears the value of [justification][crate::model::vulnerability_assessment_note::Assessment::justification].
17011 ///
17012 /// # Example
17013 /// ```ignore,no_run
17014 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
17015 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Justification;
17016 /// let x = Assessment::new().set_or_clear_justification(Some(Justification::default()/* use setters */));
17017 /// let x = Assessment::new().set_or_clear_justification(None::<Justification>);
17018 /// ```
17019 pub fn set_or_clear_justification<T>(mut self, v: std::option::Option<T>) -> Self
17020 where
17021 T: std::convert::Into<
17022 crate::model::vulnerability_assessment_note::assessment::Justification,
17023 >,
17024 {
17025 self.justification = v.map(|x| x.into());
17026 self
17027 }
17028
17029 /// Sets the value of [remediations][crate::model::vulnerability_assessment_note::Assessment::remediations].
17030 ///
17031 /// # Example
17032 /// ```ignore,no_run
17033 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
17034 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Remediation;
17035 /// let x = Assessment::new()
17036 /// .set_remediations([
17037 /// Remediation::default()/* use setters */,
17038 /// Remediation::default()/* use (different) setters */,
17039 /// ]);
17040 /// ```
17041 pub fn set_remediations<T, V>(mut self, v: T) -> Self
17042 where
17043 T: std::iter::IntoIterator<Item = V>,
17044 V: std::convert::Into<
17045 crate::model::vulnerability_assessment_note::assessment::Remediation,
17046 >,
17047 {
17048 use std::iter::Iterator;
17049 self.remediations = v.into_iter().map(|i| i.into()).collect();
17050 self
17051 }
17052 }
17053
17054 impl wkt::message::Message for Assessment {
17055 fn typename() -> &'static str {
17056 "type.googleapis.com/grafeas.v1.VulnerabilityAssessmentNote.Assessment"
17057 }
17058 }
17059
17060 /// Defines additional types related to [Assessment].
17061 pub mod assessment {
17062 #[allow(unused_imports)]
17063 use super::*;
17064
17065 /// Justification provides the justification when the state of the
17066 /// assessment if NOT_AFFECTED.
17067 #[derive(Clone, Default, PartialEq)]
17068 #[non_exhaustive]
17069 pub struct Justification {
17070
17071 /// The justification type for this vulnerability.
17072 pub justification_type: crate::model::vulnerability_assessment_note::assessment::justification::JustificationType,
17073
17074 /// Additional details on why this justification was chosen.
17075 pub details: std::string::String,
17076
17077 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17078 }
17079
17080 impl Justification {
17081 pub fn new() -> Self {
17082 std::default::Default::default()
17083 }
17084
17085 /// Sets the value of [justification_type][crate::model::vulnerability_assessment_note::assessment::Justification::justification_type].
17086 ///
17087 /// # Example
17088 /// ```ignore,no_run
17089 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Justification;
17090 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::justification::JustificationType;
17091 /// let x0 = Justification::new().set_justification_type(JustificationType::ComponentNotPresent);
17092 /// let x1 = Justification::new().set_justification_type(JustificationType::VulnerableCodeNotPresent);
17093 /// let x2 = Justification::new().set_justification_type(JustificationType::VulnerableCodeNotInExecutePath);
17094 /// ```
17095 pub fn set_justification_type<T: std::convert::Into<crate::model::vulnerability_assessment_note::assessment::justification::JustificationType>>(mut self, v: T) -> Self{
17096 self.justification_type = v.into();
17097 self
17098 }
17099
17100 /// Sets the value of [details][crate::model::vulnerability_assessment_note::assessment::Justification::details].
17101 ///
17102 /// # Example
17103 /// ```ignore,no_run
17104 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Justification;
17105 /// let x = Justification::new().set_details("example");
17106 /// ```
17107 pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17108 self.details = v.into();
17109 self
17110 }
17111 }
17112
17113 impl wkt::message::Message for Justification {
17114 fn typename() -> &'static str {
17115 "type.googleapis.com/grafeas.v1.VulnerabilityAssessmentNote.Assessment.Justification"
17116 }
17117 }
17118
17119 /// Defines additional types related to [Justification].
17120 pub mod justification {
17121 #[allow(unused_imports)]
17122 use super::*;
17123
17124 /// Provides the type of justification.
17125 ///
17126 /// # Working with unknown values
17127 ///
17128 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17129 /// additional enum variants at any time. Adding new variants is not considered
17130 /// a breaking change. Applications should write their code in anticipation of:
17131 ///
17132 /// - New values appearing in future releases of the client library, **and**
17133 /// - New values received dynamically, without application changes.
17134 ///
17135 /// Please consult the [Working with enums] section in the user guide for some
17136 /// guidelines.
17137 ///
17138 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17139 #[derive(Clone, Debug, PartialEq)]
17140 #[non_exhaustive]
17141 pub enum JustificationType {
17142 /// JUSTIFICATION_TYPE_UNSPECIFIED.
17143 Unspecified,
17144 /// The vulnerable component is not present in the product.
17145 ComponentNotPresent,
17146 /// The vulnerable code is not present. Typically this case
17147 /// occurs when source code is configured or built in a way that excludes
17148 /// the vulnerable code.
17149 VulnerableCodeNotPresent,
17150 /// The vulnerable code can not be executed.
17151 /// Typically this case occurs when the product includes the vulnerable
17152 /// code but does not call or use the vulnerable code.
17153 VulnerableCodeNotInExecutePath,
17154 /// The vulnerable code cannot be controlled by an attacker to exploit
17155 /// the vulnerability.
17156 VulnerableCodeCannotBeControlledByAdversary,
17157 /// The product includes built-in protections or features that prevent
17158 /// exploitation of the vulnerability. These built-in protections cannot
17159 /// be subverted by the attacker and cannot be configured or disabled by
17160 /// the user. These mitigations completely prevent exploitation based on
17161 /// known attack vectors.
17162 InlineMitigationsAlreadyExist,
17163 /// If set, the enum was initialized with an unknown value.
17164 ///
17165 /// Applications can examine the value using [JustificationType::value] or
17166 /// [JustificationType::name].
17167 UnknownValue(justification_type::UnknownValue),
17168 }
17169
17170 #[doc(hidden)]
17171 pub mod justification_type {
17172 #[allow(unused_imports)]
17173 use super::*;
17174 #[derive(Clone, Debug, PartialEq)]
17175 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17176 }
17177
17178 impl JustificationType {
17179 /// Gets the enum value.
17180 ///
17181 /// Returns `None` if the enum contains an unknown value deserialized from
17182 /// the string representation of enums.
17183 pub fn value(&self) -> std::option::Option<i32> {
17184 match self {
17185 Self::Unspecified => std::option::Option::Some(0),
17186 Self::ComponentNotPresent => std::option::Option::Some(1),
17187 Self::VulnerableCodeNotPresent => std::option::Option::Some(2),
17188 Self::VulnerableCodeNotInExecutePath => std::option::Option::Some(3),
17189 Self::VulnerableCodeCannotBeControlledByAdversary => {
17190 std::option::Option::Some(4)
17191 }
17192 Self::InlineMitigationsAlreadyExist => std::option::Option::Some(5),
17193 Self::UnknownValue(u) => u.0.value(),
17194 }
17195 }
17196
17197 /// Gets the enum value as a string.
17198 ///
17199 /// Returns `None` if the enum contains an unknown value deserialized from
17200 /// the integer representation of enums.
17201 pub fn name(&self) -> std::option::Option<&str> {
17202 match self {
17203 Self::Unspecified => {
17204 std::option::Option::Some("JUSTIFICATION_TYPE_UNSPECIFIED")
17205 }
17206 Self::ComponentNotPresent => {
17207 std::option::Option::Some("COMPONENT_NOT_PRESENT")
17208 }
17209 Self::VulnerableCodeNotPresent => {
17210 std::option::Option::Some("VULNERABLE_CODE_NOT_PRESENT")
17211 }
17212 Self::VulnerableCodeNotInExecutePath => {
17213 std::option::Option::Some("VULNERABLE_CODE_NOT_IN_EXECUTE_PATH")
17214 }
17215 Self::VulnerableCodeCannotBeControlledByAdversary => {
17216 std::option::Option::Some(
17217 "VULNERABLE_CODE_CANNOT_BE_CONTROLLED_BY_ADVERSARY",
17218 )
17219 }
17220 Self::InlineMitigationsAlreadyExist => {
17221 std::option::Option::Some("INLINE_MITIGATIONS_ALREADY_EXIST")
17222 }
17223 Self::UnknownValue(u) => u.0.name(),
17224 }
17225 }
17226 }
17227
17228 impl std::default::Default for JustificationType {
17229 fn default() -> Self {
17230 use std::convert::From;
17231 Self::from(0)
17232 }
17233 }
17234
17235 impl std::fmt::Display for JustificationType {
17236 fn fmt(
17237 &self,
17238 f: &mut std::fmt::Formatter<'_>,
17239 ) -> std::result::Result<(), std::fmt::Error> {
17240 wkt::internal::display_enum(f, self.name(), self.value())
17241 }
17242 }
17243
17244 impl std::convert::From<i32> for JustificationType {
17245 fn from(value: i32) -> Self {
17246 match value {
17247 0 => Self::Unspecified,
17248 1 => Self::ComponentNotPresent,
17249 2 => Self::VulnerableCodeNotPresent,
17250 3 => Self::VulnerableCodeNotInExecutePath,
17251 4 => Self::VulnerableCodeCannotBeControlledByAdversary,
17252 5 => Self::InlineMitigationsAlreadyExist,
17253 _ => Self::UnknownValue(justification_type::UnknownValue(
17254 wkt::internal::UnknownEnumValue::Integer(value),
17255 )),
17256 }
17257 }
17258 }
17259
17260 impl std::convert::From<&str> for JustificationType {
17261 fn from(value: &str) -> Self {
17262 use std::string::ToString;
17263 match value {
17264 "JUSTIFICATION_TYPE_UNSPECIFIED" => Self::Unspecified,
17265 "COMPONENT_NOT_PRESENT" => Self::ComponentNotPresent,
17266 "VULNERABLE_CODE_NOT_PRESENT" => Self::VulnerableCodeNotPresent,
17267 "VULNERABLE_CODE_NOT_IN_EXECUTE_PATH" => {
17268 Self::VulnerableCodeNotInExecutePath
17269 }
17270 "VULNERABLE_CODE_CANNOT_BE_CONTROLLED_BY_ADVERSARY" => {
17271 Self::VulnerableCodeCannotBeControlledByAdversary
17272 }
17273 "INLINE_MITIGATIONS_ALREADY_EXIST" => Self::InlineMitigationsAlreadyExist,
17274 _ => Self::UnknownValue(justification_type::UnknownValue(
17275 wkt::internal::UnknownEnumValue::String(value.to_string()),
17276 )),
17277 }
17278 }
17279 }
17280
17281 impl serde::ser::Serialize for JustificationType {
17282 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17283 where
17284 S: serde::Serializer,
17285 {
17286 match self {
17287 Self::Unspecified => serializer.serialize_i32(0),
17288 Self::ComponentNotPresent => serializer.serialize_i32(1),
17289 Self::VulnerableCodeNotPresent => serializer.serialize_i32(2),
17290 Self::VulnerableCodeNotInExecutePath => serializer.serialize_i32(3),
17291 Self::VulnerableCodeCannotBeControlledByAdversary => {
17292 serializer.serialize_i32(4)
17293 }
17294 Self::InlineMitigationsAlreadyExist => serializer.serialize_i32(5),
17295 Self::UnknownValue(u) => u.0.serialize(serializer),
17296 }
17297 }
17298 }
17299
17300 impl<'de> serde::de::Deserialize<'de> for JustificationType {
17301 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17302 where
17303 D: serde::Deserializer<'de>,
17304 {
17305 deserializer.deserialize_any(wkt::internal::EnumVisitor::<JustificationType>::new(
17306 ".grafeas.v1.VulnerabilityAssessmentNote.Assessment.Justification.JustificationType"))
17307 }
17308 }
17309 }
17310
17311 /// Specifies details on how to handle (and presumably, fix) a vulnerability.
17312 #[derive(Clone, Default, PartialEq)]
17313 #[non_exhaustive]
17314 pub struct Remediation {
17315
17316 /// The type of remediation that can be applied.
17317 pub remediation_type: crate::model::vulnerability_assessment_note::assessment::remediation::RemediationType,
17318
17319 /// Contains a comprehensive human-readable discussion of the remediation.
17320 pub details: std::string::String,
17321
17322 /// Contains the URL where to obtain the remediation.
17323 pub remediation_uri: std::option::Option<crate::model::RelatedUrl>,
17324
17325 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17326 }
17327
17328 impl Remediation {
17329 pub fn new() -> Self {
17330 std::default::Default::default()
17331 }
17332
17333 /// Sets the value of [remediation_type][crate::model::vulnerability_assessment_note::assessment::Remediation::remediation_type].
17334 ///
17335 /// # Example
17336 /// ```ignore,no_run
17337 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Remediation;
17338 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::remediation::RemediationType;
17339 /// let x0 = Remediation::new().set_remediation_type(RemediationType::Mitigation);
17340 /// let x1 = Remediation::new().set_remediation_type(RemediationType::NoFixPlanned);
17341 /// let x2 = Remediation::new().set_remediation_type(RemediationType::NoneAvailable);
17342 /// ```
17343 pub fn set_remediation_type<T: std::convert::Into<crate::model::vulnerability_assessment_note::assessment::remediation::RemediationType>>(mut self, v: T) -> Self{
17344 self.remediation_type = v.into();
17345 self
17346 }
17347
17348 /// Sets the value of [details][crate::model::vulnerability_assessment_note::assessment::Remediation::details].
17349 ///
17350 /// # Example
17351 /// ```ignore,no_run
17352 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Remediation;
17353 /// let x = Remediation::new().set_details("example");
17354 /// ```
17355 pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17356 self.details = v.into();
17357 self
17358 }
17359
17360 /// Sets the value of [remediation_uri][crate::model::vulnerability_assessment_note::assessment::Remediation::remediation_uri].
17361 ///
17362 /// # Example
17363 /// ```ignore,no_run
17364 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Remediation;
17365 /// use google_cloud_grafeas_v1::model::RelatedUrl;
17366 /// let x = Remediation::new().set_remediation_uri(RelatedUrl::default()/* use setters */);
17367 /// ```
17368 pub fn set_remediation_uri<T>(mut self, v: T) -> Self
17369 where
17370 T: std::convert::Into<crate::model::RelatedUrl>,
17371 {
17372 self.remediation_uri = std::option::Option::Some(v.into());
17373 self
17374 }
17375
17376 /// Sets or clears the value of [remediation_uri][crate::model::vulnerability_assessment_note::assessment::Remediation::remediation_uri].
17377 ///
17378 /// # Example
17379 /// ```ignore,no_run
17380 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Remediation;
17381 /// use google_cloud_grafeas_v1::model::RelatedUrl;
17382 /// let x = Remediation::new().set_or_clear_remediation_uri(Some(RelatedUrl::default()/* use setters */));
17383 /// let x = Remediation::new().set_or_clear_remediation_uri(None::<RelatedUrl>);
17384 /// ```
17385 pub fn set_or_clear_remediation_uri<T>(mut self, v: std::option::Option<T>) -> Self
17386 where
17387 T: std::convert::Into<crate::model::RelatedUrl>,
17388 {
17389 self.remediation_uri = v.map(|x| x.into());
17390 self
17391 }
17392 }
17393
17394 impl wkt::message::Message for Remediation {
17395 fn typename() -> &'static str {
17396 "type.googleapis.com/grafeas.v1.VulnerabilityAssessmentNote.Assessment.Remediation"
17397 }
17398 }
17399
17400 /// Defines additional types related to [Remediation].
17401 pub mod remediation {
17402 #[allow(unused_imports)]
17403 use super::*;
17404
17405 /// The type of remediation that can be applied.
17406 ///
17407 /// # Working with unknown values
17408 ///
17409 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17410 /// additional enum variants at any time. Adding new variants is not considered
17411 /// a breaking change. Applications should write their code in anticipation of:
17412 ///
17413 /// - New values appearing in future releases of the client library, **and**
17414 /// - New values received dynamically, without application changes.
17415 ///
17416 /// Please consult the [Working with enums] section in the user guide for some
17417 /// guidelines.
17418 ///
17419 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17420 #[derive(Clone, Debug, PartialEq)]
17421 #[non_exhaustive]
17422 pub enum RemediationType {
17423 /// No remediation type specified.
17424 Unspecified,
17425 /// A MITIGATION is available.
17426 Mitigation,
17427 /// No fix is planned.
17428 NoFixPlanned,
17429 /// Not available.
17430 NoneAvailable,
17431 /// A vendor fix is available.
17432 VendorFix,
17433 /// A workaround is available.
17434 Workaround,
17435 /// If set, the enum was initialized with an unknown value.
17436 ///
17437 /// Applications can examine the value using [RemediationType::value] or
17438 /// [RemediationType::name].
17439 UnknownValue(remediation_type::UnknownValue),
17440 }
17441
17442 #[doc(hidden)]
17443 pub mod remediation_type {
17444 #[allow(unused_imports)]
17445 use super::*;
17446 #[derive(Clone, Debug, PartialEq)]
17447 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17448 }
17449
17450 impl RemediationType {
17451 /// Gets the enum value.
17452 ///
17453 /// Returns `None` if the enum contains an unknown value deserialized from
17454 /// the string representation of enums.
17455 pub fn value(&self) -> std::option::Option<i32> {
17456 match self {
17457 Self::Unspecified => std::option::Option::Some(0),
17458 Self::Mitigation => std::option::Option::Some(1),
17459 Self::NoFixPlanned => std::option::Option::Some(2),
17460 Self::NoneAvailable => std::option::Option::Some(3),
17461 Self::VendorFix => std::option::Option::Some(4),
17462 Self::Workaround => std::option::Option::Some(5),
17463 Self::UnknownValue(u) => u.0.value(),
17464 }
17465 }
17466
17467 /// Gets the enum value as a string.
17468 ///
17469 /// Returns `None` if the enum contains an unknown value deserialized from
17470 /// the integer representation of enums.
17471 pub fn name(&self) -> std::option::Option<&str> {
17472 match self {
17473 Self::Unspecified => {
17474 std::option::Option::Some("REMEDIATION_TYPE_UNSPECIFIED")
17475 }
17476 Self::Mitigation => std::option::Option::Some("MITIGATION"),
17477 Self::NoFixPlanned => std::option::Option::Some("NO_FIX_PLANNED"),
17478 Self::NoneAvailable => std::option::Option::Some("NONE_AVAILABLE"),
17479 Self::VendorFix => std::option::Option::Some("VENDOR_FIX"),
17480 Self::Workaround => std::option::Option::Some("WORKAROUND"),
17481 Self::UnknownValue(u) => u.0.name(),
17482 }
17483 }
17484 }
17485
17486 impl std::default::Default for RemediationType {
17487 fn default() -> Self {
17488 use std::convert::From;
17489 Self::from(0)
17490 }
17491 }
17492
17493 impl std::fmt::Display for RemediationType {
17494 fn fmt(
17495 &self,
17496 f: &mut std::fmt::Formatter<'_>,
17497 ) -> std::result::Result<(), std::fmt::Error> {
17498 wkt::internal::display_enum(f, self.name(), self.value())
17499 }
17500 }
17501
17502 impl std::convert::From<i32> for RemediationType {
17503 fn from(value: i32) -> Self {
17504 match value {
17505 0 => Self::Unspecified,
17506 1 => Self::Mitigation,
17507 2 => Self::NoFixPlanned,
17508 3 => Self::NoneAvailable,
17509 4 => Self::VendorFix,
17510 5 => Self::Workaround,
17511 _ => Self::UnknownValue(remediation_type::UnknownValue(
17512 wkt::internal::UnknownEnumValue::Integer(value),
17513 )),
17514 }
17515 }
17516 }
17517
17518 impl std::convert::From<&str> for RemediationType {
17519 fn from(value: &str) -> Self {
17520 use std::string::ToString;
17521 match value {
17522 "REMEDIATION_TYPE_UNSPECIFIED" => Self::Unspecified,
17523 "MITIGATION" => Self::Mitigation,
17524 "NO_FIX_PLANNED" => Self::NoFixPlanned,
17525 "NONE_AVAILABLE" => Self::NoneAvailable,
17526 "VENDOR_FIX" => Self::VendorFix,
17527 "WORKAROUND" => Self::Workaround,
17528 _ => Self::UnknownValue(remediation_type::UnknownValue(
17529 wkt::internal::UnknownEnumValue::String(value.to_string()),
17530 )),
17531 }
17532 }
17533 }
17534
17535 impl serde::ser::Serialize for RemediationType {
17536 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17537 where
17538 S: serde::Serializer,
17539 {
17540 match self {
17541 Self::Unspecified => serializer.serialize_i32(0),
17542 Self::Mitigation => serializer.serialize_i32(1),
17543 Self::NoFixPlanned => serializer.serialize_i32(2),
17544 Self::NoneAvailable => serializer.serialize_i32(3),
17545 Self::VendorFix => serializer.serialize_i32(4),
17546 Self::Workaround => serializer.serialize_i32(5),
17547 Self::UnknownValue(u) => u.0.serialize(serializer),
17548 }
17549 }
17550 }
17551
17552 impl<'de> serde::de::Deserialize<'de> for RemediationType {
17553 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17554 where
17555 D: serde::Deserializer<'de>,
17556 {
17557 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RemediationType>::new(
17558 ".grafeas.v1.VulnerabilityAssessmentNote.Assessment.Remediation.RemediationType"))
17559 }
17560 }
17561 }
17562
17563 /// Provides the state of this Vulnerability assessment.
17564 ///
17565 /// # Working with unknown values
17566 ///
17567 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17568 /// additional enum variants at any time. Adding new variants is not considered
17569 /// a breaking change. Applications should write their code in anticipation of:
17570 ///
17571 /// - New values appearing in future releases of the client library, **and**
17572 /// - New values received dynamically, without application changes.
17573 ///
17574 /// Please consult the [Working with enums] section in the user guide for some
17575 /// guidelines.
17576 ///
17577 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17578 #[derive(Clone, Debug, PartialEq)]
17579 #[non_exhaustive]
17580 pub enum State {
17581 /// No state is specified.
17582 Unspecified,
17583 /// This product is known to be affected by this vulnerability.
17584 Affected,
17585 /// This product is known to be not affected by this vulnerability.
17586 NotAffected,
17587 /// This product contains a fix for this vulnerability.
17588 Fixed,
17589 /// It is not known yet whether these versions are or are not affected
17590 /// by the vulnerability. However, it is still under investigation.
17591 UnderInvestigation,
17592 /// If set, the enum was initialized with an unknown value.
17593 ///
17594 /// Applications can examine the value using [State::value] or
17595 /// [State::name].
17596 UnknownValue(state::UnknownValue),
17597 }
17598
17599 #[doc(hidden)]
17600 pub mod state {
17601 #[allow(unused_imports)]
17602 use super::*;
17603 #[derive(Clone, Debug, PartialEq)]
17604 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17605 }
17606
17607 impl State {
17608 /// Gets the enum value.
17609 ///
17610 /// Returns `None` if the enum contains an unknown value deserialized from
17611 /// the string representation of enums.
17612 pub fn value(&self) -> std::option::Option<i32> {
17613 match self {
17614 Self::Unspecified => std::option::Option::Some(0),
17615 Self::Affected => std::option::Option::Some(1),
17616 Self::NotAffected => std::option::Option::Some(2),
17617 Self::Fixed => std::option::Option::Some(3),
17618 Self::UnderInvestigation => std::option::Option::Some(4),
17619 Self::UnknownValue(u) => u.0.value(),
17620 }
17621 }
17622
17623 /// Gets the enum value as a string.
17624 ///
17625 /// Returns `None` if the enum contains an unknown value deserialized from
17626 /// the integer representation of enums.
17627 pub fn name(&self) -> std::option::Option<&str> {
17628 match self {
17629 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
17630 Self::Affected => std::option::Option::Some("AFFECTED"),
17631 Self::NotAffected => std::option::Option::Some("NOT_AFFECTED"),
17632 Self::Fixed => std::option::Option::Some("FIXED"),
17633 Self::UnderInvestigation => std::option::Option::Some("UNDER_INVESTIGATION"),
17634 Self::UnknownValue(u) => u.0.name(),
17635 }
17636 }
17637 }
17638
17639 impl std::default::Default for State {
17640 fn default() -> Self {
17641 use std::convert::From;
17642 Self::from(0)
17643 }
17644 }
17645
17646 impl std::fmt::Display for State {
17647 fn fmt(
17648 &self,
17649 f: &mut std::fmt::Formatter<'_>,
17650 ) -> std::result::Result<(), std::fmt::Error> {
17651 wkt::internal::display_enum(f, self.name(), self.value())
17652 }
17653 }
17654
17655 impl std::convert::From<i32> for State {
17656 fn from(value: i32) -> Self {
17657 match value {
17658 0 => Self::Unspecified,
17659 1 => Self::Affected,
17660 2 => Self::NotAffected,
17661 3 => Self::Fixed,
17662 4 => Self::UnderInvestigation,
17663 _ => Self::UnknownValue(state::UnknownValue(
17664 wkt::internal::UnknownEnumValue::Integer(value),
17665 )),
17666 }
17667 }
17668 }
17669
17670 impl std::convert::From<&str> for State {
17671 fn from(value: &str) -> Self {
17672 use std::string::ToString;
17673 match value {
17674 "STATE_UNSPECIFIED" => Self::Unspecified,
17675 "AFFECTED" => Self::Affected,
17676 "NOT_AFFECTED" => Self::NotAffected,
17677 "FIXED" => Self::Fixed,
17678 "UNDER_INVESTIGATION" => Self::UnderInvestigation,
17679 _ => Self::UnknownValue(state::UnknownValue(
17680 wkt::internal::UnknownEnumValue::String(value.to_string()),
17681 )),
17682 }
17683 }
17684 }
17685
17686 impl serde::ser::Serialize for State {
17687 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17688 where
17689 S: serde::Serializer,
17690 {
17691 match self {
17692 Self::Unspecified => serializer.serialize_i32(0),
17693 Self::Affected => serializer.serialize_i32(1),
17694 Self::NotAffected => serializer.serialize_i32(2),
17695 Self::Fixed => serializer.serialize_i32(3),
17696 Self::UnderInvestigation => serializer.serialize_i32(4),
17697 Self::UnknownValue(u) => u.0.serialize(serializer),
17698 }
17699 }
17700 }
17701
17702 impl<'de> serde::de::Deserialize<'de> for State {
17703 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17704 where
17705 D: serde::Deserializer<'de>,
17706 {
17707 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
17708 ".grafeas.v1.VulnerabilityAssessmentNote.Assessment.State",
17709 ))
17710 }
17711 }
17712 }
17713}
17714
17715/// A security vulnerability that can be found in resources.
17716#[derive(Clone, Default, PartialEq)]
17717#[non_exhaustive]
17718pub struct VulnerabilityNote {
17719 /// The CVSS score of this vulnerability. CVSS score is on a scale of 0 - 10
17720 /// where 0 indicates low severity and 10 indicates high severity.
17721 pub cvss_score: f32,
17722
17723 /// The note provider assigned severity of this vulnerability.
17724 pub severity: crate::model::Severity,
17725
17726 /// Details of all known distros and packages affected by this vulnerability.
17727 pub details: std::vec::Vec<crate::model::vulnerability_note::Detail>,
17728
17729 /// The full description of the CVSSv3 for this vulnerability.
17730 pub cvss_v3: std::option::Option<crate::model::CVSSv3>,
17731
17732 /// Windows details get their own format because the information format and
17733 /// model don't match a normal detail. Specifically Windows updates are done as
17734 /// patches, thus Windows vulnerabilities really are a missing package, rather
17735 /// than a package being at an incorrect version.
17736 pub windows_details: std::vec::Vec<crate::model::vulnerability_note::WindowsDetail>,
17737
17738 /// The time this information was last changed at the source. This is an
17739 /// upstream timestamp from the underlying information source - e.g. Ubuntu
17740 /// security tracker.
17741 pub source_update_time: std::option::Option<wkt::Timestamp>,
17742
17743 /// CVSS version used to populate cvss_score and severity.
17744 pub cvss_version: crate::model::CVSSVersion,
17745
17746 /// The full description of the v2 CVSS for this vulnerability.
17747 pub cvss_v2: std::option::Option<crate::model::Cvss>,
17748
17749 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17750}
17751
17752impl VulnerabilityNote {
17753 pub fn new() -> Self {
17754 std::default::Default::default()
17755 }
17756
17757 /// Sets the value of [cvss_score][crate::model::VulnerabilityNote::cvss_score].
17758 ///
17759 /// # Example
17760 /// ```ignore,no_run
17761 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17762 /// let x = VulnerabilityNote::new().set_cvss_score(42.0);
17763 /// ```
17764 pub fn set_cvss_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17765 self.cvss_score = v.into();
17766 self
17767 }
17768
17769 /// Sets the value of [severity][crate::model::VulnerabilityNote::severity].
17770 ///
17771 /// # Example
17772 /// ```ignore,no_run
17773 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17774 /// use google_cloud_grafeas_v1::model::Severity;
17775 /// let x0 = VulnerabilityNote::new().set_severity(Severity::Minimal);
17776 /// let x1 = VulnerabilityNote::new().set_severity(Severity::Low);
17777 /// let x2 = VulnerabilityNote::new().set_severity(Severity::Medium);
17778 /// ```
17779 pub fn set_severity<T: std::convert::Into<crate::model::Severity>>(mut self, v: T) -> Self {
17780 self.severity = v.into();
17781 self
17782 }
17783
17784 /// Sets the value of [details][crate::model::VulnerabilityNote::details].
17785 ///
17786 /// # Example
17787 /// ```ignore,no_run
17788 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17789 /// use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
17790 /// let x = VulnerabilityNote::new()
17791 /// .set_details([
17792 /// Detail::default()/* use setters */,
17793 /// Detail::default()/* use (different) setters */,
17794 /// ]);
17795 /// ```
17796 pub fn set_details<T, V>(mut self, v: T) -> Self
17797 where
17798 T: std::iter::IntoIterator<Item = V>,
17799 V: std::convert::Into<crate::model::vulnerability_note::Detail>,
17800 {
17801 use std::iter::Iterator;
17802 self.details = v.into_iter().map(|i| i.into()).collect();
17803 self
17804 }
17805
17806 /// Sets the value of [cvss_v3][crate::model::VulnerabilityNote::cvss_v3].
17807 ///
17808 /// # Example
17809 /// ```ignore,no_run
17810 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17811 /// use google_cloud_grafeas_v1::model::CVSSv3;
17812 /// let x = VulnerabilityNote::new().set_cvss_v3(CVSSv3::default()/* use setters */);
17813 /// ```
17814 pub fn set_cvss_v3<T>(mut self, v: T) -> Self
17815 where
17816 T: std::convert::Into<crate::model::CVSSv3>,
17817 {
17818 self.cvss_v3 = std::option::Option::Some(v.into());
17819 self
17820 }
17821
17822 /// Sets or clears the value of [cvss_v3][crate::model::VulnerabilityNote::cvss_v3].
17823 ///
17824 /// # Example
17825 /// ```ignore,no_run
17826 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17827 /// use google_cloud_grafeas_v1::model::CVSSv3;
17828 /// let x = VulnerabilityNote::new().set_or_clear_cvss_v3(Some(CVSSv3::default()/* use setters */));
17829 /// let x = VulnerabilityNote::new().set_or_clear_cvss_v3(None::<CVSSv3>);
17830 /// ```
17831 pub fn set_or_clear_cvss_v3<T>(mut self, v: std::option::Option<T>) -> Self
17832 where
17833 T: std::convert::Into<crate::model::CVSSv3>,
17834 {
17835 self.cvss_v3 = v.map(|x| x.into());
17836 self
17837 }
17838
17839 /// Sets the value of [windows_details][crate::model::VulnerabilityNote::windows_details].
17840 ///
17841 /// # Example
17842 /// ```ignore,no_run
17843 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17844 /// use google_cloud_grafeas_v1::model::vulnerability_note::WindowsDetail;
17845 /// let x = VulnerabilityNote::new()
17846 /// .set_windows_details([
17847 /// WindowsDetail::default()/* use setters */,
17848 /// WindowsDetail::default()/* use (different) setters */,
17849 /// ]);
17850 /// ```
17851 pub fn set_windows_details<T, V>(mut self, v: T) -> Self
17852 where
17853 T: std::iter::IntoIterator<Item = V>,
17854 V: std::convert::Into<crate::model::vulnerability_note::WindowsDetail>,
17855 {
17856 use std::iter::Iterator;
17857 self.windows_details = v.into_iter().map(|i| i.into()).collect();
17858 self
17859 }
17860
17861 /// Sets the value of [source_update_time][crate::model::VulnerabilityNote::source_update_time].
17862 ///
17863 /// # Example
17864 /// ```ignore,no_run
17865 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17866 /// use wkt::Timestamp;
17867 /// let x = VulnerabilityNote::new().set_source_update_time(Timestamp::default()/* use setters */);
17868 /// ```
17869 pub fn set_source_update_time<T>(mut self, v: T) -> Self
17870 where
17871 T: std::convert::Into<wkt::Timestamp>,
17872 {
17873 self.source_update_time = std::option::Option::Some(v.into());
17874 self
17875 }
17876
17877 /// Sets or clears the value of [source_update_time][crate::model::VulnerabilityNote::source_update_time].
17878 ///
17879 /// # Example
17880 /// ```ignore,no_run
17881 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17882 /// use wkt::Timestamp;
17883 /// let x = VulnerabilityNote::new().set_or_clear_source_update_time(Some(Timestamp::default()/* use setters */));
17884 /// let x = VulnerabilityNote::new().set_or_clear_source_update_time(None::<Timestamp>);
17885 /// ```
17886 pub fn set_or_clear_source_update_time<T>(mut self, v: std::option::Option<T>) -> Self
17887 where
17888 T: std::convert::Into<wkt::Timestamp>,
17889 {
17890 self.source_update_time = v.map(|x| x.into());
17891 self
17892 }
17893
17894 /// Sets the value of [cvss_version][crate::model::VulnerabilityNote::cvss_version].
17895 ///
17896 /// # Example
17897 /// ```ignore,no_run
17898 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17899 /// use google_cloud_grafeas_v1::model::CVSSVersion;
17900 /// let x0 = VulnerabilityNote::new().set_cvss_version(CVSSVersion::CvssVersion2);
17901 /// let x1 = VulnerabilityNote::new().set_cvss_version(CVSSVersion::CvssVersion3);
17902 /// ```
17903 pub fn set_cvss_version<T: std::convert::Into<crate::model::CVSSVersion>>(
17904 mut self,
17905 v: T,
17906 ) -> Self {
17907 self.cvss_version = v.into();
17908 self
17909 }
17910
17911 /// Sets the value of [cvss_v2][crate::model::VulnerabilityNote::cvss_v2].
17912 ///
17913 /// # Example
17914 /// ```ignore,no_run
17915 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17916 /// use google_cloud_grafeas_v1::model::Cvss;
17917 /// let x = VulnerabilityNote::new().set_cvss_v2(Cvss::default()/* use setters */);
17918 /// ```
17919 pub fn set_cvss_v2<T>(mut self, v: T) -> Self
17920 where
17921 T: std::convert::Into<crate::model::Cvss>,
17922 {
17923 self.cvss_v2 = std::option::Option::Some(v.into());
17924 self
17925 }
17926
17927 /// Sets or clears the value of [cvss_v2][crate::model::VulnerabilityNote::cvss_v2].
17928 ///
17929 /// # Example
17930 /// ```ignore,no_run
17931 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17932 /// use google_cloud_grafeas_v1::model::Cvss;
17933 /// let x = VulnerabilityNote::new().set_or_clear_cvss_v2(Some(Cvss::default()/* use setters */));
17934 /// let x = VulnerabilityNote::new().set_or_clear_cvss_v2(None::<Cvss>);
17935 /// ```
17936 pub fn set_or_clear_cvss_v2<T>(mut self, v: std::option::Option<T>) -> Self
17937 where
17938 T: std::convert::Into<crate::model::Cvss>,
17939 {
17940 self.cvss_v2 = v.map(|x| x.into());
17941 self
17942 }
17943}
17944
17945impl wkt::message::Message for VulnerabilityNote {
17946 fn typename() -> &'static str {
17947 "type.googleapis.com/grafeas.v1.VulnerabilityNote"
17948 }
17949}
17950
17951/// Defines additional types related to [VulnerabilityNote].
17952pub mod vulnerability_note {
17953 #[allow(unused_imports)]
17954 use super::*;
17955
17956 /// A detail for a distro and package affected by this vulnerability and its
17957 /// associated fix (if one is available).
17958 #[derive(Clone, Default, PartialEq)]
17959 #[non_exhaustive]
17960 pub struct Detail {
17961 /// The distro assigned severity of this vulnerability.
17962 pub severity_name: std::string::String,
17963
17964 /// A vendor-specific description of this vulnerability.
17965 pub description: std::string::String,
17966
17967 /// The type of package; whether native or non native (e.g., ruby gems,
17968 /// node.js packages, etc.).
17969 pub package_type: std::string::String,
17970
17971 /// Required. The [CPE URI](https://cpe.mitre.org/specification/) this
17972 /// vulnerability affects.
17973 pub affected_cpe_uri: std::string::String,
17974
17975 /// Required. The package this vulnerability affects.
17976 pub affected_package: std::string::String,
17977
17978 /// The version number at the start of an interval in which this
17979 /// vulnerability exists. A vulnerability can affect a package between
17980 /// version numbers that are disjoint sets of intervals (example:
17981 /// [1.0.0-1.1.0], [2.4.6-2.4.8] and [4.5.6-4.6.8]) each of which will be
17982 /// represented in its own Detail. If a specific affected version is provided
17983 /// by a vulnerability database, affected_version_start and
17984 /// affected_version_end will be the same in that Detail.
17985 pub affected_version_start: std::option::Option<crate::model::Version>,
17986
17987 /// The version number at the end of an interval in which this vulnerability
17988 /// exists. A vulnerability can affect a package between version numbers
17989 /// that are disjoint sets of intervals (example: [1.0.0-1.1.0],
17990 /// [2.4.6-2.4.8] and [4.5.6-4.6.8]) each of which will be represented in its
17991 /// own Detail. If a specific affected version is provided by a vulnerability
17992 /// database, affected_version_start and affected_version_end will be the
17993 /// same in that Detail.
17994 pub affected_version_end: std::option::Option<crate::model::Version>,
17995
17996 /// The distro recommended [CPE URI](https://cpe.mitre.org/specification/)
17997 /// to update to that contains a fix for this vulnerability. It is possible
17998 /// for this to be different from the affected_cpe_uri.
17999 pub fixed_cpe_uri: std::string::String,
18000
18001 /// The distro recommended package to update to that contains a fix for this
18002 /// vulnerability. It is possible for this to be different from the
18003 /// affected_package.
18004 pub fixed_package: std::string::String,
18005
18006 /// The distro recommended version to update to that contains a
18007 /// fix for this vulnerability. Setting this to VersionKind.MAXIMUM means no
18008 /// such version is yet available.
18009 pub fixed_version: std::option::Option<crate::model::Version>,
18010
18011 /// Whether this detail is obsolete. Occurrences are expected not to point to
18012 /// obsolete details.
18013 pub is_obsolete: bool,
18014
18015 /// The time this information was last changed at the source. This is an
18016 /// upstream timestamp from the underlying information source - e.g. Ubuntu
18017 /// security tracker.
18018 pub source_update_time: std::option::Option<wkt::Timestamp>,
18019
18020 /// The source from which the information in this Detail was obtained.
18021 pub source: std::string::String,
18022
18023 /// The name of the vendor of the product.
18024 pub vendor: std::string::String,
18025
18026 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18027 }
18028
18029 impl Detail {
18030 pub fn new() -> Self {
18031 std::default::Default::default()
18032 }
18033
18034 /// Sets the value of [severity_name][crate::model::vulnerability_note::Detail::severity_name].
18035 ///
18036 /// # Example
18037 /// ```ignore,no_run
18038 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18039 /// let x = Detail::new().set_severity_name("example");
18040 /// ```
18041 pub fn set_severity_name<T: std::convert::Into<std::string::String>>(
18042 mut self,
18043 v: T,
18044 ) -> Self {
18045 self.severity_name = v.into();
18046 self
18047 }
18048
18049 /// Sets the value of [description][crate::model::vulnerability_note::Detail::description].
18050 ///
18051 /// # Example
18052 /// ```ignore,no_run
18053 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18054 /// let x = Detail::new().set_description("example");
18055 /// ```
18056 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18057 self.description = v.into();
18058 self
18059 }
18060
18061 /// Sets the value of [package_type][crate::model::vulnerability_note::Detail::package_type].
18062 ///
18063 /// # Example
18064 /// ```ignore,no_run
18065 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18066 /// let x = Detail::new().set_package_type("example");
18067 /// ```
18068 pub fn set_package_type<T: std::convert::Into<std::string::String>>(
18069 mut self,
18070 v: T,
18071 ) -> Self {
18072 self.package_type = v.into();
18073 self
18074 }
18075
18076 /// Sets the value of [affected_cpe_uri][crate::model::vulnerability_note::Detail::affected_cpe_uri].
18077 ///
18078 /// # Example
18079 /// ```ignore,no_run
18080 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18081 /// let x = Detail::new().set_affected_cpe_uri("example");
18082 /// ```
18083 pub fn set_affected_cpe_uri<T: std::convert::Into<std::string::String>>(
18084 mut self,
18085 v: T,
18086 ) -> Self {
18087 self.affected_cpe_uri = v.into();
18088 self
18089 }
18090
18091 /// Sets the value of [affected_package][crate::model::vulnerability_note::Detail::affected_package].
18092 ///
18093 /// # Example
18094 /// ```ignore,no_run
18095 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18096 /// let x = Detail::new().set_affected_package("example");
18097 /// ```
18098 pub fn set_affected_package<T: std::convert::Into<std::string::String>>(
18099 mut self,
18100 v: T,
18101 ) -> Self {
18102 self.affected_package = v.into();
18103 self
18104 }
18105
18106 /// Sets the value of [affected_version_start][crate::model::vulnerability_note::Detail::affected_version_start].
18107 ///
18108 /// # Example
18109 /// ```ignore,no_run
18110 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18111 /// use google_cloud_grafeas_v1::model::Version;
18112 /// let x = Detail::new().set_affected_version_start(Version::default()/* use setters */);
18113 /// ```
18114 pub fn set_affected_version_start<T>(mut self, v: T) -> Self
18115 where
18116 T: std::convert::Into<crate::model::Version>,
18117 {
18118 self.affected_version_start = std::option::Option::Some(v.into());
18119 self
18120 }
18121
18122 /// Sets or clears the value of [affected_version_start][crate::model::vulnerability_note::Detail::affected_version_start].
18123 ///
18124 /// # Example
18125 /// ```ignore,no_run
18126 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18127 /// use google_cloud_grafeas_v1::model::Version;
18128 /// let x = Detail::new().set_or_clear_affected_version_start(Some(Version::default()/* use setters */));
18129 /// let x = Detail::new().set_or_clear_affected_version_start(None::<Version>);
18130 /// ```
18131 pub fn set_or_clear_affected_version_start<T>(mut self, v: std::option::Option<T>) -> Self
18132 where
18133 T: std::convert::Into<crate::model::Version>,
18134 {
18135 self.affected_version_start = v.map(|x| x.into());
18136 self
18137 }
18138
18139 /// Sets the value of [affected_version_end][crate::model::vulnerability_note::Detail::affected_version_end].
18140 ///
18141 /// # Example
18142 /// ```ignore,no_run
18143 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18144 /// use google_cloud_grafeas_v1::model::Version;
18145 /// let x = Detail::new().set_affected_version_end(Version::default()/* use setters */);
18146 /// ```
18147 pub fn set_affected_version_end<T>(mut self, v: T) -> Self
18148 where
18149 T: std::convert::Into<crate::model::Version>,
18150 {
18151 self.affected_version_end = std::option::Option::Some(v.into());
18152 self
18153 }
18154
18155 /// Sets or clears the value of [affected_version_end][crate::model::vulnerability_note::Detail::affected_version_end].
18156 ///
18157 /// # Example
18158 /// ```ignore,no_run
18159 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18160 /// use google_cloud_grafeas_v1::model::Version;
18161 /// let x = Detail::new().set_or_clear_affected_version_end(Some(Version::default()/* use setters */));
18162 /// let x = Detail::new().set_or_clear_affected_version_end(None::<Version>);
18163 /// ```
18164 pub fn set_or_clear_affected_version_end<T>(mut self, v: std::option::Option<T>) -> Self
18165 where
18166 T: std::convert::Into<crate::model::Version>,
18167 {
18168 self.affected_version_end = v.map(|x| x.into());
18169 self
18170 }
18171
18172 /// Sets the value of [fixed_cpe_uri][crate::model::vulnerability_note::Detail::fixed_cpe_uri].
18173 ///
18174 /// # Example
18175 /// ```ignore,no_run
18176 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18177 /// let x = Detail::new().set_fixed_cpe_uri("example");
18178 /// ```
18179 pub fn set_fixed_cpe_uri<T: std::convert::Into<std::string::String>>(
18180 mut self,
18181 v: T,
18182 ) -> Self {
18183 self.fixed_cpe_uri = v.into();
18184 self
18185 }
18186
18187 /// Sets the value of [fixed_package][crate::model::vulnerability_note::Detail::fixed_package].
18188 ///
18189 /// # Example
18190 /// ```ignore,no_run
18191 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18192 /// let x = Detail::new().set_fixed_package("example");
18193 /// ```
18194 pub fn set_fixed_package<T: std::convert::Into<std::string::String>>(
18195 mut self,
18196 v: T,
18197 ) -> Self {
18198 self.fixed_package = v.into();
18199 self
18200 }
18201
18202 /// Sets the value of [fixed_version][crate::model::vulnerability_note::Detail::fixed_version].
18203 ///
18204 /// # Example
18205 /// ```ignore,no_run
18206 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18207 /// use google_cloud_grafeas_v1::model::Version;
18208 /// let x = Detail::new().set_fixed_version(Version::default()/* use setters */);
18209 /// ```
18210 pub fn set_fixed_version<T>(mut self, v: T) -> Self
18211 where
18212 T: std::convert::Into<crate::model::Version>,
18213 {
18214 self.fixed_version = std::option::Option::Some(v.into());
18215 self
18216 }
18217
18218 /// Sets or clears the value of [fixed_version][crate::model::vulnerability_note::Detail::fixed_version].
18219 ///
18220 /// # Example
18221 /// ```ignore,no_run
18222 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18223 /// use google_cloud_grafeas_v1::model::Version;
18224 /// let x = Detail::new().set_or_clear_fixed_version(Some(Version::default()/* use setters */));
18225 /// let x = Detail::new().set_or_clear_fixed_version(None::<Version>);
18226 /// ```
18227 pub fn set_or_clear_fixed_version<T>(mut self, v: std::option::Option<T>) -> Self
18228 where
18229 T: std::convert::Into<crate::model::Version>,
18230 {
18231 self.fixed_version = v.map(|x| x.into());
18232 self
18233 }
18234
18235 /// Sets the value of [is_obsolete][crate::model::vulnerability_note::Detail::is_obsolete].
18236 ///
18237 /// # Example
18238 /// ```ignore,no_run
18239 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18240 /// let x = Detail::new().set_is_obsolete(true);
18241 /// ```
18242 pub fn set_is_obsolete<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18243 self.is_obsolete = v.into();
18244 self
18245 }
18246
18247 /// Sets the value of [source_update_time][crate::model::vulnerability_note::Detail::source_update_time].
18248 ///
18249 /// # Example
18250 /// ```ignore,no_run
18251 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18252 /// use wkt::Timestamp;
18253 /// let x = Detail::new().set_source_update_time(Timestamp::default()/* use setters */);
18254 /// ```
18255 pub fn set_source_update_time<T>(mut self, v: T) -> Self
18256 where
18257 T: std::convert::Into<wkt::Timestamp>,
18258 {
18259 self.source_update_time = std::option::Option::Some(v.into());
18260 self
18261 }
18262
18263 /// Sets or clears the value of [source_update_time][crate::model::vulnerability_note::Detail::source_update_time].
18264 ///
18265 /// # Example
18266 /// ```ignore,no_run
18267 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18268 /// use wkt::Timestamp;
18269 /// let x = Detail::new().set_or_clear_source_update_time(Some(Timestamp::default()/* use setters */));
18270 /// let x = Detail::new().set_or_clear_source_update_time(None::<Timestamp>);
18271 /// ```
18272 pub fn set_or_clear_source_update_time<T>(mut self, v: std::option::Option<T>) -> Self
18273 where
18274 T: std::convert::Into<wkt::Timestamp>,
18275 {
18276 self.source_update_time = v.map(|x| x.into());
18277 self
18278 }
18279
18280 /// Sets the value of [source][crate::model::vulnerability_note::Detail::source].
18281 ///
18282 /// # Example
18283 /// ```ignore,no_run
18284 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18285 /// let x = Detail::new().set_source("example");
18286 /// ```
18287 pub fn set_source<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18288 self.source = v.into();
18289 self
18290 }
18291
18292 /// Sets the value of [vendor][crate::model::vulnerability_note::Detail::vendor].
18293 ///
18294 /// # Example
18295 /// ```ignore,no_run
18296 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18297 /// let x = Detail::new().set_vendor("example");
18298 /// ```
18299 pub fn set_vendor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18300 self.vendor = v.into();
18301 self
18302 }
18303 }
18304
18305 impl wkt::message::Message for Detail {
18306 fn typename() -> &'static str {
18307 "type.googleapis.com/grafeas.v1.VulnerabilityNote.Detail"
18308 }
18309 }
18310
18311 #[derive(Clone, Default, PartialEq)]
18312 #[non_exhaustive]
18313 pub struct WindowsDetail {
18314 /// Required. The [CPE URI](https://cpe.mitre.org/specification/) this
18315 /// vulnerability affects.
18316 pub cpe_uri: std::string::String,
18317
18318 /// Required. The name of this vulnerability.
18319 pub name: std::string::String,
18320
18321 /// The description of this vulnerability.
18322 pub description: std::string::String,
18323
18324 /// Required. The names of the KBs which have hotfixes to mitigate this
18325 /// vulnerability. Note that there may be multiple hotfixes (and thus
18326 /// multiple KBs) that mitigate a given vulnerability. Currently any listed
18327 /// KBs presence is considered a fix.
18328 pub fixing_kbs:
18329 std::vec::Vec<crate::model::vulnerability_note::windows_detail::KnowledgeBase>,
18330
18331 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18332 }
18333
18334 impl WindowsDetail {
18335 pub fn new() -> Self {
18336 std::default::Default::default()
18337 }
18338
18339 /// Sets the value of [cpe_uri][crate::model::vulnerability_note::WindowsDetail::cpe_uri].
18340 ///
18341 /// # Example
18342 /// ```ignore,no_run
18343 /// # use google_cloud_grafeas_v1::model::vulnerability_note::WindowsDetail;
18344 /// let x = WindowsDetail::new().set_cpe_uri("example");
18345 /// ```
18346 pub fn set_cpe_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18347 self.cpe_uri = v.into();
18348 self
18349 }
18350
18351 /// Sets the value of [name][crate::model::vulnerability_note::WindowsDetail::name].
18352 ///
18353 /// # Example
18354 /// ```ignore,no_run
18355 /// # use google_cloud_grafeas_v1::model::vulnerability_note::WindowsDetail;
18356 /// let x = WindowsDetail::new().set_name("example");
18357 /// ```
18358 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18359 self.name = v.into();
18360 self
18361 }
18362
18363 /// Sets the value of [description][crate::model::vulnerability_note::WindowsDetail::description].
18364 ///
18365 /// # Example
18366 /// ```ignore,no_run
18367 /// # use google_cloud_grafeas_v1::model::vulnerability_note::WindowsDetail;
18368 /// let x = WindowsDetail::new().set_description("example");
18369 /// ```
18370 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18371 self.description = v.into();
18372 self
18373 }
18374
18375 /// Sets the value of [fixing_kbs][crate::model::vulnerability_note::WindowsDetail::fixing_kbs].
18376 ///
18377 /// # Example
18378 /// ```ignore,no_run
18379 /// # use google_cloud_grafeas_v1::model::vulnerability_note::WindowsDetail;
18380 /// use google_cloud_grafeas_v1::model::vulnerability_note::windows_detail::KnowledgeBase;
18381 /// let x = WindowsDetail::new()
18382 /// .set_fixing_kbs([
18383 /// KnowledgeBase::default()/* use setters */,
18384 /// KnowledgeBase::default()/* use (different) setters */,
18385 /// ]);
18386 /// ```
18387 pub fn set_fixing_kbs<T, V>(mut self, v: T) -> Self
18388 where
18389 T: std::iter::IntoIterator<Item = V>,
18390 V: std::convert::Into<crate::model::vulnerability_note::windows_detail::KnowledgeBase>,
18391 {
18392 use std::iter::Iterator;
18393 self.fixing_kbs = v.into_iter().map(|i| i.into()).collect();
18394 self
18395 }
18396 }
18397
18398 impl wkt::message::Message for WindowsDetail {
18399 fn typename() -> &'static str {
18400 "type.googleapis.com/grafeas.v1.VulnerabilityNote.WindowsDetail"
18401 }
18402 }
18403
18404 /// Defines additional types related to [WindowsDetail].
18405 pub mod windows_detail {
18406 #[allow(unused_imports)]
18407 use super::*;
18408
18409 #[derive(Clone, Default, PartialEq)]
18410 #[non_exhaustive]
18411 pub struct KnowledgeBase {
18412 /// The KB name (generally of the form KB[0-9]+ (e.g., KB123456)).
18413 pub name: std::string::String,
18414
18415 /// A link to the KB in the [Windows update catalog]
18416 /// (<https://www.catalog.update.microsoft.com/>).
18417 pub url: std::string::String,
18418
18419 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18420 }
18421
18422 impl KnowledgeBase {
18423 pub fn new() -> Self {
18424 std::default::Default::default()
18425 }
18426
18427 /// Sets the value of [name][crate::model::vulnerability_note::windows_detail::KnowledgeBase::name].
18428 ///
18429 /// # Example
18430 /// ```ignore,no_run
18431 /// # use google_cloud_grafeas_v1::model::vulnerability_note::windows_detail::KnowledgeBase;
18432 /// let x = KnowledgeBase::new().set_name("example");
18433 /// ```
18434 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18435 self.name = v.into();
18436 self
18437 }
18438
18439 /// Sets the value of [url][crate::model::vulnerability_note::windows_detail::KnowledgeBase::url].
18440 ///
18441 /// # Example
18442 /// ```ignore,no_run
18443 /// # use google_cloud_grafeas_v1::model::vulnerability_note::windows_detail::KnowledgeBase;
18444 /// let x = KnowledgeBase::new().set_url("example");
18445 /// ```
18446 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18447 self.url = v.into();
18448 self
18449 }
18450 }
18451
18452 impl wkt::message::Message for KnowledgeBase {
18453 fn typename() -> &'static str {
18454 "type.googleapis.com/grafeas.v1.VulnerabilityNote.WindowsDetail.KnowledgeBase"
18455 }
18456 }
18457 }
18458}
18459
18460/// An occurrence of a severity vulnerability on a resource.
18461#[derive(Clone, Default, PartialEq)]
18462#[non_exhaustive]
18463pub struct VulnerabilityOccurrence {
18464 /// The type of package; whether native or non native (e.g., ruby gems, node.js
18465 /// packages, etc.).
18466 pub r#type: std::string::String,
18467
18468 /// Output only. The note provider assigned severity of this vulnerability.
18469 pub severity: crate::model::Severity,
18470
18471 /// Output only. The CVSS score of this vulnerability. CVSS score is on a
18472 /// scale of 0 - 10 where 0 indicates low severity and 10 indicates high
18473 /// severity.
18474 pub cvss_score: f32,
18475
18476 /// The cvss v3 score for the vulnerability.
18477 pub cvssv3: std::option::Option<crate::model::Cvss>,
18478
18479 /// Required. The set of affected locations and their fixes (if available)
18480 /// within the associated resource.
18481 pub package_issue: std::vec::Vec<crate::model::vulnerability_occurrence::PackageIssue>,
18482
18483 /// Output only. A one sentence description of this vulnerability.
18484 pub short_description: std::string::String,
18485
18486 /// Output only. A detailed description of this vulnerability.
18487 pub long_description: std::string::String,
18488
18489 /// Output only. URLs related to this vulnerability.
18490 pub related_urls: std::vec::Vec<crate::model::RelatedUrl>,
18491
18492 /// The distro assigned severity for this vulnerability when it is available,
18493 /// otherwise this is the note provider assigned severity.
18494 ///
18495 /// When there are multiple PackageIssues for this vulnerability, they can have
18496 /// different effective severities because some might be provided by the distro
18497 /// while others are provided by the language ecosystem for a language pack.
18498 /// For this reason, it is advised to use the effective severity on the
18499 /// PackageIssue level. In the case where multiple PackageIssues have differing
18500 /// effective severities, this field should be the highest severity for any of
18501 /// the PackageIssues.
18502 pub effective_severity: crate::model::Severity,
18503
18504 /// Output only. Whether at least one of the affected packages has a fix
18505 /// available.
18506 pub fix_available: bool,
18507
18508 /// Output only. CVSS version used to populate cvss_score and severity.
18509 pub cvss_version: crate::model::CVSSVersion,
18510
18511 /// The cvss v2 score for the vulnerability.
18512 pub cvss_v2: std::option::Option<crate::model::Cvss>,
18513
18514 pub vex_assessment: std::option::Option<crate::model::vulnerability_occurrence::VexAssessment>,
18515
18516 /// Occurrence-specific extra details about the vulnerability.
18517 pub extra_details: std::string::String,
18518
18519 /// Risk information about the vulnerability, such as CISA, EPSS, etc.
18520 pub risk: std::option::Option<crate::model::Risk>,
18521
18522 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18523}
18524
18525impl VulnerabilityOccurrence {
18526 pub fn new() -> Self {
18527 std::default::Default::default()
18528 }
18529
18530 /// Sets the value of [r#type][crate::model::VulnerabilityOccurrence::type].
18531 ///
18532 /// # Example
18533 /// ```ignore,no_run
18534 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18535 /// let x = VulnerabilityOccurrence::new().set_type("example");
18536 /// ```
18537 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18538 self.r#type = v.into();
18539 self
18540 }
18541
18542 /// Sets the value of [severity][crate::model::VulnerabilityOccurrence::severity].
18543 ///
18544 /// # Example
18545 /// ```ignore,no_run
18546 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18547 /// use google_cloud_grafeas_v1::model::Severity;
18548 /// let x0 = VulnerabilityOccurrence::new().set_severity(Severity::Minimal);
18549 /// let x1 = VulnerabilityOccurrence::new().set_severity(Severity::Low);
18550 /// let x2 = VulnerabilityOccurrence::new().set_severity(Severity::Medium);
18551 /// ```
18552 pub fn set_severity<T: std::convert::Into<crate::model::Severity>>(mut self, v: T) -> Self {
18553 self.severity = v.into();
18554 self
18555 }
18556
18557 /// Sets the value of [cvss_score][crate::model::VulnerabilityOccurrence::cvss_score].
18558 ///
18559 /// # Example
18560 /// ```ignore,no_run
18561 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18562 /// let x = VulnerabilityOccurrence::new().set_cvss_score(42.0);
18563 /// ```
18564 pub fn set_cvss_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
18565 self.cvss_score = v.into();
18566 self
18567 }
18568
18569 /// Sets the value of [cvssv3][crate::model::VulnerabilityOccurrence::cvssv3].
18570 ///
18571 /// # Example
18572 /// ```ignore,no_run
18573 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18574 /// use google_cloud_grafeas_v1::model::Cvss;
18575 /// let x = VulnerabilityOccurrence::new().set_cvssv3(Cvss::default()/* use setters */);
18576 /// ```
18577 pub fn set_cvssv3<T>(mut self, v: T) -> Self
18578 where
18579 T: std::convert::Into<crate::model::Cvss>,
18580 {
18581 self.cvssv3 = std::option::Option::Some(v.into());
18582 self
18583 }
18584
18585 /// Sets or clears the value of [cvssv3][crate::model::VulnerabilityOccurrence::cvssv3].
18586 ///
18587 /// # Example
18588 /// ```ignore,no_run
18589 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18590 /// use google_cloud_grafeas_v1::model::Cvss;
18591 /// let x = VulnerabilityOccurrence::new().set_or_clear_cvssv3(Some(Cvss::default()/* use setters */));
18592 /// let x = VulnerabilityOccurrence::new().set_or_clear_cvssv3(None::<Cvss>);
18593 /// ```
18594 pub fn set_or_clear_cvssv3<T>(mut self, v: std::option::Option<T>) -> Self
18595 where
18596 T: std::convert::Into<crate::model::Cvss>,
18597 {
18598 self.cvssv3 = v.map(|x| x.into());
18599 self
18600 }
18601
18602 /// Sets the value of [package_issue][crate::model::VulnerabilityOccurrence::package_issue].
18603 ///
18604 /// # Example
18605 /// ```ignore,no_run
18606 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18607 /// use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
18608 /// let x = VulnerabilityOccurrence::new()
18609 /// .set_package_issue([
18610 /// PackageIssue::default()/* use setters */,
18611 /// PackageIssue::default()/* use (different) setters */,
18612 /// ]);
18613 /// ```
18614 pub fn set_package_issue<T, V>(mut self, v: T) -> Self
18615 where
18616 T: std::iter::IntoIterator<Item = V>,
18617 V: std::convert::Into<crate::model::vulnerability_occurrence::PackageIssue>,
18618 {
18619 use std::iter::Iterator;
18620 self.package_issue = v.into_iter().map(|i| i.into()).collect();
18621 self
18622 }
18623
18624 /// Sets the value of [short_description][crate::model::VulnerabilityOccurrence::short_description].
18625 ///
18626 /// # Example
18627 /// ```ignore,no_run
18628 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18629 /// let x = VulnerabilityOccurrence::new().set_short_description("example");
18630 /// ```
18631 pub fn set_short_description<T: std::convert::Into<std::string::String>>(
18632 mut self,
18633 v: T,
18634 ) -> Self {
18635 self.short_description = v.into();
18636 self
18637 }
18638
18639 /// Sets the value of [long_description][crate::model::VulnerabilityOccurrence::long_description].
18640 ///
18641 /// # Example
18642 /// ```ignore,no_run
18643 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18644 /// let x = VulnerabilityOccurrence::new().set_long_description("example");
18645 /// ```
18646 pub fn set_long_description<T: std::convert::Into<std::string::String>>(
18647 mut self,
18648 v: T,
18649 ) -> Self {
18650 self.long_description = v.into();
18651 self
18652 }
18653
18654 /// Sets the value of [related_urls][crate::model::VulnerabilityOccurrence::related_urls].
18655 ///
18656 /// # Example
18657 /// ```ignore,no_run
18658 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18659 /// use google_cloud_grafeas_v1::model::RelatedUrl;
18660 /// let x = VulnerabilityOccurrence::new()
18661 /// .set_related_urls([
18662 /// RelatedUrl::default()/* use setters */,
18663 /// RelatedUrl::default()/* use (different) setters */,
18664 /// ]);
18665 /// ```
18666 pub fn set_related_urls<T, V>(mut self, v: T) -> Self
18667 where
18668 T: std::iter::IntoIterator<Item = V>,
18669 V: std::convert::Into<crate::model::RelatedUrl>,
18670 {
18671 use std::iter::Iterator;
18672 self.related_urls = v.into_iter().map(|i| i.into()).collect();
18673 self
18674 }
18675
18676 /// Sets the value of [effective_severity][crate::model::VulnerabilityOccurrence::effective_severity].
18677 ///
18678 /// # Example
18679 /// ```ignore,no_run
18680 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18681 /// use google_cloud_grafeas_v1::model::Severity;
18682 /// let x0 = VulnerabilityOccurrence::new().set_effective_severity(Severity::Minimal);
18683 /// let x1 = VulnerabilityOccurrence::new().set_effective_severity(Severity::Low);
18684 /// let x2 = VulnerabilityOccurrence::new().set_effective_severity(Severity::Medium);
18685 /// ```
18686 pub fn set_effective_severity<T: std::convert::Into<crate::model::Severity>>(
18687 mut self,
18688 v: T,
18689 ) -> Self {
18690 self.effective_severity = v.into();
18691 self
18692 }
18693
18694 /// Sets the value of [fix_available][crate::model::VulnerabilityOccurrence::fix_available].
18695 ///
18696 /// # Example
18697 /// ```ignore,no_run
18698 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18699 /// let x = VulnerabilityOccurrence::new().set_fix_available(true);
18700 /// ```
18701 pub fn set_fix_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18702 self.fix_available = v.into();
18703 self
18704 }
18705
18706 /// Sets the value of [cvss_version][crate::model::VulnerabilityOccurrence::cvss_version].
18707 ///
18708 /// # Example
18709 /// ```ignore,no_run
18710 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18711 /// use google_cloud_grafeas_v1::model::CVSSVersion;
18712 /// let x0 = VulnerabilityOccurrence::new().set_cvss_version(CVSSVersion::CvssVersion2);
18713 /// let x1 = VulnerabilityOccurrence::new().set_cvss_version(CVSSVersion::CvssVersion3);
18714 /// ```
18715 pub fn set_cvss_version<T: std::convert::Into<crate::model::CVSSVersion>>(
18716 mut self,
18717 v: T,
18718 ) -> Self {
18719 self.cvss_version = v.into();
18720 self
18721 }
18722
18723 /// Sets the value of [cvss_v2][crate::model::VulnerabilityOccurrence::cvss_v2].
18724 ///
18725 /// # Example
18726 /// ```ignore,no_run
18727 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18728 /// use google_cloud_grafeas_v1::model::Cvss;
18729 /// let x = VulnerabilityOccurrence::new().set_cvss_v2(Cvss::default()/* use setters */);
18730 /// ```
18731 pub fn set_cvss_v2<T>(mut self, v: T) -> Self
18732 where
18733 T: std::convert::Into<crate::model::Cvss>,
18734 {
18735 self.cvss_v2 = std::option::Option::Some(v.into());
18736 self
18737 }
18738
18739 /// Sets or clears the value of [cvss_v2][crate::model::VulnerabilityOccurrence::cvss_v2].
18740 ///
18741 /// # Example
18742 /// ```ignore,no_run
18743 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18744 /// use google_cloud_grafeas_v1::model::Cvss;
18745 /// let x = VulnerabilityOccurrence::new().set_or_clear_cvss_v2(Some(Cvss::default()/* use setters */));
18746 /// let x = VulnerabilityOccurrence::new().set_or_clear_cvss_v2(None::<Cvss>);
18747 /// ```
18748 pub fn set_or_clear_cvss_v2<T>(mut self, v: std::option::Option<T>) -> Self
18749 where
18750 T: std::convert::Into<crate::model::Cvss>,
18751 {
18752 self.cvss_v2 = v.map(|x| x.into());
18753 self
18754 }
18755
18756 /// Sets the value of [vex_assessment][crate::model::VulnerabilityOccurrence::vex_assessment].
18757 ///
18758 /// # Example
18759 /// ```ignore,no_run
18760 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18761 /// use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
18762 /// let x = VulnerabilityOccurrence::new().set_vex_assessment(VexAssessment::default()/* use setters */);
18763 /// ```
18764 pub fn set_vex_assessment<T>(mut self, v: T) -> Self
18765 where
18766 T: std::convert::Into<crate::model::vulnerability_occurrence::VexAssessment>,
18767 {
18768 self.vex_assessment = std::option::Option::Some(v.into());
18769 self
18770 }
18771
18772 /// Sets or clears the value of [vex_assessment][crate::model::VulnerabilityOccurrence::vex_assessment].
18773 ///
18774 /// # Example
18775 /// ```ignore,no_run
18776 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18777 /// use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
18778 /// let x = VulnerabilityOccurrence::new().set_or_clear_vex_assessment(Some(VexAssessment::default()/* use setters */));
18779 /// let x = VulnerabilityOccurrence::new().set_or_clear_vex_assessment(None::<VexAssessment>);
18780 /// ```
18781 pub fn set_or_clear_vex_assessment<T>(mut self, v: std::option::Option<T>) -> Self
18782 where
18783 T: std::convert::Into<crate::model::vulnerability_occurrence::VexAssessment>,
18784 {
18785 self.vex_assessment = v.map(|x| x.into());
18786 self
18787 }
18788
18789 /// Sets the value of [extra_details][crate::model::VulnerabilityOccurrence::extra_details].
18790 ///
18791 /// # Example
18792 /// ```ignore,no_run
18793 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18794 /// let x = VulnerabilityOccurrence::new().set_extra_details("example");
18795 /// ```
18796 pub fn set_extra_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18797 self.extra_details = v.into();
18798 self
18799 }
18800
18801 /// Sets the value of [risk][crate::model::VulnerabilityOccurrence::risk].
18802 ///
18803 /// # Example
18804 /// ```ignore,no_run
18805 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18806 /// use google_cloud_grafeas_v1::model::Risk;
18807 /// let x = VulnerabilityOccurrence::new().set_risk(Risk::default()/* use setters */);
18808 /// ```
18809 pub fn set_risk<T>(mut self, v: T) -> Self
18810 where
18811 T: std::convert::Into<crate::model::Risk>,
18812 {
18813 self.risk = std::option::Option::Some(v.into());
18814 self
18815 }
18816
18817 /// Sets or clears the value of [risk][crate::model::VulnerabilityOccurrence::risk].
18818 ///
18819 /// # Example
18820 /// ```ignore,no_run
18821 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18822 /// use google_cloud_grafeas_v1::model::Risk;
18823 /// let x = VulnerabilityOccurrence::new().set_or_clear_risk(Some(Risk::default()/* use setters */));
18824 /// let x = VulnerabilityOccurrence::new().set_or_clear_risk(None::<Risk>);
18825 /// ```
18826 pub fn set_or_clear_risk<T>(mut self, v: std::option::Option<T>) -> Self
18827 where
18828 T: std::convert::Into<crate::model::Risk>,
18829 {
18830 self.risk = v.map(|x| x.into());
18831 self
18832 }
18833}
18834
18835impl wkt::message::Message for VulnerabilityOccurrence {
18836 fn typename() -> &'static str {
18837 "type.googleapis.com/grafeas.v1.VulnerabilityOccurrence"
18838 }
18839}
18840
18841/// Defines additional types related to [VulnerabilityOccurrence].
18842pub mod vulnerability_occurrence {
18843 #[allow(unused_imports)]
18844 use super::*;
18845
18846 /// A detail for a distro and package this vulnerability occurrence was found
18847 /// in and its associated fix (if one is available).
18848 #[derive(Clone, Default, PartialEq)]
18849 #[non_exhaustive]
18850 pub struct PackageIssue {
18851 /// Required. The [CPE URI](https://cpe.mitre.org/specification/) this
18852 /// vulnerability was found in.
18853 pub affected_cpe_uri: std::string::String,
18854
18855 /// Required. The package this vulnerability was found in.
18856 pub affected_package: std::string::String,
18857
18858 /// Required. The version of the package that is installed on the resource
18859 /// affected by this vulnerability.
18860 pub affected_version: std::option::Option<crate::model::Version>,
18861
18862 /// The [CPE URI](https://cpe.mitre.org/specification/) this vulnerability
18863 /// was fixed in. It is possible for this to be different from the
18864 /// affected_cpe_uri.
18865 pub fixed_cpe_uri: std::string::String,
18866
18867 /// The package this vulnerability was fixed in. It is possible for this to
18868 /// be different from the affected_package.
18869 pub fixed_package: std::string::String,
18870
18871 /// Required. The version of the package this vulnerability was fixed in.
18872 /// Setting this to VersionKind.MAXIMUM means no fix is yet available.
18873 pub fixed_version: std::option::Option<crate::model::Version>,
18874
18875 /// Output only. Whether a fix is available for this package.
18876 pub fix_available: bool,
18877
18878 /// The type of package (e.g. OS, MAVEN, GO).
18879 pub package_type: std::string::String,
18880
18881 /// The distro or language system assigned severity for this vulnerability
18882 /// when that is available and note provider assigned severity when it is not
18883 /// available.
18884 pub effective_severity: crate::model::Severity,
18885
18886 /// The location at which this package was found.
18887 pub file_location: std::vec::Vec<crate::model::FileLocation>,
18888
18889 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18890 }
18891
18892 impl PackageIssue {
18893 pub fn new() -> Self {
18894 std::default::Default::default()
18895 }
18896
18897 /// Sets the value of [affected_cpe_uri][crate::model::vulnerability_occurrence::PackageIssue::affected_cpe_uri].
18898 ///
18899 /// # Example
18900 /// ```ignore,no_run
18901 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
18902 /// let x = PackageIssue::new().set_affected_cpe_uri("example");
18903 /// ```
18904 pub fn set_affected_cpe_uri<T: std::convert::Into<std::string::String>>(
18905 mut self,
18906 v: T,
18907 ) -> Self {
18908 self.affected_cpe_uri = v.into();
18909 self
18910 }
18911
18912 /// Sets the value of [affected_package][crate::model::vulnerability_occurrence::PackageIssue::affected_package].
18913 ///
18914 /// # Example
18915 /// ```ignore,no_run
18916 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
18917 /// let x = PackageIssue::new().set_affected_package("example");
18918 /// ```
18919 pub fn set_affected_package<T: std::convert::Into<std::string::String>>(
18920 mut self,
18921 v: T,
18922 ) -> Self {
18923 self.affected_package = v.into();
18924 self
18925 }
18926
18927 /// Sets the value of [affected_version][crate::model::vulnerability_occurrence::PackageIssue::affected_version].
18928 ///
18929 /// # Example
18930 /// ```ignore,no_run
18931 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
18932 /// use google_cloud_grafeas_v1::model::Version;
18933 /// let x = PackageIssue::new().set_affected_version(Version::default()/* use setters */);
18934 /// ```
18935 pub fn set_affected_version<T>(mut self, v: T) -> Self
18936 where
18937 T: std::convert::Into<crate::model::Version>,
18938 {
18939 self.affected_version = std::option::Option::Some(v.into());
18940 self
18941 }
18942
18943 /// Sets or clears the value of [affected_version][crate::model::vulnerability_occurrence::PackageIssue::affected_version].
18944 ///
18945 /// # Example
18946 /// ```ignore,no_run
18947 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
18948 /// use google_cloud_grafeas_v1::model::Version;
18949 /// let x = PackageIssue::new().set_or_clear_affected_version(Some(Version::default()/* use setters */));
18950 /// let x = PackageIssue::new().set_or_clear_affected_version(None::<Version>);
18951 /// ```
18952 pub fn set_or_clear_affected_version<T>(mut self, v: std::option::Option<T>) -> Self
18953 where
18954 T: std::convert::Into<crate::model::Version>,
18955 {
18956 self.affected_version = v.map(|x| x.into());
18957 self
18958 }
18959
18960 /// Sets the value of [fixed_cpe_uri][crate::model::vulnerability_occurrence::PackageIssue::fixed_cpe_uri].
18961 ///
18962 /// # Example
18963 /// ```ignore,no_run
18964 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
18965 /// let x = PackageIssue::new().set_fixed_cpe_uri("example");
18966 /// ```
18967 pub fn set_fixed_cpe_uri<T: std::convert::Into<std::string::String>>(
18968 mut self,
18969 v: T,
18970 ) -> Self {
18971 self.fixed_cpe_uri = v.into();
18972 self
18973 }
18974
18975 /// Sets the value of [fixed_package][crate::model::vulnerability_occurrence::PackageIssue::fixed_package].
18976 ///
18977 /// # Example
18978 /// ```ignore,no_run
18979 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
18980 /// let x = PackageIssue::new().set_fixed_package("example");
18981 /// ```
18982 pub fn set_fixed_package<T: std::convert::Into<std::string::String>>(
18983 mut self,
18984 v: T,
18985 ) -> Self {
18986 self.fixed_package = v.into();
18987 self
18988 }
18989
18990 /// Sets the value of [fixed_version][crate::model::vulnerability_occurrence::PackageIssue::fixed_version].
18991 ///
18992 /// # Example
18993 /// ```ignore,no_run
18994 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
18995 /// use google_cloud_grafeas_v1::model::Version;
18996 /// let x = PackageIssue::new().set_fixed_version(Version::default()/* use setters */);
18997 /// ```
18998 pub fn set_fixed_version<T>(mut self, v: T) -> Self
18999 where
19000 T: std::convert::Into<crate::model::Version>,
19001 {
19002 self.fixed_version = std::option::Option::Some(v.into());
19003 self
19004 }
19005
19006 /// Sets or clears the value of [fixed_version][crate::model::vulnerability_occurrence::PackageIssue::fixed_version].
19007 ///
19008 /// # Example
19009 /// ```ignore,no_run
19010 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
19011 /// use google_cloud_grafeas_v1::model::Version;
19012 /// let x = PackageIssue::new().set_or_clear_fixed_version(Some(Version::default()/* use setters */));
19013 /// let x = PackageIssue::new().set_or_clear_fixed_version(None::<Version>);
19014 /// ```
19015 pub fn set_or_clear_fixed_version<T>(mut self, v: std::option::Option<T>) -> Self
19016 where
19017 T: std::convert::Into<crate::model::Version>,
19018 {
19019 self.fixed_version = v.map(|x| x.into());
19020 self
19021 }
19022
19023 /// Sets the value of [fix_available][crate::model::vulnerability_occurrence::PackageIssue::fix_available].
19024 ///
19025 /// # Example
19026 /// ```ignore,no_run
19027 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
19028 /// let x = PackageIssue::new().set_fix_available(true);
19029 /// ```
19030 pub fn set_fix_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19031 self.fix_available = v.into();
19032 self
19033 }
19034
19035 /// Sets the value of [package_type][crate::model::vulnerability_occurrence::PackageIssue::package_type].
19036 ///
19037 /// # Example
19038 /// ```ignore,no_run
19039 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
19040 /// let x = PackageIssue::new().set_package_type("example");
19041 /// ```
19042 pub fn set_package_type<T: std::convert::Into<std::string::String>>(
19043 mut self,
19044 v: T,
19045 ) -> Self {
19046 self.package_type = v.into();
19047 self
19048 }
19049
19050 /// Sets the value of [effective_severity][crate::model::vulnerability_occurrence::PackageIssue::effective_severity].
19051 ///
19052 /// # Example
19053 /// ```ignore,no_run
19054 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
19055 /// use google_cloud_grafeas_v1::model::Severity;
19056 /// let x0 = PackageIssue::new().set_effective_severity(Severity::Minimal);
19057 /// let x1 = PackageIssue::new().set_effective_severity(Severity::Low);
19058 /// let x2 = PackageIssue::new().set_effective_severity(Severity::Medium);
19059 /// ```
19060 pub fn set_effective_severity<T: std::convert::Into<crate::model::Severity>>(
19061 mut self,
19062 v: T,
19063 ) -> Self {
19064 self.effective_severity = v.into();
19065 self
19066 }
19067
19068 /// Sets the value of [file_location][crate::model::vulnerability_occurrence::PackageIssue::file_location].
19069 ///
19070 /// # Example
19071 /// ```ignore,no_run
19072 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
19073 /// use google_cloud_grafeas_v1::model::FileLocation;
19074 /// let x = PackageIssue::new()
19075 /// .set_file_location([
19076 /// FileLocation::default()/* use setters */,
19077 /// FileLocation::default()/* use (different) setters */,
19078 /// ]);
19079 /// ```
19080 pub fn set_file_location<T, V>(mut self, v: T) -> Self
19081 where
19082 T: std::iter::IntoIterator<Item = V>,
19083 V: std::convert::Into<crate::model::FileLocation>,
19084 {
19085 use std::iter::Iterator;
19086 self.file_location = v.into_iter().map(|i| i.into()).collect();
19087 self
19088 }
19089 }
19090
19091 impl wkt::message::Message for PackageIssue {
19092 fn typename() -> &'static str {
19093 "type.googleapis.com/grafeas.v1.VulnerabilityOccurrence.PackageIssue"
19094 }
19095 }
19096
19097 /// VexAssessment provides all publisher provided Vex information that is
19098 /// related to this vulnerability.
19099 #[derive(Clone, Default, PartialEq)]
19100 #[non_exhaustive]
19101 pub struct VexAssessment {
19102 /// Holds the MITRE standard Common Vulnerabilities and Exposures (CVE)
19103 /// tracking number for the vulnerability.
19104 /// Deprecated: Use vulnerability_id instead to denote CVEs.
19105 #[deprecated]
19106 pub cve: std::string::String,
19107
19108 /// The vulnerability identifier for this Assessment. Will hold one of
19109 /// common identifiers e.g. CVE, GHSA etc.
19110 pub vulnerability_id: std::string::String,
19111
19112 /// Holds a list of references associated with this vulnerability item and
19113 /// assessment.
19114 pub related_uris: std::vec::Vec<crate::model::RelatedUrl>,
19115
19116 /// The VulnerabilityAssessment note from which this VexAssessment was
19117 /// generated.
19118 /// This will be of the form: `projects/[PROJECT_ID]/notes/[NOTE_ID]`.
19119 /// (-- api-linter: core::0122::name-suffix=disabled
19120 /// aip.dev/not-precedent: The suffix is kept for consistency. --)
19121 pub note_name: std::string::String,
19122
19123 /// Provides the state of this Vulnerability assessment.
19124 pub state: crate::model::vulnerability_assessment_note::assessment::State,
19125
19126 /// Contains information about the impact of this vulnerability,
19127 /// this will change with time.
19128 pub impacts: std::vec::Vec<std::string::String>,
19129
19130 /// Specifies details on how to handle (and presumably, fix) a vulnerability.
19131 pub remediations:
19132 std::vec::Vec<crate::model::vulnerability_assessment_note::assessment::Remediation>,
19133
19134 /// Justification provides the justification when the state of the
19135 /// assessment if NOT_AFFECTED.
19136 pub justification: std::option::Option<
19137 crate::model::vulnerability_assessment_note::assessment::Justification,
19138 >,
19139
19140 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19141 }
19142
19143 impl VexAssessment {
19144 pub fn new() -> Self {
19145 std::default::Default::default()
19146 }
19147
19148 /// Sets the value of [cve][crate::model::vulnerability_occurrence::VexAssessment::cve].
19149 ///
19150 /// # Example
19151 /// ```ignore,no_run
19152 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
19153 /// let x = VexAssessment::new().set_cve("example");
19154 /// ```
19155 #[deprecated]
19156 pub fn set_cve<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19157 self.cve = v.into();
19158 self
19159 }
19160
19161 /// Sets the value of [vulnerability_id][crate::model::vulnerability_occurrence::VexAssessment::vulnerability_id].
19162 ///
19163 /// # Example
19164 /// ```ignore,no_run
19165 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
19166 /// let x = VexAssessment::new().set_vulnerability_id("example");
19167 /// ```
19168 pub fn set_vulnerability_id<T: std::convert::Into<std::string::String>>(
19169 mut self,
19170 v: T,
19171 ) -> Self {
19172 self.vulnerability_id = v.into();
19173 self
19174 }
19175
19176 /// Sets the value of [related_uris][crate::model::vulnerability_occurrence::VexAssessment::related_uris].
19177 ///
19178 /// # Example
19179 /// ```ignore,no_run
19180 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
19181 /// use google_cloud_grafeas_v1::model::RelatedUrl;
19182 /// let x = VexAssessment::new()
19183 /// .set_related_uris([
19184 /// RelatedUrl::default()/* use setters */,
19185 /// RelatedUrl::default()/* use (different) setters */,
19186 /// ]);
19187 /// ```
19188 pub fn set_related_uris<T, V>(mut self, v: T) -> Self
19189 where
19190 T: std::iter::IntoIterator<Item = V>,
19191 V: std::convert::Into<crate::model::RelatedUrl>,
19192 {
19193 use std::iter::Iterator;
19194 self.related_uris = v.into_iter().map(|i| i.into()).collect();
19195 self
19196 }
19197
19198 /// Sets the value of [note_name][crate::model::vulnerability_occurrence::VexAssessment::note_name].
19199 ///
19200 /// # Example
19201 /// ```ignore,no_run
19202 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
19203 /// let x = VexAssessment::new().set_note_name("example");
19204 /// ```
19205 pub fn set_note_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19206 self.note_name = v.into();
19207 self
19208 }
19209
19210 /// Sets the value of [state][crate::model::vulnerability_occurrence::VexAssessment::state].
19211 ///
19212 /// # Example
19213 /// ```ignore,no_run
19214 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
19215 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::State;
19216 /// let x0 = VexAssessment::new().set_state(State::Affected);
19217 /// let x1 = VexAssessment::new().set_state(State::NotAffected);
19218 /// let x2 = VexAssessment::new().set_state(State::Fixed);
19219 /// ```
19220 pub fn set_state<
19221 T: std::convert::Into<crate::model::vulnerability_assessment_note::assessment::State>,
19222 >(
19223 mut self,
19224 v: T,
19225 ) -> Self {
19226 self.state = v.into();
19227 self
19228 }
19229
19230 /// Sets the value of [impacts][crate::model::vulnerability_occurrence::VexAssessment::impacts].
19231 ///
19232 /// # Example
19233 /// ```ignore,no_run
19234 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
19235 /// let x = VexAssessment::new().set_impacts(["a", "b", "c"]);
19236 /// ```
19237 pub fn set_impacts<T, V>(mut self, v: T) -> Self
19238 where
19239 T: std::iter::IntoIterator<Item = V>,
19240 V: std::convert::Into<std::string::String>,
19241 {
19242 use std::iter::Iterator;
19243 self.impacts = v.into_iter().map(|i| i.into()).collect();
19244 self
19245 }
19246
19247 /// Sets the value of [remediations][crate::model::vulnerability_occurrence::VexAssessment::remediations].
19248 ///
19249 /// # Example
19250 /// ```ignore,no_run
19251 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
19252 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Remediation;
19253 /// let x = VexAssessment::new()
19254 /// .set_remediations([
19255 /// Remediation::default()/* use setters */,
19256 /// Remediation::default()/* use (different) setters */,
19257 /// ]);
19258 /// ```
19259 pub fn set_remediations<T, V>(mut self, v: T) -> Self
19260 where
19261 T: std::iter::IntoIterator<Item = V>,
19262 V: std::convert::Into<
19263 crate::model::vulnerability_assessment_note::assessment::Remediation,
19264 >,
19265 {
19266 use std::iter::Iterator;
19267 self.remediations = v.into_iter().map(|i| i.into()).collect();
19268 self
19269 }
19270
19271 /// Sets the value of [justification][crate::model::vulnerability_occurrence::VexAssessment::justification].
19272 ///
19273 /// # Example
19274 /// ```ignore,no_run
19275 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
19276 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Justification;
19277 /// let x = VexAssessment::new().set_justification(Justification::default()/* use setters */);
19278 /// ```
19279 pub fn set_justification<T>(mut self, v: T) -> Self
19280 where
19281 T: std::convert::Into<
19282 crate::model::vulnerability_assessment_note::assessment::Justification,
19283 >,
19284 {
19285 self.justification = std::option::Option::Some(v.into());
19286 self
19287 }
19288
19289 /// Sets or clears the value of [justification][crate::model::vulnerability_occurrence::VexAssessment::justification].
19290 ///
19291 /// # Example
19292 /// ```ignore,no_run
19293 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
19294 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Justification;
19295 /// let x = VexAssessment::new().set_or_clear_justification(Some(Justification::default()/* use setters */));
19296 /// let x = VexAssessment::new().set_or_clear_justification(None::<Justification>);
19297 /// ```
19298 pub fn set_or_clear_justification<T>(mut self, v: std::option::Option<T>) -> Self
19299 where
19300 T: std::convert::Into<
19301 crate::model::vulnerability_assessment_note::assessment::Justification,
19302 >,
19303 {
19304 self.justification = v.map(|x| x.into());
19305 self
19306 }
19307 }
19308
19309 impl wkt::message::Message for VexAssessment {
19310 fn typename() -> &'static str {
19311 "type.googleapis.com/grafeas.v1.VulnerabilityOccurrence.VexAssessment"
19312 }
19313 }
19314}
19315
19316/// Kind represents the kinds of notes supported.
19317///
19318/// # Working with unknown values
19319///
19320/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19321/// additional enum variants at any time. Adding new variants is not considered
19322/// a breaking change. Applications should write their code in anticipation of:
19323///
19324/// - New values appearing in future releases of the client library, **and**
19325/// - New values received dynamically, without application changes.
19326///
19327/// Please consult the [Working with enums] section in the user guide for some
19328/// guidelines.
19329///
19330/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
19331#[derive(Clone, Debug, PartialEq)]
19332#[non_exhaustive]
19333pub enum NoteKind {
19334 /// Default value. This value is unused.
19335 Unspecified,
19336 /// The note and occurrence represent a package vulnerability.
19337 Vulnerability,
19338 /// The note and occurrence assert build provenance.
19339 Build,
19340 /// This represents an image basis relationship.
19341 Image,
19342 /// This represents a package installed via a package manager.
19343 Package,
19344 /// The note and occurrence track deployment events.
19345 Deployment,
19346 /// The note and occurrence track the initial discovery status of a resource.
19347 Discovery,
19348 /// This represents a logical "role" that can attest to artifacts.
19349 Attestation,
19350 /// This represents an available package upgrade.
19351 Upgrade,
19352 /// This represents a Compliance Note
19353 Compliance,
19354 /// This represents a DSSE attestation Note
19355 DsseAttestation,
19356 /// This represents a Vulnerability Assessment.
19357 VulnerabilityAssessment,
19358 /// This represents an SBOM Reference.
19359 SbomReference,
19360 /// This represents a secret.
19361 Secret,
19362 /// If set, the enum was initialized with an unknown value.
19363 ///
19364 /// Applications can examine the value using [NoteKind::value] or
19365 /// [NoteKind::name].
19366 UnknownValue(note_kind::UnknownValue),
19367}
19368
19369#[doc(hidden)]
19370pub mod note_kind {
19371 #[allow(unused_imports)]
19372 use super::*;
19373 #[derive(Clone, Debug, PartialEq)]
19374 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19375}
19376
19377impl NoteKind {
19378 /// Gets the enum value.
19379 ///
19380 /// Returns `None` if the enum contains an unknown value deserialized from
19381 /// the string representation of enums.
19382 pub fn value(&self) -> std::option::Option<i32> {
19383 match self {
19384 Self::Unspecified => std::option::Option::Some(0),
19385 Self::Vulnerability => std::option::Option::Some(1),
19386 Self::Build => std::option::Option::Some(2),
19387 Self::Image => std::option::Option::Some(3),
19388 Self::Package => std::option::Option::Some(4),
19389 Self::Deployment => std::option::Option::Some(5),
19390 Self::Discovery => std::option::Option::Some(6),
19391 Self::Attestation => std::option::Option::Some(7),
19392 Self::Upgrade => std::option::Option::Some(8),
19393 Self::Compliance => std::option::Option::Some(9),
19394 Self::DsseAttestation => std::option::Option::Some(10),
19395 Self::VulnerabilityAssessment => std::option::Option::Some(11),
19396 Self::SbomReference => std::option::Option::Some(12),
19397 Self::Secret => std::option::Option::Some(13),
19398 Self::UnknownValue(u) => u.0.value(),
19399 }
19400 }
19401
19402 /// Gets the enum value as a string.
19403 ///
19404 /// Returns `None` if the enum contains an unknown value deserialized from
19405 /// the integer representation of enums.
19406 pub fn name(&self) -> std::option::Option<&str> {
19407 match self {
19408 Self::Unspecified => std::option::Option::Some("NOTE_KIND_UNSPECIFIED"),
19409 Self::Vulnerability => std::option::Option::Some("VULNERABILITY"),
19410 Self::Build => std::option::Option::Some("BUILD"),
19411 Self::Image => std::option::Option::Some("IMAGE"),
19412 Self::Package => std::option::Option::Some("PACKAGE"),
19413 Self::Deployment => std::option::Option::Some("DEPLOYMENT"),
19414 Self::Discovery => std::option::Option::Some("DISCOVERY"),
19415 Self::Attestation => std::option::Option::Some("ATTESTATION"),
19416 Self::Upgrade => std::option::Option::Some("UPGRADE"),
19417 Self::Compliance => std::option::Option::Some("COMPLIANCE"),
19418 Self::DsseAttestation => std::option::Option::Some("DSSE_ATTESTATION"),
19419 Self::VulnerabilityAssessment => std::option::Option::Some("VULNERABILITY_ASSESSMENT"),
19420 Self::SbomReference => std::option::Option::Some("SBOM_REFERENCE"),
19421 Self::Secret => std::option::Option::Some("SECRET"),
19422 Self::UnknownValue(u) => u.0.name(),
19423 }
19424 }
19425}
19426
19427impl std::default::Default for NoteKind {
19428 fn default() -> Self {
19429 use std::convert::From;
19430 Self::from(0)
19431 }
19432}
19433
19434impl std::fmt::Display for NoteKind {
19435 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19436 wkt::internal::display_enum(f, self.name(), self.value())
19437 }
19438}
19439
19440impl std::convert::From<i32> for NoteKind {
19441 fn from(value: i32) -> Self {
19442 match value {
19443 0 => Self::Unspecified,
19444 1 => Self::Vulnerability,
19445 2 => Self::Build,
19446 3 => Self::Image,
19447 4 => Self::Package,
19448 5 => Self::Deployment,
19449 6 => Self::Discovery,
19450 7 => Self::Attestation,
19451 8 => Self::Upgrade,
19452 9 => Self::Compliance,
19453 10 => Self::DsseAttestation,
19454 11 => Self::VulnerabilityAssessment,
19455 12 => Self::SbomReference,
19456 13 => Self::Secret,
19457 _ => Self::UnknownValue(note_kind::UnknownValue(
19458 wkt::internal::UnknownEnumValue::Integer(value),
19459 )),
19460 }
19461 }
19462}
19463
19464impl std::convert::From<&str> for NoteKind {
19465 fn from(value: &str) -> Self {
19466 use std::string::ToString;
19467 match value {
19468 "NOTE_KIND_UNSPECIFIED" => Self::Unspecified,
19469 "VULNERABILITY" => Self::Vulnerability,
19470 "BUILD" => Self::Build,
19471 "IMAGE" => Self::Image,
19472 "PACKAGE" => Self::Package,
19473 "DEPLOYMENT" => Self::Deployment,
19474 "DISCOVERY" => Self::Discovery,
19475 "ATTESTATION" => Self::Attestation,
19476 "UPGRADE" => Self::Upgrade,
19477 "COMPLIANCE" => Self::Compliance,
19478 "DSSE_ATTESTATION" => Self::DsseAttestation,
19479 "VULNERABILITY_ASSESSMENT" => Self::VulnerabilityAssessment,
19480 "SBOM_REFERENCE" => Self::SbomReference,
19481 "SECRET" => Self::Secret,
19482 _ => Self::UnknownValue(note_kind::UnknownValue(
19483 wkt::internal::UnknownEnumValue::String(value.to_string()),
19484 )),
19485 }
19486 }
19487}
19488
19489impl serde::ser::Serialize for NoteKind {
19490 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19491 where
19492 S: serde::Serializer,
19493 {
19494 match self {
19495 Self::Unspecified => serializer.serialize_i32(0),
19496 Self::Vulnerability => serializer.serialize_i32(1),
19497 Self::Build => serializer.serialize_i32(2),
19498 Self::Image => serializer.serialize_i32(3),
19499 Self::Package => serializer.serialize_i32(4),
19500 Self::Deployment => serializer.serialize_i32(5),
19501 Self::Discovery => serializer.serialize_i32(6),
19502 Self::Attestation => serializer.serialize_i32(7),
19503 Self::Upgrade => serializer.serialize_i32(8),
19504 Self::Compliance => serializer.serialize_i32(9),
19505 Self::DsseAttestation => serializer.serialize_i32(10),
19506 Self::VulnerabilityAssessment => serializer.serialize_i32(11),
19507 Self::SbomReference => serializer.serialize_i32(12),
19508 Self::Secret => serializer.serialize_i32(13),
19509 Self::UnknownValue(u) => u.0.serialize(serializer),
19510 }
19511 }
19512}
19513
19514impl<'de> serde::de::Deserialize<'de> for NoteKind {
19515 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19516 where
19517 D: serde::Deserializer<'de>,
19518 {
19519 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NoteKind>::new(
19520 ".grafeas.v1.NoteKind",
19521 ))
19522 }
19523}
19524
19525/// CVSS Version.
19526///
19527/// # Working with unknown values
19528///
19529/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19530/// additional enum variants at any time. Adding new variants is not considered
19531/// a breaking change. Applications should write their code in anticipation of:
19532///
19533/// - New values appearing in future releases of the client library, **and**
19534/// - New values received dynamically, without application changes.
19535///
19536/// Please consult the [Working with enums] section in the user guide for some
19537/// guidelines.
19538///
19539/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
19540#[derive(Clone, Debug, PartialEq)]
19541#[non_exhaustive]
19542pub enum CVSSVersion {
19543 Unspecified,
19544 CvssVersion2,
19545 CvssVersion3,
19546 /// If set, the enum was initialized with an unknown value.
19547 ///
19548 /// Applications can examine the value using [CVSSVersion::value] or
19549 /// [CVSSVersion::name].
19550 UnknownValue(cvss_version::UnknownValue),
19551}
19552
19553#[doc(hidden)]
19554pub mod cvss_version {
19555 #[allow(unused_imports)]
19556 use super::*;
19557 #[derive(Clone, Debug, PartialEq)]
19558 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19559}
19560
19561impl CVSSVersion {
19562 /// Gets the enum value.
19563 ///
19564 /// Returns `None` if the enum contains an unknown value deserialized from
19565 /// the string representation of enums.
19566 pub fn value(&self) -> std::option::Option<i32> {
19567 match self {
19568 Self::Unspecified => std::option::Option::Some(0),
19569 Self::CvssVersion2 => std::option::Option::Some(1),
19570 Self::CvssVersion3 => std::option::Option::Some(2),
19571 Self::UnknownValue(u) => u.0.value(),
19572 }
19573 }
19574
19575 /// Gets the enum value as a string.
19576 ///
19577 /// Returns `None` if the enum contains an unknown value deserialized from
19578 /// the integer representation of enums.
19579 pub fn name(&self) -> std::option::Option<&str> {
19580 match self {
19581 Self::Unspecified => std::option::Option::Some("CVSS_VERSION_UNSPECIFIED"),
19582 Self::CvssVersion2 => std::option::Option::Some("CVSS_VERSION_2"),
19583 Self::CvssVersion3 => std::option::Option::Some("CVSS_VERSION_3"),
19584 Self::UnknownValue(u) => u.0.name(),
19585 }
19586 }
19587}
19588
19589impl std::default::Default for CVSSVersion {
19590 fn default() -> Self {
19591 use std::convert::From;
19592 Self::from(0)
19593 }
19594}
19595
19596impl std::fmt::Display for CVSSVersion {
19597 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19598 wkt::internal::display_enum(f, self.name(), self.value())
19599 }
19600}
19601
19602impl std::convert::From<i32> for CVSSVersion {
19603 fn from(value: i32) -> Self {
19604 match value {
19605 0 => Self::Unspecified,
19606 1 => Self::CvssVersion2,
19607 2 => Self::CvssVersion3,
19608 _ => Self::UnknownValue(cvss_version::UnknownValue(
19609 wkt::internal::UnknownEnumValue::Integer(value),
19610 )),
19611 }
19612 }
19613}
19614
19615impl std::convert::From<&str> for CVSSVersion {
19616 fn from(value: &str) -> Self {
19617 use std::string::ToString;
19618 match value {
19619 "CVSS_VERSION_UNSPECIFIED" => Self::Unspecified,
19620 "CVSS_VERSION_2" => Self::CvssVersion2,
19621 "CVSS_VERSION_3" => Self::CvssVersion3,
19622 _ => Self::UnknownValue(cvss_version::UnknownValue(
19623 wkt::internal::UnknownEnumValue::String(value.to_string()),
19624 )),
19625 }
19626 }
19627}
19628
19629impl serde::ser::Serialize for CVSSVersion {
19630 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19631 where
19632 S: serde::Serializer,
19633 {
19634 match self {
19635 Self::Unspecified => serializer.serialize_i32(0),
19636 Self::CvssVersion2 => serializer.serialize_i32(1),
19637 Self::CvssVersion3 => serializer.serialize_i32(2),
19638 Self::UnknownValue(u) => u.0.serialize(serializer),
19639 }
19640 }
19641}
19642
19643impl<'de> serde::de::Deserialize<'de> for CVSSVersion {
19644 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19645 where
19646 D: serde::Deserializer<'de>,
19647 {
19648 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CVSSVersion>::new(
19649 ".grafeas.v1.CVSSVersion",
19650 ))
19651 }
19652}
19653
19654/// Instruction set architectures supported by various package managers.
19655///
19656/// # Working with unknown values
19657///
19658/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19659/// additional enum variants at any time. Adding new variants is not considered
19660/// a breaking change. Applications should write their code in anticipation of:
19661///
19662/// - New values appearing in future releases of the client library, **and**
19663/// - New values received dynamically, without application changes.
19664///
19665/// Please consult the [Working with enums] section in the user guide for some
19666/// guidelines.
19667///
19668/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
19669#[derive(Clone, Debug, PartialEq)]
19670#[non_exhaustive]
19671pub enum Architecture {
19672 /// Unknown architecture.
19673 Unspecified,
19674 /// X86 architecture.
19675 X86,
19676 /// X64 architecture.
19677 X64,
19678 /// If set, the enum was initialized with an unknown value.
19679 ///
19680 /// Applications can examine the value using [Architecture::value] or
19681 /// [Architecture::name].
19682 UnknownValue(architecture::UnknownValue),
19683}
19684
19685#[doc(hidden)]
19686pub mod architecture {
19687 #[allow(unused_imports)]
19688 use super::*;
19689 #[derive(Clone, Debug, PartialEq)]
19690 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19691}
19692
19693impl Architecture {
19694 /// Gets the enum value.
19695 ///
19696 /// Returns `None` if the enum contains an unknown value deserialized from
19697 /// the string representation of enums.
19698 pub fn value(&self) -> std::option::Option<i32> {
19699 match self {
19700 Self::Unspecified => std::option::Option::Some(0),
19701 Self::X86 => std::option::Option::Some(1),
19702 Self::X64 => std::option::Option::Some(2),
19703 Self::UnknownValue(u) => u.0.value(),
19704 }
19705 }
19706
19707 /// Gets the enum value as a string.
19708 ///
19709 /// Returns `None` if the enum contains an unknown value deserialized from
19710 /// the integer representation of enums.
19711 pub fn name(&self) -> std::option::Option<&str> {
19712 match self {
19713 Self::Unspecified => std::option::Option::Some("ARCHITECTURE_UNSPECIFIED"),
19714 Self::X86 => std::option::Option::Some("X86"),
19715 Self::X64 => std::option::Option::Some("X64"),
19716 Self::UnknownValue(u) => u.0.name(),
19717 }
19718 }
19719}
19720
19721impl std::default::Default for Architecture {
19722 fn default() -> Self {
19723 use std::convert::From;
19724 Self::from(0)
19725 }
19726}
19727
19728impl std::fmt::Display for Architecture {
19729 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19730 wkt::internal::display_enum(f, self.name(), self.value())
19731 }
19732}
19733
19734impl std::convert::From<i32> for Architecture {
19735 fn from(value: i32) -> Self {
19736 match value {
19737 0 => Self::Unspecified,
19738 1 => Self::X86,
19739 2 => Self::X64,
19740 _ => Self::UnknownValue(architecture::UnknownValue(
19741 wkt::internal::UnknownEnumValue::Integer(value),
19742 )),
19743 }
19744 }
19745}
19746
19747impl std::convert::From<&str> for Architecture {
19748 fn from(value: &str) -> Self {
19749 use std::string::ToString;
19750 match value {
19751 "ARCHITECTURE_UNSPECIFIED" => Self::Unspecified,
19752 "X86" => Self::X86,
19753 "X64" => Self::X64,
19754 _ => Self::UnknownValue(architecture::UnknownValue(
19755 wkt::internal::UnknownEnumValue::String(value.to_string()),
19756 )),
19757 }
19758 }
19759}
19760
19761impl serde::ser::Serialize for Architecture {
19762 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19763 where
19764 S: serde::Serializer,
19765 {
19766 match self {
19767 Self::Unspecified => serializer.serialize_i32(0),
19768 Self::X86 => serializer.serialize_i32(1),
19769 Self::X64 => serializer.serialize_i32(2),
19770 Self::UnknownValue(u) => u.0.serialize(serializer),
19771 }
19772 }
19773}
19774
19775impl<'de> serde::de::Deserialize<'de> for Architecture {
19776 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19777 where
19778 D: serde::Deserializer<'de>,
19779 {
19780 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Architecture>::new(
19781 ".grafeas.v1.Architecture",
19782 ))
19783 }
19784}
19785
19786/// Kind of secret.
19787///
19788/// # Working with unknown values
19789///
19790/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19791/// additional enum variants at any time. Adding new variants is not considered
19792/// a breaking change. Applications should write their code in anticipation of:
19793///
19794/// - New values appearing in future releases of the client library, **and**
19795/// - New values received dynamically, without application changes.
19796///
19797/// Please consult the [Working with enums] section in the user guide for some
19798/// guidelines.
19799///
19800/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
19801#[derive(Clone, Debug, PartialEq)]
19802#[non_exhaustive]
19803pub enum SecretKind {
19804 /// Unspecified
19805 Unspecified,
19806 /// The secret kind is unknown.
19807 Unknown,
19808 /// A Google Cloud service account key per:
19809 /// <https://cloud.google.com/iam/docs/creating-managing-service-account-keys>
19810 GcpServiceAccountKey,
19811 /// A Google Cloud API key per:
19812 /// <https://cloud.google.com/docs/authentication/api-keys>
19813 GcpApiKey,
19814 /// A Google Cloud OAuth2 client credentials per:
19815 /// <https://developers.google.com/identity/protocols/oauth2>
19816 GcpOauth2ClientCredentials,
19817 /// A Google Cloud OAuth2 access token per:
19818 /// <https://cloud.google.com/docs/authentication/token-types#access>
19819 GcpOauth2AccessToken,
19820 /// An Anthropic Admin API key.
19821 AnthropicAdminApiKey,
19822 /// An Anthropic API key.
19823 AnthropicApiKey,
19824 /// An Azure access token.
19825 AzureAccessToken,
19826 /// An Azure Identity Platform ID token.
19827 AzureIdentityToken,
19828 /// A Docker Hub personal access token.
19829 DockerHubPersonalAccessToken,
19830 /// A GitHub App refresh token.
19831 GithubAppRefreshToken,
19832 /// A GitHub App server-to-server token.
19833 GithubAppServerToServerToken,
19834 /// A GitHub App user-to-server token.
19835 GithubAppUserToServerToken,
19836 /// A GitHub personal access token (classic).
19837 GithubClassicPersonalAccessToken,
19838 /// A GitHub fine-grained personal access token.
19839 GithubFineGrainedPersonalAccessToken,
19840 /// A GitHub OAuth token.
19841 GithubOauthToken,
19842 /// A Hugging Face API key.
19843 HuggingfaceApiKey,
19844 /// An OpenAI API key.
19845 OpenaiApiKey,
19846 /// A Perplexity API key.
19847 PerplexityApiKey,
19848 /// A Stripe secret key.
19849 StripeSecretKey,
19850 /// A Stripe restricted key.
19851 StripeRestrictedKey,
19852 /// A Stripe webhook secret.
19853 StripeWebhookSecret,
19854 /// If set, the enum was initialized with an unknown value.
19855 ///
19856 /// Applications can examine the value using [SecretKind::value] or
19857 /// [SecretKind::name].
19858 UnknownValue(secret_kind::UnknownValue),
19859}
19860
19861#[doc(hidden)]
19862pub mod secret_kind {
19863 #[allow(unused_imports)]
19864 use super::*;
19865 #[derive(Clone, Debug, PartialEq)]
19866 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19867}
19868
19869impl SecretKind {
19870 /// Gets the enum value.
19871 ///
19872 /// Returns `None` if the enum contains an unknown value deserialized from
19873 /// the string representation of enums.
19874 pub fn value(&self) -> std::option::Option<i32> {
19875 match self {
19876 Self::Unspecified => std::option::Option::Some(0),
19877 Self::Unknown => std::option::Option::Some(1),
19878 Self::GcpServiceAccountKey => std::option::Option::Some(2),
19879 Self::GcpApiKey => std::option::Option::Some(3),
19880 Self::GcpOauth2ClientCredentials => std::option::Option::Some(4),
19881 Self::GcpOauth2AccessToken => std::option::Option::Some(5),
19882 Self::AnthropicAdminApiKey => std::option::Option::Some(6),
19883 Self::AnthropicApiKey => std::option::Option::Some(7),
19884 Self::AzureAccessToken => std::option::Option::Some(8),
19885 Self::AzureIdentityToken => std::option::Option::Some(9),
19886 Self::DockerHubPersonalAccessToken => std::option::Option::Some(10),
19887 Self::GithubAppRefreshToken => std::option::Option::Some(11),
19888 Self::GithubAppServerToServerToken => std::option::Option::Some(12),
19889 Self::GithubAppUserToServerToken => std::option::Option::Some(13),
19890 Self::GithubClassicPersonalAccessToken => std::option::Option::Some(14),
19891 Self::GithubFineGrainedPersonalAccessToken => std::option::Option::Some(15),
19892 Self::GithubOauthToken => std::option::Option::Some(16),
19893 Self::HuggingfaceApiKey => std::option::Option::Some(17),
19894 Self::OpenaiApiKey => std::option::Option::Some(18),
19895 Self::PerplexityApiKey => std::option::Option::Some(19),
19896 Self::StripeSecretKey => std::option::Option::Some(20),
19897 Self::StripeRestrictedKey => std::option::Option::Some(21),
19898 Self::StripeWebhookSecret => std::option::Option::Some(22),
19899 Self::UnknownValue(u) => u.0.value(),
19900 }
19901 }
19902
19903 /// Gets the enum value as a string.
19904 ///
19905 /// Returns `None` if the enum contains an unknown value deserialized from
19906 /// the integer representation of enums.
19907 pub fn name(&self) -> std::option::Option<&str> {
19908 match self {
19909 Self::Unspecified => std::option::Option::Some("SECRET_KIND_UNSPECIFIED"),
19910 Self::Unknown => std::option::Option::Some("SECRET_KIND_UNKNOWN"),
19911 Self::GcpServiceAccountKey => {
19912 std::option::Option::Some("SECRET_KIND_GCP_SERVICE_ACCOUNT_KEY")
19913 }
19914 Self::GcpApiKey => std::option::Option::Some("SECRET_KIND_GCP_API_KEY"),
19915 Self::GcpOauth2ClientCredentials => {
19916 std::option::Option::Some("SECRET_KIND_GCP_OAUTH2_CLIENT_CREDENTIALS")
19917 }
19918 Self::GcpOauth2AccessToken => {
19919 std::option::Option::Some("SECRET_KIND_GCP_OAUTH2_ACCESS_TOKEN")
19920 }
19921 Self::AnthropicAdminApiKey => {
19922 std::option::Option::Some("SECRET_KIND_ANTHROPIC_ADMIN_API_KEY")
19923 }
19924 Self::AnthropicApiKey => std::option::Option::Some("SECRET_KIND_ANTHROPIC_API_KEY"),
19925 Self::AzureAccessToken => std::option::Option::Some("SECRET_KIND_AZURE_ACCESS_TOKEN"),
19926 Self::AzureIdentityToken => {
19927 std::option::Option::Some("SECRET_KIND_AZURE_IDENTITY_TOKEN")
19928 }
19929 Self::DockerHubPersonalAccessToken => {
19930 std::option::Option::Some("SECRET_KIND_DOCKER_HUB_PERSONAL_ACCESS_TOKEN")
19931 }
19932 Self::GithubAppRefreshToken => {
19933 std::option::Option::Some("SECRET_KIND_GITHUB_APP_REFRESH_TOKEN")
19934 }
19935 Self::GithubAppServerToServerToken => {
19936 std::option::Option::Some("SECRET_KIND_GITHUB_APP_SERVER_TO_SERVER_TOKEN")
19937 }
19938 Self::GithubAppUserToServerToken => {
19939 std::option::Option::Some("SECRET_KIND_GITHUB_APP_USER_TO_SERVER_TOKEN")
19940 }
19941 Self::GithubClassicPersonalAccessToken => {
19942 std::option::Option::Some("SECRET_KIND_GITHUB_CLASSIC_PERSONAL_ACCESS_TOKEN")
19943 }
19944 Self::GithubFineGrainedPersonalAccessToken => {
19945 std::option::Option::Some("SECRET_KIND_GITHUB_FINE_GRAINED_PERSONAL_ACCESS_TOKEN")
19946 }
19947 Self::GithubOauthToken => std::option::Option::Some("SECRET_KIND_GITHUB_OAUTH_TOKEN"),
19948 Self::HuggingfaceApiKey => std::option::Option::Some("SECRET_KIND_HUGGINGFACE_API_KEY"),
19949 Self::OpenaiApiKey => std::option::Option::Some("SECRET_KIND_OPENAI_API_KEY"),
19950 Self::PerplexityApiKey => std::option::Option::Some("SECRET_KIND_PERPLEXITY_API_KEY"),
19951 Self::StripeSecretKey => std::option::Option::Some("SECRET_KIND_STRIPE_SECRET_KEY"),
19952 Self::StripeRestrictedKey => {
19953 std::option::Option::Some("SECRET_KIND_STRIPE_RESTRICTED_KEY")
19954 }
19955 Self::StripeWebhookSecret => {
19956 std::option::Option::Some("SECRET_KIND_STRIPE_WEBHOOK_SECRET")
19957 }
19958 Self::UnknownValue(u) => u.0.name(),
19959 }
19960 }
19961}
19962
19963impl std::default::Default for SecretKind {
19964 fn default() -> Self {
19965 use std::convert::From;
19966 Self::from(0)
19967 }
19968}
19969
19970impl std::fmt::Display for SecretKind {
19971 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19972 wkt::internal::display_enum(f, self.name(), self.value())
19973 }
19974}
19975
19976impl std::convert::From<i32> for SecretKind {
19977 fn from(value: i32) -> Self {
19978 match value {
19979 0 => Self::Unspecified,
19980 1 => Self::Unknown,
19981 2 => Self::GcpServiceAccountKey,
19982 3 => Self::GcpApiKey,
19983 4 => Self::GcpOauth2ClientCredentials,
19984 5 => Self::GcpOauth2AccessToken,
19985 6 => Self::AnthropicAdminApiKey,
19986 7 => Self::AnthropicApiKey,
19987 8 => Self::AzureAccessToken,
19988 9 => Self::AzureIdentityToken,
19989 10 => Self::DockerHubPersonalAccessToken,
19990 11 => Self::GithubAppRefreshToken,
19991 12 => Self::GithubAppServerToServerToken,
19992 13 => Self::GithubAppUserToServerToken,
19993 14 => Self::GithubClassicPersonalAccessToken,
19994 15 => Self::GithubFineGrainedPersonalAccessToken,
19995 16 => Self::GithubOauthToken,
19996 17 => Self::HuggingfaceApiKey,
19997 18 => Self::OpenaiApiKey,
19998 19 => Self::PerplexityApiKey,
19999 20 => Self::StripeSecretKey,
20000 21 => Self::StripeRestrictedKey,
20001 22 => Self::StripeWebhookSecret,
20002 _ => Self::UnknownValue(secret_kind::UnknownValue(
20003 wkt::internal::UnknownEnumValue::Integer(value),
20004 )),
20005 }
20006 }
20007}
20008
20009impl std::convert::From<&str> for SecretKind {
20010 fn from(value: &str) -> Self {
20011 use std::string::ToString;
20012 match value {
20013 "SECRET_KIND_UNSPECIFIED" => Self::Unspecified,
20014 "SECRET_KIND_UNKNOWN" => Self::Unknown,
20015 "SECRET_KIND_GCP_SERVICE_ACCOUNT_KEY" => Self::GcpServiceAccountKey,
20016 "SECRET_KIND_GCP_API_KEY" => Self::GcpApiKey,
20017 "SECRET_KIND_GCP_OAUTH2_CLIENT_CREDENTIALS" => Self::GcpOauth2ClientCredentials,
20018 "SECRET_KIND_GCP_OAUTH2_ACCESS_TOKEN" => Self::GcpOauth2AccessToken,
20019 "SECRET_KIND_ANTHROPIC_ADMIN_API_KEY" => Self::AnthropicAdminApiKey,
20020 "SECRET_KIND_ANTHROPIC_API_KEY" => Self::AnthropicApiKey,
20021 "SECRET_KIND_AZURE_ACCESS_TOKEN" => Self::AzureAccessToken,
20022 "SECRET_KIND_AZURE_IDENTITY_TOKEN" => Self::AzureIdentityToken,
20023 "SECRET_KIND_DOCKER_HUB_PERSONAL_ACCESS_TOKEN" => Self::DockerHubPersonalAccessToken,
20024 "SECRET_KIND_GITHUB_APP_REFRESH_TOKEN" => Self::GithubAppRefreshToken,
20025 "SECRET_KIND_GITHUB_APP_SERVER_TO_SERVER_TOKEN" => Self::GithubAppServerToServerToken,
20026 "SECRET_KIND_GITHUB_APP_USER_TO_SERVER_TOKEN" => Self::GithubAppUserToServerToken,
20027 "SECRET_KIND_GITHUB_CLASSIC_PERSONAL_ACCESS_TOKEN" => {
20028 Self::GithubClassicPersonalAccessToken
20029 }
20030 "SECRET_KIND_GITHUB_FINE_GRAINED_PERSONAL_ACCESS_TOKEN" => {
20031 Self::GithubFineGrainedPersonalAccessToken
20032 }
20033 "SECRET_KIND_GITHUB_OAUTH_TOKEN" => Self::GithubOauthToken,
20034 "SECRET_KIND_HUGGINGFACE_API_KEY" => Self::HuggingfaceApiKey,
20035 "SECRET_KIND_OPENAI_API_KEY" => Self::OpenaiApiKey,
20036 "SECRET_KIND_PERPLEXITY_API_KEY" => Self::PerplexityApiKey,
20037 "SECRET_KIND_STRIPE_SECRET_KEY" => Self::StripeSecretKey,
20038 "SECRET_KIND_STRIPE_RESTRICTED_KEY" => Self::StripeRestrictedKey,
20039 "SECRET_KIND_STRIPE_WEBHOOK_SECRET" => Self::StripeWebhookSecret,
20040 _ => Self::UnknownValue(secret_kind::UnknownValue(
20041 wkt::internal::UnknownEnumValue::String(value.to_string()),
20042 )),
20043 }
20044 }
20045}
20046
20047impl serde::ser::Serialize for SecretKind {
20048 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20049 where
20050 S: serde::Serializer,
20051 {
20052 match self {
20053 Self::Unspecified => serializer.serialize_i32(0),
20054 Self::Unknown => serializer.serialize_i32(1),
20055 Self::GcpServiceAccountKey => serializer.serialize_i32(2),
20056 Self::GcpApiKey => serializer.serialize_i32(3),
20057 Self::GcpOauth2ClientCredentials => serializer.serialize_i32(4),
20058 Self::GcpOauth2AccessToken => serializer.serialize_i32(5),
20059 Self::AnthropicAdminApiKey => serializer.serialize_i32(6),
20060 Self::AnthropicApiKey => serializer.serialize_i32(7),
20061 Self::AzureAccessToken => serializer.serialize_i32(8),
20062 Self::AzureIdentityToken => serializer.serialize_i32(9),
20063 Self::DockerHubPersonalAccessToken => serializer.serialize_i32(10),
20064 Self::GithubAppRefreshToken => serializer.serialize_i32(11),
20065 Self::GithubAppServerToServerToken => serializer.serialize_i32(12),
20066 Self::GithubAppUserToServerToken => serializer.serialize_i32(13),
20067 Self::GithubClassicPersonalAccessToken => serializer.serialize_i32(14),
20068 Self::GithubFineGrainedPersonalAccessToken => serializer.serialize_i32(15),
20069 Self::GithubOauthToken => serializer.serialize_i32(16),
20070 Self::HuggingfaceApiKey => serializer.serialize_i32(17),
20071 Self::OpenaiApiKey => serializer.serialize_i32(18),
20072 Self::PerplexityApiKey => serializer.serialize_i32(19),
20073 Self::StripeSecretKey => serializer.serialize_i32(20),
20074 Self::StripeRestrictedKey => serializer.serialize_i32(21),
20075 Self::StripeWebhookSecret => serializer.serialize_i32(22),
20076 Self::UnknownValue(u) => u.0.serialize(serializer),
20077 }
20078 }
20079}
20080
20081impl<'de> serde::de::Deserialize<'de> for SecretKind {
20082 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20083 where
20084 D: serde::Deserializer<'de>,
20085 {
20086 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SecretKind>::new(
20087 ".grafeas.v1.SecretKind",
20088 ))
20089 }
20090}
20091
20092/// Note provider assigned severity/impact ranking.
20093///
20094/// # Working with unknown values
20095///
20096/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
20097/// additional enum variants at any time. Adding new variants is not considered
20098/// a breaking change. Applications should write their code in anticipation of:
20099///
20100/// - New values appearing in future releases of the client library, **and**
20101/// - New values received dynamically, without application changes.
20102///
20103/// Please consult the [Working with enums] section in the user guide for some
20104/// guidelines.
20105///
20106/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
20107#[derive(Clone, Debug, PartialEq)]
20108#[non_exhaustive]
20109pub enum Severity {
20110 /// Unknown.
20111 Unspecified,
20112 /// Minimal severity.
20113 Minimal,
20114 /// Low severity.
20115 Low,
20116 /// Medium severity.
20117 Medium,
20118 /// High severity.
20119 High,
20120 /// Critical severity.
20121 Critical,
20122 /// If set, the enum was initialized with an unknown value.
20123 ///
20124 /// Applications can examine the value using [Severity::value] or
20125 /// [Severity::name].
20126 UnknownValue(severity::UnknownValue),
20127}
20128
20129#[doc(hidden)]
20130pub mod severity {
20131 #[allow(unused_imports)]
20132 use super::*;
20133 #[derive(Clone, Debug, PartialEq)]
20134 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
20135}
20136
20137impl Severity {
20138 /// Gets the enum value.
20139 ///
20140 /// Returns `None` if the enum contains an unknown value deserialized from
20141 /// the string representation of enums.
20142 pub fn value(&self) -> std::option::Option<i32> {
20143 match self {
20144 Self::Unspecified => std::option::Option::Some(0),
20145 Self::Minimal => std::option::Option::Some(1),
20146 Self::Low => std::option::Option::Some(2),
20147 Self::Medium => std::option::Option::Some(3),
20148 Self::High => std::option::Option::Some(4),
20149 Self::Critical => std::option::Option::Some(5),
20150 Self::UnknownValue(u) => u.0.value(),
20151 }
20152 }
20153
20154 /// Gets the enum value as a string.
20155 ///
20156 /// Returns `None` if the enum contains an unknown value deserialized from
20157 /// the integer representation of enums.
20158 pub fn name(&self) -> std::option::Option<&str> {
20159 match self {
20160 Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
20161 Self::Minimal => std::option::Option::Some("MINIMAL"),
20162 Self::Low => std::option::Option::Some("LOW"),
20163 Self::Medium => std::option::Option::Some("MEDIUM"),
20164 Self::High => std::option::Option::Some("HIGH"),
20165 Self::Critical => std::option::Option::Some("CRITICAL"),
20166 Self::UnknownValue(u) => u.0.name(),
20167 }
20168 }
20169}
20170
20171impl std::default::Default for Severity {
20172 fn default() -> Self {
20173 use std::convert::From;
20174 Self::from(0)
20175 }
20176}
20177
20178impl std::fmt::Display for Severity {
20179 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
20180 wkt::internal::display_enum(f, self.name(), self.value())
20181 }
20182}
20183
20184impl std::convert::From<i32> for Severity {
20185 fn from(value: i32) -> Self {
20186 match value {
20187 0 => Self::Unspecified,
20188 1 => Self::Minimal,
20189 2 => Self::Low,
20190 3 => Self::Medium,
20191 4 => Self::High,
20192 5 => Self::Critical,
20193 _ => Self::UnknownValue(severity::UnknownValue(
20194 wkt::internal::UnknownEnumValue::Integer(value),
20195 )),
20196 }
20197 }
20198}
20199
20200impl std::convert::From<&str> for Severity {
20201 fn from(value: &str) -> Self {
20202 use std::string::ToString;
20203 match value {
20204 "SEVERITY_UNSPECIFIED" => Self::Unspecified,
20205 "MINIMAL" => Self::Minimal,
20206 "LOW" => Self::Low,
20207 "MEDIUM" => Self::Medium,
20208 "HIGH" => Self::High,
20209 "CRITICAL" => Self::Critical,
20210 _ => Self::UnknownValue(severity::UnknownValue(
20211 wkt::internal::UnknownEnumValue::String(value.to_string()),
20212 )),
20213 }
20214 }
20215}
20216
20217impl serde::ser::Serialize for Severity {
20218 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20219 where
20220 S: serde::Serializer,
20221 {
20222 match self {
20223 Self::Unspecified => serializer.serialize_i32(0),
20224 Self::Minimal => serializer.serialize_i32(1),
20225 Self::Low => serializer.serialize_i32(2),
20226 Self::Medium => serializer.serialize_i32(3),
20227 Self::High => serializer.serialize_i32(4),
20228 Self::Critical => serializer.serialize_i32(5),
20229 Self::UnknownValue(u) => u.0.serialize(serializer),
20230 }
20231 }
20232}
20233
20234impl<'de> serde::de::Deserialize<'de> for Severity {
20235 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20236 where
20237 D: serde::Deserializer<'de>,
20238 {
20239 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
20240 ".grafeas.v1.Severity",
20241 ))
20242 }
20243}