#![allow(rustdoc::bare_urls)]
#![allow(rustdoc::broken_intra_doc_links)]
#![allow(rustdoc::invalid_html_tags)]
#![allow(rustdoc::redundant_explicit_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gaxi;
extern crate google_cloud_gax;
extern crate google_cloud_rpc;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;
mod debug;
mod deserialize;
mod serialize;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AttestationNote {
pub hint: std::option::Option<crate::model::attestation_note::Hint>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AttestationNote {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_hint<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::attestation_note::Hint>,
{
self.hint = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_hint<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::attestation_note::Hint>,
{
self.hint = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for AttestationNote {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.AttestationNote"
}
}
pub mod attestation_note {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Hint {
pub human_readable_name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Hint {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_human_readable_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.human_readable_name = v.into();
self
}
}
impl wkt::message::Message for Hint {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.AttestationNote.Hint"
}
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Jwt {
pub compact_jwt: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Jwt {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_compact_jwt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.compact_jwt = v.into();
self
}
}
impl wkt::message::Message for Jwt {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.Jwt"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AttestationOccurrence {
pub serialized_payload: ::bytes::Bytes,
pub signatures: std::vec::Vec<crate::model::Signature>,
pub jwts: std::vec::Vec<crate::model::Jwt>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AttestationOccurrence {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_serialized_payload<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.serialized_payload = v.into();
self
}
pub fn set_signatures<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Signature>,
{
use std::iter::Iterator;
self.signatures = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_jwts<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Jwt>,
{
use std::iter::Iterator;
self.jwts = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for AttestationOccurrence {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.AttestationOccurrence"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BuildNote {
pub builder_version: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BuildNote {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_builder_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.builder_version = v.into();
self
}
}
impl wkt::message::Message for BuildNote {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.BuildNote"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BuildOccurrence {
pub provenance: std::option::Option<crate::model::BuildProvenance>,
pub provenance_bytes: std::string::String,
pub intoto_provenance: std::option::Option<crate::model::InTotoProvenance>,
pub intoto_statement: std::option::Option<crate::model::InTotoStatement>,
pub in_toto_slsa_provenance_v1: std::option::Option<crate::model::InTotoSlsaProvenanceV1>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BuildOccurrence {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_provenance<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::BuildProvenance>,
{
self.provenance = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::BuildProvenance>,
{
self.provenance = v.map(|x| x.into());
self
}
pub fn set_provenance_bytes<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.provenance_bytes = v.into();
self
}
pub fn set_intoto_provenance<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::InTotoProvenance>,
{
self.intoto_provenance = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_intoto_provenance<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::InTotoProvenance>,
{
self.intoto_provenance = v.map(|x| x.into());
self
}
pub fn set_intoto_statement<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::InTotoStatement>,
{
self.intoto_statement = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_intoto_statement<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::InTotoStatement>,
{
self.intoto_statement = v.map(|x| x.into());
self
}
pub fn set_in_toto_slsa_provenance_v1<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::InTotoSlsaProvenanceV1>,
{
self.in_toto_slsa_provenance_v1 = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_in_toto_slsa_provenance_v1<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::InTotoSlsaProvenanceV1>,
{
self.in_toto_slsa_provenance_v1 = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for BuildOccurrence {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.BuildOccurrence"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RelatedUrl {
pub url: std::string::String,
pub label: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RelatedUrl {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.url = v.into();
self
}
pub fn set_label<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.label = v.into();
self
}
}
impl wkt::message::Message for RelatedUrl {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.RelatedUrl"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Signature {
pub signature: ::bytes::Bytes,
pub public_key_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Signature {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_signature<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.signature = v.into();
self
}
pub fn set_public_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.public_key_id = v.into();
self
}
}
impl wkt::message::Message for Signature {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.Signature"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Envelope {
#[allow(missing_docs)]
pub payload: ::bytes::Bytes,
#[allow(missing_docs)]
pub payload_type: std::string::String,
#[allow(missing_docs)]
pub signatures: std::vec::Vec<crate::model::EnvelopeSignature>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Envelope {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_payload<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.payload = v.into();
self
}
pub fn set_payload_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.payload_type = v.into();
self
}
pub fn set_signatures<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::EnvelopeSignature>,
{
use std::iter::Iterator;
self.signatures = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for Envelope {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.Envelope"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EnvelopeSignature {
#[allow(missing_docs)]
pub sig: ::bytes::Bytes,
#[allow(missing_docs)]
pub keyid: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl EnvelopeSignature {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_sig<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.sig = v.into();
self
}
pub fn set_keyid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.keyid = v.into();
self
}
}
impl wkt::message::Message for EnvelopeSignature {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.EnvelopeSignature"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FileLocation {
pub file_path: std::string::String,
pub layer_details: std::option::Option<crate::model::LayerDetails>,
pub line_number: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FileLocation {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_file_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.file_path = v.into();
self
}
pub fn set_layer_details<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::LayerDetails>,
{
self.layer_details = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_layer_details<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::LayerDetails>,
{
self.layer_details = v.map(|x| x.into());
self
}
pub fn set_line_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.line_number = v.into();
self
}
}
impl wkt::message::Message for FileLocation {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.FileLocation"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BaseImage {
pub name: std::string::String,
pub repository: std::string::String,
pub layer_count: i32,
pub registry: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BaseImage {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.repository = v.into();
self
}
pub fn set_layer_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.layer_count = v.into();
self
}
pub fn set_registry<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.registry = v.into();
self
}
}
impl wkt::message::Message for BaseImage {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.BaseImage"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LayerDetails {
pub index: i32,
pub diff_id: std::string::String,
pub chain_id: std::string::String,
pub command: std::string::String,
pub base_images: std::vec::Vec<crate::model::BaseImage>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl LayerDetails {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.index = v.into();
self
}
pub fn set_diff_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.diff_id = v.into();
self
}
pub fn set_chain_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.chain_id = v.into();
self
}
pub fn set_command<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.command = v.into();
self
}
pub fn set_base_images<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::BaseImage>,
{
use std::iter::Iterator;
self.base_images = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for LayerDetails {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.LayerDetails"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct License {
pub expression: std::string::String,
pub comments: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl License {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_expression<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.expression = v.into();
self
}
pub fn set_comments<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.comments = v.into();
self
}
}
impl wkt::message::Message for License {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.License"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Digest {
pub algo: std::string::String,
pub digest_bytes: ::bytes::Bytes,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Digest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_algo<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.algo = v.into();
self
}
pub fn set_digest_bytes<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.digest_bytes = v.into();
self
}
}
impl wkt::message::Message for Digest {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.Digest"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ComplianceNote {
pub title: std::string::String,
pub description: std::string::String,
pub version: std::vec::Vec<crate::model::ComplianceVersion>,
pub rationale: std::string::String,
pub remediation: std::string::String,
pub scan_instructions: ::bytes::Bytes,
#[allow(missing_docs)]
pub compliance_type: std::option::Option<crate::model::compliance_note::ComplianceType>,
pub potential_impact: std::option::Option<crate::model::compliance_note::PotentialImpact>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ComplianceNote {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.title = v.into();
self
}
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
pub fn set_version<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ComplianceVersion>,
{
use std::iter::Iterator;
self.version = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_rationale<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.rationale = v.into();
self
}
pub fn set_remediation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.remediation = v.into();
self
}
pub fn set_scan_instructions<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.scan_instructions = v.into();
self
}
pub fn set_compliance_type<
T: std::convert::Into<std::option::Option<crate::model::compliance_note::ComplianceType>>,
>(
mut self,
v: T,
) -> Self {
self.compliance_type = v.into();
self
}
pub fn cis_benchmark(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::compliance_note::CisBenchmark>> {
#[allow(unreachable_patterns)]
self.compliance_type.as_ref().and_then(|v| match v {
crate::model::compliance_note::ComplianceType::CisBenchmark(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_cis_benchmark<
T: std::convert::Into<std::boxed::Box<crate::model::compliance_note::CisBenchmark>>,
>(
mut self,
v: T,
) -> Self {
self.compliance_type = std::option::Option::Some(
crate::model::compliance_note::ComplianceType::CisBenchmark(v.into()),
);
self
}
pub fn set_potential_impact<
T: std::convert::Into<std::option::Option<crate::model::compliance_note::PotentialImpact>>,
>(
mut self,
v: T,
) -> Self {
self.potential_impact = v.into();
self
}
pub fn impact(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.potential_impact.as_ref().and_then(|v| match v {
crate::model::compliance_note::PotentialImpact::Impact(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_impact<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.potential_impact = std::option::Option::Some(
crate::model::compliance_note::PotentialImpact::Impact(v.into()),
);
self
}
}
impl wkt::message::Message for ComplianceNote {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.ComplianceNote"
}
}
pub mod compliance_note {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CisBenchmark {
#[allow(missing_docs)]
pub profile_level: i32,
#[allow(missing_docs)]
pub severity: crate::model::Severity,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CisBenchmark {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_profile_level<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.profile_level = v.into();
self
}
pub fn set_severity<T: std::convert::Into<crate::model::Severity>>(mut self, v: T) -> Self {
self.severity = v.into();
self
}
}
impl wkt::message::Message for CisBenchmark {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.ComplianceNote.CisBenchmark"
}
}
#[allow(missing_docs)]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ComplianceType {
#[allow(missing_docs)]
CisBenchmark(std::boxed::Box<crate::model::compliance_note::CisBenchmark>),
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum PotentialImpact {
#[allow(missing_docs)]
Impact(std::string::String),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ComplianceVersion {
pub cpe_uri: std::string::String,
pub benchmark_document: std::string::String,
pub version: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ComplianceVersion {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_cpe_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.cpe_uri = v.into();
self
}
pub fn set_benchmark_document<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.benchmark_document = v.into();
self
}
pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.version = v.into();
self
}
}
impl wkt::message::Message for ComplianceVersion {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.ComplianceVersion"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ComplianceOccurrence {
#[allow(missing_docs)]
pub non_compliant_files: std::vec::Vec<crate::model::NonCompliantFile>,
#[allow(missing_docs)]
pub non_compliance_reason: std::string::String,
pub version: std::option::Option<crate::model::ComplianceVersion>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ComplianceOccurrence {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_non_compliant_files<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::NonCompliantFile>,
{
use std::iter::Iterator;
self.non_compliant_files = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_non_compliance_reason<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.non_compliance_reason = v.into();
self
}
pub fn set_version<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ComplianceVersion>,
{
self.version = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ComplianceVersion>,
{
self.version = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ComplianceOccurrence {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.ComplianceOccurrence"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct NonCompliantFile {
pub path: std::string::String,
pub display_command: std::string::String,
pub reason: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl NonCompliantFile {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.path = v.into();
self
}
pub fn set_display_command<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_command = v.into();
self
}
pub fn set_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.reason = v.into();
self
}
}
impl wkt::message::Message for NonCompliantFile {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.NonCompliantFile"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CVSSv3 {
pub base_score: f32,
#[allow(missing_docs)]
pub exploitability_score: f32,
#[allow(missing_docs)]
pub impact_score: f32,
pub attack_vector: crate::model::cvs_sv_3::AttackVector,
#[allow(missing_docs)]
pub attack_complexity: crate::model::cvs_sv_3::AttackComplexity,
#[allow(missing_docs)]
pub privileges_required: crate::model::cvs_sv_3::PrivilegesRequired,
#[allow(missing_docs)]
pub user_interaction: crate::model::cvs_sv_3::UserInteraction,
#[allow(missing_docs)]
pub scope: crate::model::cvs_sv_3::Scope,
#[allow(missing_docs)]
pub confidentiality_impact: crate::model::cvs_sv_3::Impact,
#[allow(missing_docs)]
pub integrity_impact: crate::model::cvs_sv_3::Impact,
#[allow(missing_docs)]
pub availability_impact: crate::model::cvs_sv_3::Impact,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CVSSv3 {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_base_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.base_score = v.into();
self
}
pub fn set_exploitability_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.exploitability_score = v.into();
self
}
pub fn set_impact_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.impact_score = v.into();
self
}
pub fn set_attack_vector<T: std::convert::Into<crate::model::cvs_sv_3::AttackVector>>(
mut self,
v: T,
) -> Self {
self.attack_vector = v.into();
self
}
pub fn set_attack_complexity<
T: std::convert::Into<crate::model::cvs_sv_3::AttackComplexity>,
>(
mut self,
v: T,
) -> Self {
self.attack_complexity = v.into();
self
}
pub fn set_privileges_required<
T: std::convert::Into<crate::model::cvs_sv_3::PrivilegesRequired>,
>(
mut self,
v: T,
) -> Self {
self.privileges_required = v.into();
self
}
pub fn set_user_interaction<T: std::convert::Into<crate::model::cvs_sv_3::UserInteraction>>(
mut self,
v: T,
) -> Self {
self.user_interaction = v.into();
self
}
pub fn set_scope<T: std::convert::Into<crate::model::cvs_sv_3::Scope>>(mut self, v: T) -> Self {
self.scope = v.into();
self
}
pub fn set_confidentiality_impact<T: std::convert::Into<crate::model::cvs_sv_3::Impact>>(
mut self,
v: T,
) -> Self {
self.confidentiality_impact = v.into();
self
}
pub fn set_integrity_impact<T: std::convert::Into<crate::model::cvs_sv_3::Impact>>(
mut self,
v: T,
) -> Self {
self.integrity_impact = v.into();
self
}
pub fn set_availability_impact<T: std::convert::Into<crate::model::cvs_sv_3::Impact>>(
mut self,
v: T,
) -> Self {
self.availability_impact = v.into();
self
}
}
impl wkt::message::Message for CVSSv3 {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.CVSSv3"
}
}
pub mod cvs_sv_3 {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AttackVector {
#[allow(missing_docs)]
Unspecified,
#[allow(missing_docs)]
Network,
#[allow(missing_docs)]
Adjacent,
#[allow(missing_docs)]
Local,
#[allow(missing_docs)]
Physical,
UnknownValue(attack_vector::UnknownValue),
}
#[doc(hidden)]
pub mod attack_vector {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl AttackVector {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Network => std::option::Option::Some(1),
Self::Adjacent => std::option::Option::Some(2),
Self::Local => std::option::Option::Some(3),
Self::Physical => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ATTACK_VECTOR_UNSPECIFIED"),
Self::Network => std::option::Option::Some("ATTACK_VECTOR_NETWORK"),
Self::Adjacent => std::option::Option::Some("ATTACK_VECTOR_ADJACENT"),
Self::Local => std::option::Option::Some("ATTACK_VECTOR_LOCAL"),
Self::Physical => std::option::Option::Some("ATTACK_VECTOR_PHYSICAL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for AttackVector {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for AttackVector {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for AttackVector {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Network,
2 => Self::Adjacent,
3 => Self::Local,
4 => Self::Physical,
_ => Self::UnknownValue(attack_vector::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for AttackVector {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ATTACK_VECTOR_UNSPECIFIED" => Self::Unspecified,
"ATTACK_VECTOR_NETWORK" => Self::Network,
"ATTACK_VECTOR_ADJACENT" => Self::Adjacent,
"ATTACK_VECTOR_LOCAL" => Self::Local,
"ATTACK_VECTOR_PHYSICAL" => Self::Physical,
_ => Self::UnknownValue(attack_vector::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for AttackVector {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Network => serializer.serialize_i32(1),
Self::Adjacent => serializer.serialize_i32(2),
Self::Local => serializer.serialize_i32(3),
Self::Physical => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for AttackVector {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttackVector>::new(
".grafeas.v1.CVSSv3.AttackVector",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AttackComplexity {
#[allow(missing_docs)]
Unspecified,
#[allow(missing_docs)]
Low,
#[allow(missing_docs)]
High,
UnknownValue(attack_complexity::UnknownValue),
}
#[doc(hidden)]
pub mod attack_complexity {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl AttackComplexity {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Low => std::option::Option::Some(1),
Self::High => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ATTACK_COMPLEXITY_UNSPECIFIED"),
Self::Low => std::option::Option::Some("ATTACK_COMPLEXITY_LOW"),
Self::High => std::option::Option::Some("ATTACK_COMPLEXITY_HIGH"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for AttackComplexity {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for AttackComplexity {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for AttackComplexity {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Low,
2 => Self::High,
_ => Self::UnknownValue(attack_complexity::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for AttackComplexity {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ATTACK_COMPLEXITY_UNSPECIFIED" => Self::Unspecified,
"ATTACK_COMPLEXITY_LOW" => Self::Low,
"ATTACK_COMPLEXITY_HIGH" => Self::High,
_ => Self::UnknownValue(attack_complexity::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for AttackComplexity {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Low => serializer.serialize_i32(1),
Self::High => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for AttackComplexity {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttackComplexity>::new(
".grafeas.v1.CVSSv3.AttackComplexity",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum PrivilegesRequired {
#[allow(missing_docs)]
Unspecified,
#[allow(missing_docs)]
None,
#[allow(missing_docs)]
Low,
#[allow(missing_docs)]
High,
UnknownValue(privileges_required::UnknownValue),
}
#[doc(hidden)]
pub mod privileges_required {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl PrivilegesRequired {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::None => std::option::Option::Some(1),
Self::Low => std::option::Option::Some(2),
Self::High => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("PRIVILEGES_REQUIRED_UNSPECIFIED"),
Self::None => std::option::Option::Some("PRIVILEGES_REQUIRED_NONE"),
Self::Low => std::option::Option::Some("PRIVILEGES_REQUIRED_LOW"),
Self::High => std::option::Option::Some("PRIVILEGES_REQUIRED_HIGH"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for PrivilegesRequired {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for PrivilegesRequired {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for PrivilegesRequired {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::None,
2 => Self::Low,
3 => Self::High,
_ => Self::UnknownValue(privileges_required::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for PrivilegesRequired {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"PRIVILEGES_REQUIRED_UNSPECIFIED" => Self::Unspecified,
"PRIVILEGES_REQUIRED_NONE" => Self::None,
"PRIVILEGES_REQUIRED_LOW" => Self::Low,
"PRIVILEGES_REQUIRED_HIGH" => Self::High,
_ => Self::UnknownValue(privileges_required::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for PrivilegesRequired {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::None => serializer.serialize_i32(1),
Self::Low => serializer.serialize_i32(2),
Self::High => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for PrivilegesRequired {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<PrivilegesRequired>::new(
".grafeas.v1.CVSSv3.PrivilegesRequired",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum UserInteraction {
#[allow(missing_docs)]
Unspecified,
#[allow(missing_docs)]
None,
#[allow(missing_docs)]
Required,
UnknownValue(user_interaction::UnknownValue),
}
#[doc(hidden)]
pub mod user_interaction {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl UserInteraction {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::None => std::option::Option::Some(1),
Self::Required => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("USER_INTERACTION_UNSPECIFIED"),
Self::None => std::option::Option::Some("USER_INTERACTION_NONE"),
Self::Required => std::option::Option::Some("USER_INTERACTION_REQUIRED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for UserInteraction {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for UserInteraction {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for UserInteraction {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::None,
2 => Self::Required,
_ => Self::UnknownValue(user_interaction::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for UserInteraction {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"USER_INTERACTION_UNSPECIFIED" => Self::Unspecified,
"USER_INTERACTION_NONE" => Self::None,
"USER_INTERACTION_REQUIRED" => Self::Required,
_ => Self::UnknownValue(user_interaction::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for UserInteraction {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::None => serializer.serialize_i32(1),
Self::Required => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for UserInteraction {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<UserInteraction>::new(
".grafeas.v1.CVSSv3.UserInteraction",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Scope {
#[allow(missing_docs)]
Unspecified,
#[allow(missing_docs)]
Unchanged,
#[allow(missing_docs)]
Changed,
UnknownValue(scope::UnknownValue),
}
#[doc(hidden)]
pub mod scope {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Scope {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Unchanged => std::option::Option::Some(1),
Self::Changed => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SCOPE_UNSPECIFIED"),
Self::Unchanged => std::option::Option::Some("SCOPE_UNCHANGED"),
Self::Changed => std::option::Option::Some("SCOPE_CHANGED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Scope {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Scope {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Scope {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Unchanged,
2 => Self::Changed,
_ => Self::UnknownValue(scope::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Scope {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SCOPE_UNSPECIFIED" => Self::Unspecified,
"SCOPE_UNCHANGED" => Self::Unchanged,
"SCOPE_CHANGED" => Self::Changed,
_ => Self::UnknownValue(scope::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Scope {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Unchanged => serializer.serialize_i32(1),
Self::Changed => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Scope {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Scope>::new(
".grafeas.v1.CVSSv3.Scope",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Impact {
#[allow(missing_docs)]
Unspecified,
#[allow(missing_docs)]
High,
#[allow(missing_docs)]
Low,
#[allow(missing_docs)]
None,
UnknownValue(impact::UnknownValue),
}
#[doc(hidden)]
pub mod impact {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Impact {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::High => std::option::Option::Some(1),
Self::Low => std::option::Option::Some(2),
Self::None => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("IMPACT_UNSPECIFIED"),
Self::High => std::option::Option::Some("IMPACT_HIGH"),
Self::Low => std::option::Option::Some("IMPACT_LOW"),
Self::None => std::option::Option::Some("IMPACT_NONE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Impact {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Impact {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Impact {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::High,
2 => Self::Low,
3 => Self::None,
_ => Self::UnknownValue(impact::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Impact {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"IMPACT_UNSPECIFIED" => Self::Unspecified,
"IMPACT_HIGH" => Self::High,
"IMPACT_LOW" => Self::Low,
"IMPACT_NONE" => Self::None,
_ => Self::UnknownValue(impact::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Impact {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::High => serializer.serialize_i32(1),
Self::Low => serializer.serialize_i32(2),
Self::None => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Impact {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Impact>::new(
".grafeas.v1.CVSSv3.Impact",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Cvss {
pub base_score: f32,
#[allow(missing_docs)]
pub exploitability_score: f32,
#[allow(missing_docs)]
pub impact_score: f32,
pub attack_vector: crate::model::cvss::AttackVector,
#[allow(missing_docs)]
pub attack_complexity: crate::model::cvss::AttackComplexity,
#[allow(missing_docs)]
pub authentication: crate::model::cvss::Authentication,
#[allow(missing_docs)]
pub privileges_required: crate::model::cvss::PrivilegesRequired,
#[allow(missing_docs)]
pub user_interaction: crate::model::cvss::UserInteraction,
#[allow(missing_docs)]
pub scope: crate::model::cvss::Scope,
#[allow(missing_docs)]
pub confidentiality_impact: crate::model::cvss::Impact,
#[allow(missing_docs)]
pub integrity_impact: crate::model::cvss::Impact,
#[allow(missing_docs)]
pub availability_impact: crate::model::cvss::Impact,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Cvss {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_base_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.base_score = v.into();
self
}
pub fn set_exploitability_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.exploitability_score = v.into();
self
}
pub fn set_impact_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.impact_score = v.into();
self
}
pub fn set_attack_vector<T: std::convert::Into<crate::model::cvss::AttackVector>>(
mut self,
v: T,
) -> Self {
self.attack_vector = v.into();
self
}
pub fn set_attack_complexity<T: std::convert::Into<crate::model::cvss::AttackComplexity>>(
mut self,
v: T,
) -> Self {
self.attack_complexity = v.into();
self
}
pub fn set_authentication<T: std::convert::Into<crate::model::cvss::Authentication>>(
mut self,
v: T,
) -> Self {
self.authentication = v.into();
self
}
pub fn set_privileges_required<
T: std::convert::Into<crate::model::cvss::PrivilegesRequired>,
>(
mut self,
v: T,
) -> Self {
self.privileges_required = v.into();
self
}
pub fn set_user_interaction<T: std::convert::Into<crate::model::cvss::UserInteraction>>(
mut self,
v: T,
) -> Self {
self.user_interaction = v.into();
self
}
pub fn set_scope<T: std::convert::Into<crate::model::cvss::Scope>>(mut self, v: T) -> Self {
self.scope = v.into();
self
}
pub fn set_confidentiality_impact<T: std::convert::Into<crate::model::cvss::Impact>>(
mut self,
v: T,
) -> Self {
self.confidentiality_impact = v.into();
self
}
pub fn set_integrity_impact<T: std::convert::Into<crate::model::cvss::Impact>>(
mut self,
v: T,
) -> Self {
self.integrity_impact = v.into();
self
}
pub fn set_availability_impact<T: std::convert::Into<crate::model::cvss::Impact>>(
mut self,
v: T,
) -> Self {
self.availability_impact = v.into();
self
}
}
impl wkt::message::Message for Cvss {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.CVSS"
}
}
pub mod cvss {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AttackVector {
#[allow(missing_docs)]
Unspecified,
#[allow(missing_docs)]
Network,
#[allow(missing_docs)]
Adjacent,
#[allow(missing_docs)]
Local,
#[allow(missing_docs)]
Physical,
UnknownValue(attack_vector::UnknownValue),
}
#[doc(hidden)]
pub mod attack_vector {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl AttackVector {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Network => std::option::Option::Some(1),
Self::Adjacent => std::option::Option::Some(2),
Self::Local => std::option::Option::Some(3),
Self::Physical => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ATTACK_VECTOR_UNSPECIFIED"),
Self::Network => std::option::Option::Some("ATTACK_VECTOR_NETWORK"),
Self::Adjacent => std::option::Option::Some("ATTACK_VECTOR_ADJACENT"),
Self::Local => std::option::Option::Some("ATTACK_VECTOR_LOCAL"),
Self::Physical => std::option::Option::Some("ATTACK_VECTOR_PHYSICAL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for AttackVector {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for AttackVector {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for AttackVector {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Network,
2 => Self::Adjacent,
3 => Self::Local,
4 => Self::Physical,
_ => Self::UnknownValue(attack_vector::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for AttackVector {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ATTACK_VECTOR_UNSPECIFIED" => Self::Unspecified,
"ATTACK_VECTOR_NETWORK" => Self::Network,
"ATTACK_VECTOR_ADJACENT" => Self::Adjacent,
"ATTACK_VECTOR_LOCAL" => Self::Local,
"ATTACK_VECTOR_PHYSICAL" => Self::Physical,
_ => Self::UnknownValue(attack_vector::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for AttackVector {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Network => serializer.serialize_i32(1),
Self::Adjacent => serializer.serialize_i32(2),
Self::Local => serializer.serialize_i32(3),
Self::Physical => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for AttackVector {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttackVector>::new(
".grafeas.v1.CVSS.AttackVector",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AttackComplexity {
#[allow(missing_docs)]
Unspecified,
#[allow(missing_docs)]
Low,
#[allow(missing_docs)]
High,
#[allow(missing_docs)]
Medium,
UnknownValue(attack_complexity::UnknownValue),
}
#[doc(hidden)]
pub mod attack_complexity {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl AttackComplexity {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Low => std::option::Option::Some(1),
Self::High => std::option::Option::Some(2),
Self::Medium => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ATTACK_COMPLEXITY_UNSPECIFIED"),
Self::Low => std::option::Option::Some("ATTACK_COMPLEXITY_LOW"),
Self::High => std::option::Option::Some("ATTACK_COMPLEXITY_HIGH"),
Self::Medium => std::option::Option::Some("ATTACK_COMPLEXITY_MEDIUM"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for AttackComplexity {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for AttackComplexity {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for AttackComplexity {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Low,
2 => Self::High,
3 => Self::Medium,
_ => Self::UnknownValue(attack_complexity::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for AttackComplexity {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ATTACK_COMPLEXITY_UNSPECIFIED" => Self::Unspecified,
"ATTACK_COMPLEXITY_LOW" => Self::Low,
"ATTACK_COMPLEXITY_HIGH" => Self::High,
"ATTACK_COMPLEXITY_MEDIUM" => Self::Medium,
_ => Self::UnknownValue(attack_complexity::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for AttackComplexity {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Low => serializer.serialize_i32(1),
Self::High => serializer.serialize_i32(2),
Self::Medium => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for AttackComplexity {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttackComplexity>::new(
".grafeas.v1.CVSS.AttackComplexity",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Authentication {
#[allow(missing_docs)]
Unspecified,
#[allow(missing_docs)]
Multiple,
#[allow(missing_docs)]
Single,
#[allow(missing_docs)]
None,
UnknownValue(authentication::UnknownValue),
}
#[doc(hidden)]
pub mod authentication {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Authentication {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Multiple => std::option::Option::Some(1),
Self::Single => std::option::Option::Some(2),
Self::None => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("AUTHENTICATION_UNSPECIFIED"),
Self::Multiple => std::option::Option::Some("AUTHENTICATION_MULTIPLE"),
Self::Single => std::option::Option::Some("AUTHENTICATION_SINGLE"),
Self::None => std::option::Option::Some("AUTHENTICATION_NONE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Authentication {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Authentication {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Authentication {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Multiple,
2 => Self::Single,
3 => Self::None,
_ => Self::UnknownValue(authentication::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Authentication {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"AUTHENTICATION_UNSPECIFIED" => Self::Unspecified,
"AUTHENTICATION_MULTIPLE" => Self::Multiple,
"AUTHENTICATION_SINGLE" => Self::Single,
"AUTHENTICATION_NONE" => Self::None,
_ => Self::UnknownValue(authentication::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Authentication {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Multiple => serializer.serialize_i32(1),
Self::Single => serializer.serialize_i32(2),
Self::None => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Authentication {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Authentication>::new(
".grafeas.v1.CVSS.Authentication",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum PrivilegesRequired {
#[allow(missing_docs)]
Unspecified,
#[allow(missing_docs)]
None,
#[allow(missing_docs)]
Low,
#[allow(missing_docs)]
High,
UnknownValue(privileges_required::UnknownValue),
}
#[doc(hidden)]
pub mod privileges_required {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl PrivilegesRequired {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::None => std::option::Option::Some(1),
Self::Low => std::option::Option::Some(2),
Self::High => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("PRIVILEGES_REQUIRED_UNSPECIFIED"),
Self::None => std::option::Option::Some("PRIVILEGES_REQUIRED_NONE"),
Self::Low => std::option::Option::Some("PRIVILEGES_REQUIRED_LOW"),
Self::High => std::option::Option::Some("PRIVILEGES_REQUIRED_HIGH"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for PrivilegesRequired {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for PrivilegesRequired {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for PrivilegesRequired {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::None,
2 => Self::Low,
3 => Self::High,
_ => Self::UnknownValue(privileges_required::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for PrivilegesRequired {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"PRIVILEGES_REQUIRED_UNSPECIFIED" => Self::Unspecified,
"PRIVILEGES_REQUIRED_NONE" => Self::None,
"PRIVILEGES_REQUIRED_LOW" => Self::Low,
"PRIVILEGES_REQUIRED_HIGH" => Self::High,
_ => Self::UnknownValue(privileges_required::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for PrivilegesRequired {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::None => serializer.serialize_i32(1),
Self::Low => serializer.serialize_i32(2),
Self::High => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for PrivilegesRequired {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<PrivilegesRequired>::new(
".grafeas.v1.CVSS.PrivilegesRequired",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum UserInteraction {
#[allow(missing_docs)]
Unspecified,
#[allow(missing_docs)]
None,
#[allow(missing_docs)]
Required,
UnknownValue(user_interaction::UnknownValue),
}
#[doc(hidden)]
pub mod user_interaction {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl UserInteraction {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::None => std::option::Option::Some(1),
Self::Required => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("USER_INTERACTION_UNSPECIFIED"),
Self::None => std::option::Option::Some("USER_INTERACTION_NONE"),
Self::Required => std::option::Option::Some("USER_INTERACTION_REQUIRED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for UserInteraction {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for UserInteraction {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for UserInteraction {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::None,
2 => Self::Required,
_ => Self::UnknownValue(user_interaction::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for UserInteraction {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"USER_INTERACTION_UNSPECIFIED" => Self::Unspecified,
"USER_INTERACTION_NONE" => Self::None,
"USER_INTERACTION_REQUIRED" => Self::Required,
_ => Self::UnknownValue(user_interaction::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for UserInteraction {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::None => serializer.serialize_i32(1),
Self::Required => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for UserInteraction {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<UserInteraction>::new(
".grafeas.v1.CVSS.UserInteraction",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Scope {
#[allow(missing_docs)]
Unspecified,
#[allow(missing_docs)]
Unchanged,
#[allow(missing_docs)]
Changed,
UnknownValue(scope::UnknownValue),
}
#[doc(hidden)]
pub mod scope {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Scope {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Unchanged => std::option::Option::Some(1),
Self::Changed => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SCOPE_UNSPECIFIED"),
Self::Unchanged => std::option::Option::Some("SCOPE_UNCHANGED"),
Self::Changed => std::option::Option::Some("SCOPE_CHANGED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Scope {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Scope {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Scope {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Unchanged,
2 => Self::Changed,
_ => Self::UnknownValue(scope::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Scope {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SCOPE_UNSPECIFIED" => Self::Unspecified,
"SCOPE_UNCHANGED" => Self::Unchanged,
"SCOPE_CHANGED" => Self::Changed,
_ => Self::UnknownValue(scope::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Scope {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Unchanged => serializer.serialize_i32(1),
Self::Changed => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Scope {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Scope>::new(
".grafeas.v1.CVSS.Scope",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Impact {
#[allow(missing_docs)]
Unspecified,
#[allow(missing_docs)]
High,
#[allow(missing_docs)]
Low,
#[allow(missing_docs)]
None,
#[allow(missing_docs)]
Partial,
#[allow(missing_docs)]
Complete,
UnknownValue(impact::UnknownValue),
}
#[doc(hidden)]
pub mod impact {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Impact {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::High => std::option::Option::Some(1),
Self::Low => std::option::Option::Some(2),
Self::None => std::option::Option::Some(3),
Self::Partial => std::option::Option::Some(4),
Self::Complete => std::option::Option::Some(5),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("IMPACT_UNSPECIFIED"),
Self::High => std::option::Option::Some("IMPACT_HIGH"),
Self::Low => std::option::Option::Some("IMPACT_LOW"),
Self::None => std::option::Option::Some("IMPACT_NONE"),
Self::Partial => std::option::Option::Some("IMPACT_PARTIAL"),
Self::Complete => std::option::Option::Some("IMPACT_COMPLETE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Impact {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Impact {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Impact {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::High,
2 => Self::Low,
3 => Self::None,
4 => Self::Partial,
5 => Self::Complete,
_ => Self::UnknownValue(impact::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Impact {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"IMPACT_UNSPECIFIED" => Self::Unspecified,
"IMPACT_HIGH" => Self::High,
"IMPACT_LOW" => Self::Low,
"IMPACT_NONE" => Self::None,
"IMPACT_PARTIAL" => Self::Partial,
"IMPACT_COMPLETE" => Self::Complete,
_ => Self::UnknownValue(impact::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Impact {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::High => serializer.serialize_i32(1),
Self::Low => serializer.serialize_i32(2),
Self::None => serializer.serialize_i32(3),
Self::Partial => serializer.serialize_i32(4),
Self::Complete => serializer.serialize_i32(5),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Impact {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Impact>::new(
".grafeas.v1.CVSS.Impact",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeploymentNote {
pub resource_uri: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeploymentNote {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_resource_uri<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.resource_uri = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for DeploymentNote {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.DeploymentNote"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeploymentOccurrence {
pub user_email: std::string::String,
pub deploy_time: std::option::Option<wkt::Timestamp>,
pub undeploy_time: std::option::Option<wkt::Timestamp>,
pub config: std::string::String,
pub address: std::string::String,
pub resource_uri: std::vec::Vec<std::string::String>,
pub platform: crate::model::deployment_occurrence::Platform,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeploymentOccurrence {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_user_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.user_email = v.into();
self
}
pub fn set_deploy_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.deploy_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_deploy_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.deploy_time = v.map(|x| x.into());
self
}
pub fn set_undeploy_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.undeploy_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_undeploy_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.undeploy_time = v.map(|x| x.into());
self
}
pub fn set_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.config = v.into();
self
}
pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.address = v.into();
self
}
pub fn set_resource_uri<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.resource_uri = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_platform<T: std::convert::Into<crate::model::deployment_occurrence::Platform>>(
mut self,
v: T,
) -> Self {
self.platform = v.into();
self
}
}
impl wkt::message::Message for DeploymentOccurrence {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.DeploymentOccurrence"
}
}
pub mod deployment_occurrence {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Platform {
Unspecified,
Gke,
Flex,
Custom,
UnknownValue(platform::UnknownValue),
}
#[doc(hidden)]
pub mod platform {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Platform {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Gke => std::option::Option::Some(1),
Self::Flex => std::option::Option::Some(2),
Self::Custom => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("PLATFORM_UNSPECIFIED"),
Self::Gke => std::option::Option::Some("GKE"),
Self::Flex => std::option::Option::Some("FLEX"),
Self::Custom => std::option::Option::Some("CUSTOM"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Platform {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Platform {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Platform {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Gke,
2 => Self::Flex,
3 => Self::Custom,
_ => Self::UnknownValue(platform::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Platform {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"PLATFORM_UNSPECIFIED" => Self::Unspecified,
"GKE" => Self::Gke,
"FLEX" => Self::Flex,
"CUSTOM" => Self::Custom,
_ => Self::UnknownValue(platform::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Platform {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Gke => serializer.serialize_i32(1),
Self::Flex => serializer.serialize_i32(2),
Self::Custom => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Platform {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Platform>::new(
".grafeas.v1.DeploymentOccurrence.Platform",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DiscoveryNote {
pub analysis_kind: crate::model::NoteKind,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DiscoveryNote {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_analysis_kind<T: std::convert::Into<crate::model::NoteKind>>(
mut self,
v: T,
) -> Self {
self.analysis_kind = v.into();
self
}
}
impl wkt::message::Message for DiscoveryNote {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.DiscoveryNote"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DiscoveryOccurrence {
pub continuous_analysis: crate::model::discovery_occurrence::ContinuousAnalysis,
pub analysis_status: crate::model::discovery_occurrence::AnalysisStatus,
#[allow(missing_docs)]
pub analysis_completed:
std::option::Option<crate::model::discovery_occurrence::AnalysisCompleted>,
pub analysis_error: std::vec::Vec<google_cloud_rpc::model::Status>,
pub analysis_status_error: std::option::Option<google_cloud_rpc::model::Status>,
pub cpe: std::string::String,
pub last_scan_time: std::option::Option<wkt::Timestamp>,
pub archive_time: std::option::Option<wkt::Timestamp>,
pub sbom_status: std::option::Option<crate::model::discovery_occurrence::SBOMStatus>,
pub vulnerability_attestation:
std::option::Option<crate::model::discovery_occurrence::VulnerabilityAttestation>,
pub files: std::vec::Vec<crate::model::discovery_occurrence::File>,
pub last_vulnerability_update_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DiscoveryOccurrence {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_continuous_analysis<
T: std::convert::Into<crate::model::discovery_occurrence::ContinuousAnalysis>,
>(
mut self,
v: T,
) -> Self {
self.continuous_analysis = v.into();
self
}
pub fn set_analysis_status<
T: std::convert::Into<crate::model::discovery_occurrence::AnalysisStatus>,
>(
mut self,
v: T,
) -> Self {
self.analysis_status = v.into();
self
}
pub fn set_analysis_completed<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::discovery_occurrence::AnalysisCompleted>,
{
self.analysis_completed = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_analysis_completed<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::discovery_occurrence::AnalysisCompleted>,
{
self.analysis_completed = v.map(|x| x.into());
self
}
pub fn set_analysis_error<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<google_cloud_rpc::model::Status>,
{
use std::iter::Iterator;
self.analysis_error = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_analysis_status_error<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.analysis_status_error = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_analysis_status_error<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.analysis_status_error = v.map(|x| x.into());
self
}
pub fn set_cpe<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.cpe = v.into();
self
}
pub fn set_last_scan_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.last_scan_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_last_scan_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.last_scan_time = v.map(|x| x.into());
self
}
pub fn set_archive_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.archive_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_archive_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.archive_time = v.map(|x| x.into());
self
}
pub fn set_sbom_status<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::discovery_occurrence::SBOMStatus>,
{
self.sbom_status = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_sbom_status<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::discovery_occurrence::SBOMStatus>,
{
self.sbom_status = v.map(|x| x.into());
self
}
pub fn set_vulnerability_attestation<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::discovery_occurrence::VulnerabilityAttestation>,
{
self.vulnerability_attestation = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_vulnerability_attestation<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::discovery_occurrence::VulnerabilityAttestation>,
{
self.vulnerability_attestation = v.map(|x| x.into());
self
}
pub fn set_files<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::discovery_occurrence::File>,
{
use std::iter::Iterator;
self.files = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_last_vulnerability_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.last_vulnerability_update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_last_vulnerability_update_time<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.last_vulnerability_update_time = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for DiscoveryOccurrence {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.DiscoveryOccurrence"
}
}
pub mod discovery_occurrence {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AnalysisCompleted {
#[allow(missing_docs)]
pub analysis_type: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AnalysisCompleted {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_analysis_type<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.analysis_type = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for AnalysisCompleted {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.DiscoveryOccurrence.AnalysisCompleted"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SBOMStatus {
pub sbom_state: crate::model::discovery_occurrence::sbom_status::SBOMState,
pub error: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SBOMStatus {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_sbom_state<
T: std::convert::Into<crate::model::discovery_occurrence::sbom_status::SBOMState>,
>(
mut self,
v: T,
) -> Self {
self.sbom_state = v.into();
self
}
pub fn set_error<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.error = v.into();
self
}
}
impl wkt::message::Message for SBOMStatus {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.DiscoveryOccurrence.SBOMStatus"
}
}
pub mod sbom_status {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SBOMState {
Unspecified,
Pending,
Complete,
UnknownValue(sbom_state::UnknownValue),
}
#[doc(hidden)]
pub mod sbom_state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl SBOMState {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Pending => std::option::Option::Some(1),
Self::Complete => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SBOM_STATE_UNSPECIFIED"),
Self::Pending => std::option::Option::Some("PENDING"),
Self::Complete => std::option::Option::Some("COMPLETE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for SBOMState {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for SBOMState {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for SBOMState {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Pending,
2 => Self::Complete,
_ => Self::UnknownValue(sbom_state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for SBOMState {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SBOM_STATE_UNSPECIFIED" => Self::Unspecified,
"PENDING" => Self::Pending,
"COMPLETE" => Self::Complete,
_ => Self::UnknownValue(sbom_state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for SBOMState {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Pending => serializer.serialize_i32(1),
Self::Complete => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for SBOMState {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<SBOMState>::new(
".grafeas.v1.DiscoveryOccurrence.SBOMStatus.SBOMState",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct VulnerabilityAttestation {
pub last_attempt_time: std::option::Option<wkt::Timestamp>,
pub state: crate::model::discovery_occurrence::vulnerability_attestation::VulnerabilityAttestationState,
pub error: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl VulnerabilityAttestation {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_last_attempt_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.last_attempt_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_last_attempt_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.last_attempt_time = v.map(|x| x.into());
self
}
pub fn set_state<T: std::convert::Into<crate::model::discovery_occurrence::vulnerability_attestation::VulnerabilityAttestationState>>(mut self, v: T) -> Self{
self.state = v.into();
self
}
pub fn set_error<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.error = v.into();
self
}
}
impl wkt::message::Message for VulnerabilityAttestation {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.DiscoveryOccurrence.VulnerabilityAttestation"
}
}
pub mod vulnerability_attestation {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum VulnerabilityAttestationState {
Unspecified,
Success,
Failure,
UnknownValue(vulnerability_attestation_state::UnknownValue),
}
#[doc(hidden)]
pub mod vulnerability_attestation_state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl VulnerabilityAttestationState {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Success => std::option::Option::Some(1),
Self::Failure => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("VULNERABILITY_ATTESTATION_STATE_UNSPECIFIED")
}
Self::Success => std::option::Option::Some("SUCCESS"),
Self::Failure => std::option::Option::Some("FAILURE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for VulnerabilityAttestationState {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for VulnerabilityAttestationState {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for VulnerabilityAttestationState {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Success,
2 => Self::Failure,
_ => Self::UnknownValue(vulnerability_attestation_state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for VulnerabilityAttestationState {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"VULNERABILITY_ATTESTATION_STATE_UNSPECIFIED" => Self::Unspecified,
"SUCCESS" => Self::Success,
"FAILURE" => Self::Failure,
_ => Self::UnknownValue(vulnerability_attestation_state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for VulnerabilityAttestationState {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Success => serializer.serialize_i32(1),
Self::Failure => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for VulnerabilityAttestationState {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<VulnerabilityAttestationState>::new(
".grafeas.v1.DiscoveryOccurrence.VulnerabilityAttestation.VulnerabilityAttestationState"))
}
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct File {
#[allow(missing_docs)]
pub name: std::string::String,
#[allow(missing_docs)]
pub digest: std::collections::HashMap<std::string::String, std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl File {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_digest<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.digest = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for File {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.DiscoveryOccurrence.File"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ContinuousAnalysis {
Unspecified,
Active,
Inactive,
UnknownValue(continuous_analysis::UnknownValue),
}
#[doc(hidden)]
pub mod continuous_analysis {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ContinuousAnalysis {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Active => std::option::Option::Some(1),
Self::Inactive => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("CONTINUOUS_ANALYSIS_UNSPECIFIED"),
Self::Active => std::option::Option::Some("ACTIVE"),
Self::Inactive => std::option::Option::Some("INACTIVE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ContinuousAnalysis {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ContinuousAnalysis {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ContinuousAnalysis {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Active,
2 => Self::Inactive,
_ => Self::UnknownValue(continuous_analysis::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ContinuousAnalysis {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"CONTINUOUS_ANALYSIS_UNSPECIFIED" => Self::Unspecified,
"ACTIVE" => Self::Active,
"INACTIVE" => Self::Inactive,
_ => Self::UnknownValue(continuous_analysis::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ContinuousAnalysis {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Active => serializer.serialize_i32(1),
Self::Inactive => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ContinuousAnalysis {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ContinuousAnalysis>::new(
".grafeas.v1.DiscoveryOccurrence.ContinuousAnalysis",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AnalysisStatus {
Unspecified,
Pending,
Scanning,
FinishedSuccess,
Complete,
FinishedFailed,
FinishedUnsupported,
UnknownValue(analysis_status::UnknownValue),
}
#[doc(hidden)]
pub mod analysis_status {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl AnalysisStatus {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Pending => std::option::Option::Some(1),
Self::Scanning => std::option::Option::Some(2),
Self::FinishedSuccess => std::option::Option::Some(3),
Self::Complete => std::option::Option::Some(3),
Self::FinishedFailed => std::option::Option::Some(4),
Self::FinishedUnsupported => std::option::Option::Some(5),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ANALYSIS_STATUS_UNSPECIFIED"),
Self::Pending => std::option::Option::Some("PENDING"),
Self::Scanning => std::option::Option::Some("SCANNING"),
Self::FinishedSuccess => std::option::Option::Some("FINISHED_SUCCESS"),
Self::Complete => std::option::Option::Some("COMPLETE"),
Self::FinishedFailed => std::option::Option::Some("FINISHED_FAILED"),
Self::FinishedUnsupported => std::option::Option::Some("FINISHED_UNSUPPORTED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for AnalysisStatus {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for AnalysisStatus {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for AnalysisStatus {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Pending,
2 => Self::Scanning,
3 => Self::Complete,
4 => Self::FinishedFailed,
5 => Self::FinishedUnsupported,
_ => Self::UnknownValue(analysis_status::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for AnalysisStatus {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ANALYSIS_STATUS_UNSPECIFIED" => Self::Unspecified,
"PENDING" => Self::Pending,
"SCANNING" => Self::Scanning,
"FINISHED_SUCCESS" => Self::FinishedSuccess,
"COMPLETE" => Self::Complete,
"FINISHED_FAILED" => Self::FinishedFailed,
"FINISHED_UNSUPPORTED" => Self::FinishedUnsupported,
_ => Self::UnknownValue(analysis_status::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for AnalysisStatus {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Pending => serializer.serialize_i32(1),
Self::Scanning => serializer.serialize_i32(2),
Self::FinishedSuccess => serializer.serialize_i32(3),
Self::Complete => serializer.serialize_i32(3),
Self::FinishedFailed => serializer.serialize_i32(4),
Self::FinishedUnsupported => serializer.serialize_i32(5),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for AnalysisStatus {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<AnalysisStatus>::new(
".grafeas.v1.DiscoveryOccurrence.AnalysisStatus",
))
}
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DSSEAttestationNote {
pub hint: std::option::Option<crate::model::dsse_attestation_note::DSSEHint>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DSSEAttestationNote {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_hint<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::dsse_attestation_note::DSSEHint>,
{
self.hint = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_hint<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::dsse_attestation_note::DSSEHint>,
{
self.hint = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for DSSEAttestationNote {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.DSSEAttestationNote"
}
}
pub mod dsse_attestation_note {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DSSEHint {
pub human_readable_name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DSSEHint {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_human_readable_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.human_readable_name = v.into();
self
}
}
impl wkt::message::Message for DSSEHint {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.DSSEAttestationNote.DSSEHint"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DSSEAttestationOccurrence {
pub envelope: std::option::Option<crate::model::Envelope>,
#[allow(missing_docs)]
pub decoded_payload:
std::option::Option<crate::model::dsse_attestation_occurrence::DecodedPayload>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DSSEAttestationOccurrence {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_envelope<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Envelope>,
{
self.envelope = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_envelope<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Envelope>,
{
self.envelope = v.map(|x| x.into());
self
}
pub fn set_decoded_payload<
T: std::convert::Into<
std::option::Option<crate::model::dsse_attestation_occurrence::DecodedPayload>,
>,
>(
mut self,
v: T,
) -> Self {
self.decoded_payload = v.into();
self
}
pub fn statement(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::InTotoStatement>> {
#[allow(unreachable_patterns)]
self.decoded_payload.as_ref().and_then(|v| match v {
crate::model::dsse_attestation_occurrence::DecodedPayload::Statement(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_statement<T: std::convert::Into<std::boxed::Box<crate::model::InTotoStatement>>>(
mut self,
v: T,
) -> Self {
self.decoded_payload = std::option::Option::Some(
crate::model::dsse_attestation_occurrence::DecodedPayload::Statement(v.into()),
);
self
}
}
impl wkt::message::Message for DSSEAttestationOccurrence {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.DSSEAttestationOccurrence"
}
}
pub mod dsse_attestation_occurrence {
#[allow(unused_imports)]
use super::*;
#[allow(missing_docs)]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DecodedPayload {
#[allow(missing_docs)]
Statement(std::boxed::Box<crate::model::InTotoStatement>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Occurrence {
pub name: std::string::String,
pub resource_uri: std::string::String,
pub note_name: std::string::String,
pub kind: crate::model::NoteKind,
pub remediation: std::string::String,
pub create_time: std::option::Option<wkt::Timestamp>,
pub update_time: std::option::Option<wkt::Timestamp>,
pub envelope: std::option::Option<crate::model::Envelope>,
pub details: std::option::Option<crate::model::occurrence::Details>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Occurrence {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_resource_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.resource_uri = v.into();
self
}
pub fn set_note_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.note_name = v.into();
self
}
pub fn set_kind<T: std::convert::Into<crate::model::NoteKind>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
pub fn set_remediation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.remediation = v.into();
self
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
pub fn set_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = v.map(|x| x.into());
self
}
pub fn set_envelope<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Envelope>,
{
self.envelope = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_envelope<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Envelope>,
{
self.envelope = v.map(|x| x.into());
self
}
pub fn set_details<
T: std::convert::Into<std::option::Option<crate::model::occurrence::Details>>,
>(
mut self,
v: T,
) -> Self {
self.details = v.into();
self
}
pub fn vulnerability(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::VulnerabilityOccurrence>> {
#[allow(unreachable_patterns)]
self.details.as_ref().and_then(|v| match v {
crate::model::occurrence::Details::Vulnerability(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_vulnerability<
T: std::convert::Into<std::boxed::Box<crate::model::VulnerabilityOccurrence>>,
>(
mut self,
v: T,
) -> Self {
self.details =
std::option::Option::Some(crate::model::occurrence::Details::Vulnerability(v.into()));
self
}
pub fn build(&self) -> std::option::Option<&std::boxed::Box<crate::model::BuildOccurrence>> {
#[allow(unreachable_patterns)]
self.details.as_ref().and_then(|v| match v {
crate::model::occurrence::Details::Build(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_build<T: std::convert::Into<std::boxed::Box<crate::model::BuildOccurrence>>>(
mut self,
v: T,
) -> Self {
self.details =
std::option::Option::Some(crate::model::occurrence::Details::Build(v.into()));
self
}
pub fn image(&self) -> std::option::Option<&std::boxed::Box<crate::model::ImageOccurrence>> {
#[allow(unreachable_patterns)]
self.details.as_ref().and_then(|v| match v {
crate::model::occurrence::Details::Image(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_image<T: std::convert::Into<std::boxed::Box<crate::model::ImageOccurrence>>>(
mut self,
v: T,
) -> Self {
self.details =
std::option::Option::Some(crate::model::occurrence::Details::Image(v.into()));
self
}
pub fn package(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::PackageOccurrence>> {
#[allow(unreachable_patterns)]
self.details.as_ref().and_then(|v| match v {
crate::model::occurrence::Details::Package(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_package<T: std::convert::Into<std::boxed::Box<crate::model::PackageOccurrence>>>(
mut self,
v: T,
) -> Self {
self.details =
std::option::Option::Some(crate::model::occurrence::Details::Package(v.into()));
self
}
pub fn deployment(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::DeploymentOccurrence>> {
#[allow(unreachable_patterns)]
self.details.as_ref().and_then(|v| match v {
crate::model::occurrence::Details::Deployment(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_deployment<
T: std::convert::Into<std::boxed::Box<crate::model::DeploymentOccurrence>>,
>(
mut self,
v: T,
) -> Self {
self.details =
std::option::Option::Some(crate::model::occurrence::Details::Deployment(v.into()));
self
}
pub fn discovery(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::DiscoveryOccurrence>> {
#[allow(unreachable_patterns)]
self.details.as_ref().and_then(|v| match v {
crate::model::occurrence::Details::Discovery(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_discovery<
T: std::convert::Into<std::boxed::Box<crate::model::DiscoveryOccurrence>>,
>(
mut self,
v: T,
) -> Self {
self.details =
std::option::Option::Some(crate::model::occurrence::Details::Discovery(v.into()));
self
}
pub fn attestation(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::AttestationOccurrence>> {
#[allow(unreachable_patterns)]
self.details.as_ref().and_then(|v| match v {
crate::model::occurrence::Details::Attestation(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_attestation<
T: std::convert::Into<std::boxed::Box<crate::model::AttestationOccurrence>>,
>(
mut self,
v: T,
) -> Self {
self.details =
std::option::Option::Some(crate::model::occurrence::Details::Attestation(v.into()));
self
}
pub fn upgrade(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::UpgradeOccurrence>> {
#[allow(unreachable_patterns)]
self.details.as_ref().and_then(|v| match v {
crate::model::occurrence::Details::Upgrade(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_upgrade<T: std::convert::Into<std::boxed::Box<crate::model::UpgradeOccurrence>>>(
mut self,
v: T,
) -> Self {
self.details =
std::option::Option::Some(crate::model::occurrence::Details::Upgrade(v.into()));
self
}
pub fn compliance(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::ComplianceOccurrence>> {
#[allow(unreachable_patterns)]
self.details.as_ref().and_then(|v| match v {
crate::model::occurrence::Details::Compliance(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_compliance<
T: std::convert::Into<std::boxed::Box<crate::model::ComplianceOccurrence>>,
>(
mut self,
v: T,
) -> Self {
self.details =
std::option::Option::Some(crate::model::occurrence::Details::Compliance(v.into()));
self
}
pub fn dsse_attestation(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::DSSEAttestationOccurrence>> {
#[allow(unreachable_patterns)]
self.details.as_ref().and_then(|v| match v {
crate::model::occurrence::Details::DsseAttestation(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_dsse_attestation<
T: std::convert::Into<std::boxed::Box<crate::model::DSSEAttestationOccurrence>>,
>(
mut self,
v: T,
) -> Self {
self.details =
std::option::Option::Some(crate::model::occurrence::Details::DsseAttestation(v.into()));
self
}
pub fn sbom_reference(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SBOMReferenceOccurrence>> {
#[allow(unreachable_patterns)]
self.details.as_ref().and_then(|v| match v {
crate::model::occurrence::Details::SbomReference(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_sbom_reference<
T: std::convert::Into<std::boxed::Box<crate::model::SBOMReferenceOccurrence>>,
>(
mut self,
v: T,
) -> Self {
self.details =
std::option::Option::Some(crate::model::occurrence::Details::SbomReference(v.into()));
self
}
pub fn secret(&self) -> std::option::Option<&std::boxed::Box<crate::model::SecretOccurrence>> {
#[allow(unreachable_patterns)]
self.details.as_ref().and_then(|v| match v {
crate::model::occurrence::Details::Secret(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_secret<T: std::convert::Into<std::boxed::Box<crate::model::SecretOccurrence>>>(
mut self,
v: T,
) -> Self {
self.details =
std::option::Option::Some(crate::model::occurrence::Details::Secret(v.into()));
self
}
}
impl wkt::message::Message for Occurrence {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.Occurrence"
}
}
pub mod occurrence {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Details {
Vulnerability(std::boxed::Box<crate::model::VulnerabilityOccurrence>),
Build(std::boxed::Box<crate::model::BuildOccurrence>),
Image(std::boxed::Box<crate::model::ImageOccurrence>),
Package(std::boxed::Box<crate::model::PackageOccurrence>),
Deployment(std::boxed::Box<crate::model::DeploymentOccurrence>),
Discovery(std::boxed::Box<crate::model::DiscoveryOccurrence>),
Attestation(std::boxed::Box<crate::model::AttestationOccurrence>),
Upgrade(std::boxed::Box<crate::model::UpgradeOccurrence>),
Compliance(std::boxed::Box<crate::model::ComplianceOccurrence>),
DsseAttestation(std::boxed::Box<crate::model::DSSEAttestationOccurrence>),
SbomReference(std::boxed::Box<crate::model::SBOMReferenceOccurrence>),
Secret(std::boxed::Box<crate::model::SecretOccurrence>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Note {
pub name: std::string::String,
pub short_description: std::string::String,
pub long_description: std::string::String,
pub kind: crate::model::NoteKind,
pub related_url: std::vec::Vec<crate::model::RelatedUrl>,
pub expiration_time: std::option::Option<wkt::Timestamp>,
pub create_time: std::option::Option<wkt::Timestamp>,
pub update_time: std::option::Option<wkt::Timestamp>,
pub related_note_names: std::vec::Vec<std::string::String>,
pub r#type: std::option::Option<crate::model::note::Type>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Note {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_short_description<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.short_description = v.into();
self
}
pub fn set_long_description<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.long_description = v.into();
self
}
pub fn set_kind<T: std::convert::Into<crate::model::NoteKind>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
pub fn set_related_url<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::RelatedUrl>,
{
use std::iter::Iterator;
self.related_url = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_expiration_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.expiration_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_expiration_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.expiration_time = v.map(|x| x.into());
self
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
pub fn set_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = v.map(|x| x.into());
self
}
pub fn set_related_note_names<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.related_note_names = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_type<T: std::convert::Into<std::option::Option<crate::model::note::Type>>>(
mut self,
v: T,
) -> Self {
self.r#type = v.into();
self
}
pub fn vulnerability(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::VulnerabilityNote>> {
#[allow(unreachable_patterns)]
self.r#type.as_ref().and_then(|v| match v {
crate::model::note::Type::Vulnerability(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_vulnerability<
T: std::convert::Into<std::boxed::Box<crate::model::VulnerabilityNote>>,
>(
mut self,
v: T,
) -> Self {
self.r#type = std::option::Option::Some(crate::model::note::Type::Vulnerability(v.into()));
self
}
pub fn build(&self) -> std::option::Option<&std::boxed::Box<crate::model::BuildNote>> {
#[allow(unreachable_patterns)]
self.r#type.as_ref().and_then(|v| match v {
crate::model::note::Type::Build(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_build<T: std::convert::Into<std::boxed::Box<crate::model::BuildNote>>>(
mut self,
v: T,
) -> Self {
self.r#type = std::option::Option::Some(crate::model::note::Type::Build(v.into()));
self
}
pub fn image(&self) -> std::option::Option<&std::boxed::Box<crate::model::ImageNote>> {
#[allow(unreachable_patterns)]
self.r#type.as_ref().and_then(|v| match v {
crate::model::note::Type::Image(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_image<T: std::convert::Into<std::boxed::Box<crate::model::ImageNote>>>(
mut self,
v: T,
) -> Self {
self.r#type = std::option::Option::Some(crate::model::note::Type::Image(v.into()));
self
}
pub fn package(&self) -> std::option::Option<&std::boxed::Box<crate::model::PackageNote>> {
#[allow(unreachable_patterns)]
self.r#type.as_ref().and_then(|v| match v {
crate::model::note::Type::Package(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_package<T: std::convert::Into<std::boxed::Box<crate::model::PackageNote>>>(
mut self,
v: T,
) -> Self {
self.r#type = std::option::Option::Some(crate::model::note::Type::Package(v.into()));
self
}
pub fn deployment(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::DeploymentNote>> {
#[allow(unreachable_patterns)]
self.r#type.as_ref().and_then(|v| match v {
crate::model::note::Type::Deployment(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_deployment<T: std::convert::Into<std::boxed::Box<crate::model::DeploymentNote>>>(
mut self,
v: T,
) -> Self {
self.r#type = std::option::Option::Some(crate::model::note::Type::Deployment(v.into()));
self
}
pub fn discovery(&self) -> std::option::Option<&std::boxed::Box<crate::model::DiscoveryNote>> {
#[allow(unreachable_patterns)]
self.r#type.as_ref().and_then(|v| match v {
crate::model::note::Type::Discovery(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_discovery<T: std::convert::Into<std::boxed::Box<crate::model::DiscoveryNote>>>(
mut self,
v: T,
) -> Self {
self.r#type = std::option::Option::Some(crate::model::note::Type::Discovery(v.into()));
self
}
pub fn attestation(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::AttestationNote>> {
#[allow(unreachable_patterns)]
self.r#type.as_ref().and_then(|v| match v {
crate::model::note::Type::Attestation(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_attestation<
T: std::convert::Into<std::boxed::Box<crate::model::AttestationNote>>,
>(
mut self,
v: T,
) -> Self {
self.r#type = std::option::Option::Some(crate::model::note::Type::Attestation(v.into()));
self
}
pub fn upgrade(&self) -> std::option::Option<&std::boxed::Box<crate::model::UpgradeNote>> {
#[allow(unreachable_patterns)]
self.r#type.as_ref().and_then(|v| match v {
crate::model::note::Type::Upgrade(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_upgrade<T: std::convert::Into<std::boxed::Box<crate::model::UpgradeNote>>>(
mut self,
v: T,
) -> Self {
self.r#type = std::option::Option::Some(crate::model::note::Type::Upgrade(v.into()));
self
}
pub fn compliance(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::ComplianceNote>> {
#[allow(unreachable_patterns)]
self.r#type.as_ref().and_then(|v| match v {
crate::model::note::Type::Compliance(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_compliance<T: std::convert::Into<std::boxed::Box<crate::model::ComplianceNote>>>(
mut self,
v: T,
) -> Self {
self.r#type = std::option::Option::Some(crate::model::note::Type::Compliance(v.into()));
self
}
pub fn dsse_attestation(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::DSSEAttestationNote>> {
#[allow(unreachable_patterns)]
self.r#type.as_ref().and_then(|v| match v {
crate::model::note::Type::DsseAttestation(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_dsse_attestation<
T: std::convert::Into<std::boxed::Box<crate::model::DSSEAttestationNote>>,
>(
mut self,
v: T,
) -> Self {
self.r#type =
std::option::Option::Some(crate::model::note::Type::DsseAttestation(v.into()));
self
}
pub fn vulnerability_assessment(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::VulnerabilityAssessmentNote>> {
#[allow(unreachable_patterns)]
self.r#type.as_ref().and_then(|v| match v {
crate::model::note::Type::VulnerabilityAssessment(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_vulnerability_assessment<
T: std::convert::Into<std::boxed::Box<crate::model::VulnerabilityAssessmentNote>>,
>(
mut self,
v: T,
) -> Self {
self.r#type =
std::option::Option::Some(crate::model::note::Type::VulnerabilityAssessment(v.into()));
self
}
pub fn sbom_reference(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SBOMReferenceNote>> {
#[allow(unreachable_patterns)]
self.r#type.as_ref().and_then(|v| match v {
crate::model::note::Type::SbomReference(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_sbom_reference<
T: std::convert::Into<std::boxed::Box<crate::model::SBOMReferenceNote>>,
>(
mut self,
v: T,
) -> Self {
self.r#type = std::option::Option::Some(crate::model::note::Type::SbomReference(v.into()));
self
}
pub fn secret(&self) -> std::option::Option<&std::boxed::Box<crate::model::SecretNote>> {
#[allow(unreachable_patterns)]
self.r#type.as_ref().and_then(|v| match v {
crate::model::note::Type::Secret(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_secret<T: std::convert::Into<std::boxed::Box<crate::model::SecretNote>>>(
mut self,
v: T,
) -> Self {
self.r#type = std::option::Option::Some(crate::model::note::Type::Secret(v.into()));
self
}
}
impl wkt::message::Message for Note {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.Note"
}
}
pub mod note {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Type {
Vulnerability(std::boxed::Box<crate::model::VulnerabilityNote>),
Build(std::boxed::Box<crate::model::BuildNote>),
Image(std::boxed::Box<crate::model::ImageNote>),
Package(std::boxed::Box<crate::model::PackageNote>),
Deployment(std::boxed::Box<crate::model::DeploymentNote>),
Discovery(std::boxed::Box<crate::model::DiscoveryNote>),
Attestation(std::boxed::Box<crate::model::AttestationNote>),
Upgrade(std::boxed::Box<crate::model::UpgradeNote>),
Compliance(std::boxed::Box<crate::model::ComplianceNote>),
DsseAttestation(std::boxed::Box<crate::model::DSSEAttestationNote>),
VulnerabilityAssessment(std::boxed::Box<crate::model::VulnerabilityAssessmentNote>),
SbomReference(std::boxed::Box<crate::model::SBOMReferenceNote>),
Secret(std::boxed::Box<crate::model::SecretNote>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetOccurrenceRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetOccurrenceRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetOccurrenceRequest {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.GetOccurrenceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListOccurrencesRequest {
pub parent: std::string::String,
pub filter: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub return_partial_success: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListOccurrencesRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.return_partial_success = v.into();
self
}
}
impl wkt::message::Message for ListOccurrencesRequest {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.ListOccurrencesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListOccurrencesResponse {
pub occurrences: std::vec::Vec<crate::model::Occurrence>,
pub next_page_token: std::string::String,
pub unreachable: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListOccurrencesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_occurrences<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Occurrence>,
{
use std::iter::Iterator;
self.occurrences = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
pub fn set_unreachable<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.unreachable = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ListOccurrencesResponse {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.ListOccurrencesResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListOccurrencesResponse {
type PageItem = crate::model::Occurrence;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.occurrences
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteOccurrenceRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteOccurrenceRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for DeleteOccurrenceRequest {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.DeleteOccurrenceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateOccurrenceRequest {
pub parent: std::string::String,
pub occurrence: std::option::Option<crate::model::Occurrence>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateOccurrenceRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_occurrence<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Occurrence>,
{
self.occurrence = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_occurrence<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Occurrence>,
{
self.occurrence = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for CreateOccurrenceRequest {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.CreateOccurrenceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateOccurrenceRequest {
pub name: std::string::String,
pub occurrence: std::option::Option<crate::model::Occurrence>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateOccurrenceRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_occurrence<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Occurrence>,
{
self.occurrence = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_occurrence<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Occurrence>,
{
self.occurrence = v.map(|x| x.into());
self
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateOccurrenceRequest {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.UpdateOccurrenceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetNoteRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetNoteRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetNoteRequest {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.GetNoteRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetOccurrenceNoteRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetOccurrenceNoteRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetOccurrenceNoteRequest {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.GetOccurrenceNoteRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListNotesRequest {
pub parent: std::string::String,
pub filter: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub return_partial_success: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListNotesRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.return_partial_success = v.into();
self
}
}
impl wkt::message::Message for ListNotesRequest {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.ListNotesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListNotesResponse {
pub notes: std::vec::Vec<crate::model::Note>,
pub next_page_token: std::string::String,
pub unreachable: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListNotesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_notes<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Note>,
{
use std::iter::Iterator;
self.notes = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
pub fn set_unreachable<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.unreachable = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ListNotesResponse {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.ListNotesResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListNotesResponse {
type PageItem = crate::model::Note;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.notes
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteNoteRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteNoteRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for DeleteNoteRequest {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.DeleteNoteRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateNoteRequest {
pub parent: std::string::String,
pub note_id: std::string::String,
pub note: std::option::Option<crate::model::Note>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateNoteRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_note_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.note_id = v.into();
self
}
pub fn set_note<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Note>,
{
self.note = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_note<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Note>,
{
self.note = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for CreateNoteRequest {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.CreateNoteRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateNoteRequest {
pub name: std::string::String,
pub note: std::option::Option<crate::model::Note>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateNoteRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_note<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Note>,
{
self.note = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_note<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Note>,
{
self.note = v.map(|x| x.into());
self
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateNoteRequest {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.UpdateNoteRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListNoteOccurrencesRequest {
pub name: std::string::String,
pub filter: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListNoteOccurrencesRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
impl wkt::message::Message for ListNoteOccurrencesRequest {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.ListNoteOccurrencesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListNoteOccurrencesResponse {
pub occurrences: std::vec::Vec<crate::model::Occurrence>,
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListNoteOccurrencesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_occurrences<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Occurrence>,
{
use std::iter::Iterator;
self.occurrences = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
}
impl wkt::message::Message for ListNoteOccurrencesResponse {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.ListNoteOccurrencesResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListNoteOccurrencesResponse {
type PageItem = crate::model::Occurrence;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.occurrences
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchCreateNotesRequest {
pub parent: std::string::String,
pub notes: std::collections::HashMap<std::string::String, crate::model::Note>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BatchCreateNotesRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_notes<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::Note>,
{
use std::iter::Iterator;
self.notes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for BatchCreateNotesRequest {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.BatchCreateNotesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchCreateNotesResponse {
pub notes: std::vec::Vec<crate::model::Note>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BatchCreateNotesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_notes<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Note>,
{
use std::iter::Iterator;
self.notes = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for BatchCreateNotesResponse {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.BatchCreateNotesResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchCreateOccurrencesRequest {
pub parent: std::string::String,
pub occurrences: std::vec::Vec<crate::model::Occurrence>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BatchCreateOccurrencesRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_occurrences<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Occurrence>,
{
use std::iter::Iterator;
self.occurrences = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for BatchCreateOccurrencesRequest {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.BatchCreateOccurrencesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchCreateOccurrencesResponse {
pub occurrences: std::vec::Vec<crate::model::Occurrence>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BatchCreateOccurrencesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_occurrences<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Occurrence>,
{
use std::iter::Iterator;
self.occurrences = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for BatchCreateOccurrencesResponse {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.BatchCreateOccurrencesResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Layer {
pub directive: std::string::String,
pub arguments: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Layer {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_directive<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.directive = v.into();
self
}
pub fn set_arguments<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.arguments = v.into();
self
}
}
impl wkt::message::Message for Layer {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.Layer"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Fingerprint {
pub v1_name: std::string::String,
pub v2_blob: std::vec::Vec<std::string::String>,
pub v2_name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Fingerprint {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_v1_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.v1_name = v.into();
self
}
pub fn set_v2_blob<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.v2_blob = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_v2_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.v2_name = v.into();
self
}
}
impl wkt::message::Message for Fingerprint {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.Fingerprint"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImageNote {
pub resource_url: std::string::String,
pub fingerprint: std::option::Option<crate::model::Fingerprint>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ImageNote {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_resource_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.resource_url = v.into();
self
}
pub fn set_fingerprint<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Fingerprint>,
{
self.fingerprint = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_fingerprint<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Fingerprint>,
{
self.fingerprint = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for ImageNote {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.ImageNote"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImageOccurrence {
pub fingerprint: std::option::Option<crate::model::Fingerprint>,
pub distance: i32,
pub layer_info: std::vec::Vec<crate::model::Layer>,
pub base_resource_url: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ImageOccurrence {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_fingerprint<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Fingerprint>,
{
self.fingerprint = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_fingerprint<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Fingerprint>,
{
self.fingerprint = v.map(|x| x.into());
self
}
pub fn set_distance<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.distance = v.into();
self
}
pub fn set_layer_info<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Layer>,
{
use std::iter::Iterator;
self.layer_info = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_base_resource_url<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.base_resource_url = v.into();
self
}
}
impl wkt::message::Message for ImageOccurrence {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.ImageOccurrence"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Recipe {
pub r#type: std::string::String,
pub defined_in_material: i64,
pub entry_point: std::string::String,
pub arguments: std::vec::Vec<wkt::Any>,
pub environment: std::vec::Vec<wkt::Any>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Recipe {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
pub fn set_defined_in_material<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.defined_in_material = v.into();
self
}
pub fn set_entry_point<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.entry_point = v.into();
self
}
pub fn set_arguments<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<wkt::Any>,
{
use std::iter::Iterator;
self.arguments = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_environment<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<wkt::Any>,
{
use std::iter::Iterator;
self.environment = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for Recipe {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.Recipe"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Completeness {
pub arguments: bool,
pub environment: bool,
pub materials: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Completeness {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_arguments<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.arguments = v.into();
self
}
pub fn set_environment<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.environment = v.into();
self
}
pub fn set_materials<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.materials = v.into();
self
}
}
impl wkt::message::Message for Completeness {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.Completeness"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Metadata {
pub build_invocation_id: std::string::String,
pub build_started_on: std::option::Option<wkt::Timestamp>,
pub build_finished_on: std::option::Option<wkt::Timestamp>,
pub completeness: std::option::Option<crate::model::Completeness>,
pub reproducible: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Metadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_build_invocation_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.build_invocation_id = v.into();
self
}
pub fn set_build_started_on<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.build_started_on = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_build_started_on<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.build_started_on = v.map(|x| x.into());
self
}
pub fn set_build_finished_on<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.build_finished_on = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_build_finished_on<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.build_finished_on = v.map(|x| x.into());
self
}
pub fn set_completeness<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Completeness>,
{
self.completeness = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_completeness<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Completeness>,
{
self.completeness = v.map(|x| x.into());
self
}
pub fn set_reproducible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.reproducible = v.into();
self
}
}
impl wkt::message::Message for Metadata {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.Metadata"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BuilderConfig {
#[allow(missing_docs)]
pub id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BuilderConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
}
impl wkt::message::Message for BuilderConfig {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.BuilderConfig"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InTotoProvenance {
#[allow(missing_docs)]
pub builder_config: std::option::Option<crate::model::BuilderConfig>,
pub recipe: std::option::Option<crate::model::Recipe>,
#[allow(missing_docs)]
pub metadata: std::option::Option<crate::model::Metadata>,
pub materials: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl InTotoProvenance {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_builder_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::BuilderConfig>,
{
self.builder_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_builder_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::BuilderConfig>,
{
self.builder_config = v.map(|x| x.into());
self
}
pub fn set_recipe<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Recipe>,
{
self.recipe = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_recipe<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Recipe>,
{
self.recipe = v.map(|x| x.into());
self
}
pub fn set_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Metadata>,
{
self.metadata = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Metadata>,
{
self.metadata = v.map(|x| x.into());
self
}
pub fn set_materials<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.materials = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for InTotoProvenance {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.InTotoProvenance"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InTotoStatement {
pub r#type: std::string::String,
#[allow(missing_docs)]
pub subject: std::vec::Vec<crate::model::Subject>,
pub predicate_type: std::string::String,
#[allow(missing_docs)]
pub predicate: std::option::Option<crate::model::in_toto_statement::Predicate>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl InTotoStatement {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
pub fn set_subject<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Subject>,
{
use std::iter::Iterator;
self.subject = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_predicate_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.predicate_type = v.into();
self
}
pub fn set_predicate<
T: std::convert::Into<std::option::Option<crate::model::in_toto_statement::Predicate>>,
>(
mut self,
v: T,
) -> Self {
self.predicate = v.into();
self
}
pub fn provenance(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::InTotoProvenance>> {
#[allow(unreachable_patterns)]
self.predicate.as_ref().and_then(|v| match v {
crate::model::in_toto_statement::Predicate::Provenance(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_provenance<
T: std::convert::Into<std::boxed::Box<crate::model::InTotoProvenance>>,
>(
mut self,
v: T,
) -> Self {
self.predicate = std::option::Option::Some(
crate::model::in_toto_statement::Predicate::Provenance(v.into()),
);
self
}
pub fn slsa_provenance(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SlsaProvenance>> {
#[allow(unreachable_patterns)]
self.predicate.as_ref().and_then(|v| match v {
crate::model::in_toto_statement::Predicate::SlsaProvenance(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_slsa_provenance<
T: std::convert::Into<std::boxed::Box<crate::model::SlsaProvenance>>,
>(
mut self,
v: T,
) -> Self {
self.predicate = std::option::Option::Some(
crate::model::in_toto_statement::Predicate::SlsaProvenance(v.into()),
);
self
}
pub fn slsa_provenance_zero_two(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SlsaProvenanceZeroTwo>> {
#[allow(unreachable_patterns)]
self.predicate.as_ref().and_then(|v| match v {
crate::model::in_toto_statement::Predicate::SlsaProvenanceZeroTwo(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_slsa_provenance_zero_two<
T: std::convert::Into<std::boxed::Box<crate::model::SlsaProvenanceZeroTwo>>,
>(
mut self,
v: T,
) -> Self {
self.predicate = std::option::Option::Some(
crate::model::in_toto_statement::Predicate::SlsaProvenanceZeroTwo(v.into()),
);
self
}
}
impl wkt::message::Message for InTotoStatement {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.InTotoStatement"
}
}
pub mod in_toto_statement {
#[allow(unused_imports)]
use super::*;
#[allow(missing_docs)]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Predicate {
#[allow(missing_docs)]
Provenance(std::boxed::Box<crate::model::InTotoProvenance>),
#[allow(missing_docs)]
SlsaProvenance(std::boxed::Box<crate::model::SlsaProvenance>),
#[allow(missing_docs)]
SlsaProvenanceZeroTwo(std::boxed::Box<crate::model::SlsaProvenanceZeroTwo>),
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Subject {
#[allow(missing_docs)]
pub name: std::string::String,
pub digest: std::collections::HashMap<std::string::String, std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Subject {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_digest<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.digest = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for Subject {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.Subject"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InTotoSlsaProvenanceV1 {
pub r#type: std::string::String,
#[allow(missing_docs)]
pub subject: std::vec::Vec<crate::model::Subject>,
#[allow(missing_docs)]
pub predicate_type: std::string::String,
#[allow(missing_docs)]
pub predicate: std::option::Option<crate::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl InTotoSlsaProvenanceV1 {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
pub fn set_subject<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Subject>,
{
use std::iter::Iterator;
self.subject = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_predicate_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.predicate_type = v.into();
self
}
pub fn set_predicate<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1>,
{
self.predicate = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_predicate<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1>,
{
self.predicate = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for InTotoSlsaProvenanceV1 {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.InTotoSlsaProvenanceV1"
}
}
pub mod in_toto_slsa_provenance_v_1 {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SlsaProvenanceV1 {
#[allow(missing_docs)]
pub build_definition:
std::option::Option<crate::model::in_toto_slsa_provenance_v_1::BuildDefinition>,
#[allow(missing_docs)]
pub run_details: std::option::Option<crate::model::in_toto_slsa_provenance_v_1::RunDetails>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SlsaProvenanceV1 {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_build_definition<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::BuildDefinition>,
{
self.build_definition = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_build_definition<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::BuildDefinition>,
{
self.build_definition = v.map(|x| x.into());
self
}
pub fn set_run_details<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::RunDetails>,
{
self.run_details = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_run_details<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::RunDetails>,
{
self.run_details = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for SlsaProvenanceV1 {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.InTotoSlsaProvenanceV1.SlsaProvenanceV1"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BuildDefinition {
#[allow(missing_docs)]
pub build_type: std::string::String,
#[allow(missing_docs)]
pub external_parameters: std::option::Option<wkt::Struct>,
#[allow(missing_docs)]
pub internal_parameters: std::option::Option<wkt::Struct>,
#[allow(missing_docs)]
pub resolved_dependencies:
std::vec::Vec<crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BuildDefinition {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_build_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.build_type = v.into();
self
}
pub fn set_external_parameters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.external_parameters = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_external_parameters<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.external_parameters = v.map(|x| x.into());
self
}
pub fn set_internal_parameters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.internal_parameters = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_internal_parameters<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.internal_parameters = v.map(|x| x.into());
self
}
pub fn set_resolved_dependencies<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor>,
{
use std::iter::Iterator;
self.resolved_dependencies = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for BuildDefinition {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.InTotoSlsaProvenanceV1.BuildDefinition"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResourceDescriptor {
#[allow(missing_docs)]
pub name: std::string::String,
#[allow(missing_docs)]
pub uri: std::string::String,
#[allow(missing_docs)]
pub digest: std::collections::HashMap<std::string::String, std::string::String>,
#[allow(missing_docs)]
pub content: ::bytes::Bytes,
#[allow(missing_docs)]
pub download_location: std::string::String,
#[allow(missing_docs)]
pub media_type: std::string::String,
#[allow(missing_docs)]
pub annotations: std::collections::HashMap<std::string::String, wkt::Value>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ResourceDescriptor {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uri = v.into();
self
}
pub fn set_digest<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.digest = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.content = v.into();
self
}
pub fn set_download_location<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.download_location = v.into();
self
}
pub fn set_media_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.media_type = v.into();
self
}
pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<wkt::Value>,
{
use std::iter::Iterator;
self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for ResourceDescriptor {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.InTotoSlsaProvenanceV1.ResourceDescriptor"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RunDetails {
#[allow(missing_docs)]
pub builder:
std::option::Option<crate::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder>,
#[allow(missing_docs)]
pub metadata: std::option::Option<crate::model::in_toto_slsa_provenance_v_1::BuildMetadata>,
#[allow(missing_docs)]
pub byproducts:
std::vec::Vec<crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RunDetails {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_builder<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder>,
{
self.builder = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_builder<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder>,
{
self.builder = v.map(|x| x.into());
self
}
pub fn set_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::BuildMetadata>,
{
self.metadata = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::BuildMetadata>,
{
self.metadata = v.map(|x| x.into());
self
}
pub fn set_byproducts<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor>,
{
use std::iter::Iterator;
self.byproducts = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for RunDetails {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.InTotoSlsaProvenanceV1.RunDetails"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ProvenanceBuilder {
#[allow(missing_docs)]
pub id: std::string::String,
#[allow(missing_docs)]
pub version: std::collections::HashMap<std::string::String, std::string::String>,
#[allow(missing_docs)]
pub builder_dependencies:
std::vec::Vec<crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ProvenanceBuilder {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
pub fn set_version<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.version = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_builder_dependencies<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor>,
{
use std::iter::Iterator;
self.builder_dependencies = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ProvenanceBuilder {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.InTotoSlsaProvenanceV1.ProvenanceBuilder"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BuildMetadata {
#[allow(missing_docs)]
pub invocation_id: std::string::String,
#[allow(missing_docs)]
pub started_on: std::option::Option<wkt::Timestamp>,
#[allow(missing_docs)]
pub finished_on: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BuildMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_invocation_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.invocation_id = v.into();
self
}
pub fn set_started_on<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.started_on = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_started_on<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.started_on = v.map(|x| x.into());
self
}
pub fn set_finished_on<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.finished_on = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_finished_on<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.finished_on = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for BuildMetadata {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.InTotoSlsaProvenanceV1.BuildMetadata"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Distribution {
pub cpe_uri: std::string::String,
pub architecture: crate::model::Architecture,
pub latest_version: std::option::Option<crate::model::Version>,
pub maintainer: std::string::String,
pub url: std::string::String,
pub description: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Distribution {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_cpe_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.cpe_uri = v.into();
self
}
pub fn set_architecture<T: std::convert::Into<crate::model::Architecture>>(
mut self,
v: T,
) -> Self {
self.architecture = v.into();
self
}
pub fn set_latest_version<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.latest_version = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_latest_version<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.latest_version = v.map(|x| x.into());
self
}
pub fn set_maintainer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.maintainer = v.into();
self
}
pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.url = v.into();
self
}
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
}
impl wkt::message::Message for Distribution {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.Distribution"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Location {
pub cpe_uri: std::string::String,
pub version: std::option::Option<crate::model::Version>,
pub path: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Location {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_cpe_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.cpe_uri = v.into();
self
}
pub fn set_version<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.version = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.version = v.map(|x| x.into());
self
}
pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.path = v.into();
self
}
}
impl wkt::message::Message for Location {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.Location"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PackageNote {
pub name: std::string::String,
pub distribution: std::vec::Vec<crate::model::Distribution>,
pub package_type: std::string::String,
pub cpe_uri: std::string::String,
pub architecture: crate::model::Architecture,
pub version: std::option::Option<crate::model::Version>,
pub maintainer: std::string::String,
pub url: std::string::String,
pub description: std::string::String,
pub license: std::option::Option<crate::model::License>,
pub digest: std::vec::Vec<crate::model::Digest>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PackageNote {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_distribution<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Distribution>,
{
use std::iter::Iterator;
self.distribution = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_package_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.package_type = v.into();
self
}
pub fn set_cpe_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.cpe_uri = v.into();
self
}
pub fn set_architecture<T: std::convert::Into<crate::model::Architecture>>(
mut self,
v: T,
) -> Self {
self.architecture = v.into();
self
}
pub fn set_version<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.version = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.version = v.map(|x| x.into());
self
}
pub fn set_maintainer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.maintainer = v.into();
self
}
pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.url = v.into();
self
}
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
pub fn set_license<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::License>,
{
self.license = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_license<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::License>,
{
self.license = v.map(|x| x.into());
self
}
pub fn set_digest<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Digest>,
{
use std::iter::Iterator;
self.digest = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for PackageNote {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.PackageNote"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PackageOccurrence {
pub name: std::string::String,
pub location: std::vec::Vec<crate::model::Location>,
pub package_type: std::string::String,
pub cpe_uri: std::string::String,
pub architecture: crate::model::Architecture,
pub license: std::option::Option<crate::model::License>,
pub version: std::option::Option<crate::model::Version>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PackageOccurrence {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_location<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Location>,
{
use std::iter::Iterator;
self.location = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_package_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.package_type = v.into();
self
}
pub fn set_cpe_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.cpe_uri = v.into();
self
}
pub fn set_architecture<T: std::convert::Into<crate::model::Architecture>>(
mut self,
v: T,
) -> Self {
self.architecture = v.into();
self
}
pub fn set_license<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::License>,
{
self.license = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_license<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::License>,
{
self.license = v.map(|x| x.into());
self
}
pub fn set_version<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.version = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.version = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for PackageOccurrence {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.PackageOccurrence"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Version {
pub epoch: i32,
pub name: std::string::String,
pub revision: std::string::String,
pub inclusive: bool,
pub kind: crate::model::version::VersionKind,
pub full_name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Version {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_epoch<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.epoch = v.into();
self
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.revision = v.into();
self
}
pub fn set_inclusive<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.inclusive = v.into();
self
}
pub fn set_kind<T: std::convert::Into<crate::model::version::VersionKind>>(
mut self,
v: T,
) -> Self {
self.kind = v.into();
self
}
pub fn set_full_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.full_name = v.into();
self
}
}
impl wkt::message::Message for Version {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.Version"
}
}
pub mod version {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum VersionKind {
Unspecified,
Normal,
Minimum,
Maximum,
UnknownValue(version_kind::UnknownValue),
}
#[doc(hidden)]
pub mod version_kind {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl VersionKind {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Normal => std::option::Option::Some(1),
Self::Minimum => std::option::Option::Some(2),
Self::Maximum => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("VERSION_KIND_UNSPECIFIED"),
Self::Normal => std::option::Option::Some("NORMAL"),
Self::Minimum => std::option::Option::Some("MINIMUM"),
Self::Maximum => std::option::Option::Some("MAXIMUM"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for VersionKind {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for VersionKind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for VersionKind {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Normal,
2 => Self::Minimum,
3 => Self::Maximum,
_ => Self::UnknownValue(version_kind::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for VersionKind {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"VERSION_KIND_UNSPECIFIED" => Self::Unspecified,
"NORMAL" => Self::Normal,
"MINIMUM" => Self::Minimum,
"MAXIMUM" => Self::Maximum,
_ => Self::UnknownValue(version_kind::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for VersionKind {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Normal => serializer.serialize_i32(1),
Self::Minimum => serializer.serialize_i32(2),
Self::Maximum => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for VersionKind {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<VersionKind>::new(
".grafeas.v1.Version.VersionKind",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BuildProvenance {
pub id: std::string::String,
pub project_id: std::string::String,
pub commands: std::vec::Vec<crate::model::Command>,
pub built_artifacts: std::vec::Vec<crate::model::Artifact>,
pub create_time: std::option::Option<wkt::Timestamp>,
pub start_time: std::option::Option<wkt::Timestamp>,
pub end_time: std::option::Option<wkt::Timestamp>,
pub creator: std::string::String,
pub logs_uri: std::string::String,
pub source_provenance: std::option::Option<crate::model::Source>,
pub trigger_id: std::string::String,
pub build_options: std::collections::HashMap<std::string::String, std::string::String>,
pub builder_version: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BuildProvenance {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
pub fn set_commands<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Command>,
{
use std::iter::Iterator;
self.commands = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_built_artifacts<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Artifact>,
{
use std::iter::Iterator;
self.built_artifacts = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
pub fn set_start_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.start_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.start_time = v.map(|x| x.into());
self
}
pub fn set_end_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.end_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.end_time = v.map(|x| x.into());
self
}
pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.creator = v.into();
self
}
pub fn set_logs_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.logs_uri = v.into();
self
}
pub fn set_source_provenance<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Source>,
{
self.source_provenance = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_source_provenance<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Source>,
{
self.source_provenance = v.map(|x| x.into());
self
}
pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.trigger_id = v.into();
self
}
pub fn set_build_options<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.build_options = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_builder_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.builder_version = v.into();
self
}
}
impl wkt::message::Message for BuildProvenance {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.BuildProvenance"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Source {
pub artifact_storage_source_uri: std::string::String,
pub file_hashes: std::collections::HashMap<std::string::String, crate::model::FileHashes>,
pub context: std::option::Option<crate::model::SourceContext>,
pub additional_contexts: std::vec::Vec<crate::model::SourceContext>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Source {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_artifact_storage_source_uri<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.artifact_storage_source_uri = v.into();
self
}
pub fn set_file_hashes<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::FileHashes>,
{
use std::iter::Iterator;
self.file_hashes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_context<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SourceContext>,
{
self.context = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SourceContext>,
{
self.context = v.map(|x| x.into());
self
}
pub fn set_additional_contexts<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SourceContext>,
{
use std::iter::Iterator;
self.additional_contexts = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for Source {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.Source"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FileHashes {
pub file_hash: std::vec::Vec<crate::model::Hash>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FileHashes {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_file_hash<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Hash>,
{
use std::iter::Iterator;
self.file_hash = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for FileHashes {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.FileHashes"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Hash {
pub r#type: std::string::String,
pub value: ::bytes::Bytes,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Hash {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
pub fn set_value<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.value = v.into();
self
}
}
impl wkt::message::Message for Hash {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.Hash"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Command {
pub name: std::string::String,
pub env: std::vec::Vec<std::string::String>,
pub args: std::vec::Vec<std::string::String>,
pub dir: std::string::String,
pub id: std::string::String,
pub wait_for: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Command {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_env<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.env = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_args<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.args = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dir = v.into();
self
}
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
pub fn set_wait_for<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.wait_for = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for Command {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.Command"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Artifact {
pub checksum: std::string::String,
pub id: std::string::String,
pub names: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Artifact {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_checksum<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.checksum = v.into();
self
}
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
pub fn set_names<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.names = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for Artifact {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.Artifact"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SourceContext {
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
pub context: std::option::Option<crate::model::source_context::Context>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SourceContext {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_labels<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_context<
T: std::convert::Into<std::option::Option<crate::model::source_context::Context>>,
>(
mut self,
v: T,
) -> Self {
self.context = v.into();
self
}
pub fn cloud_repo(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::CloudRepoSourceContext>> {
#[allow(unreachable_patterns)]
self.context.as_ref().and_then(|v| match v {
crate::model::source_context::Context::CloudRepo(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_cloud_repo<
T: std::convert::Into<std::boxed::Box<crate::model::CloudRepoSourceContext>>,
>(
mut self,
v: T,
) -> Self {
self.context =
std::option::Option::Some(crate::model::source_context::Context::CloudRepo(v.into()));
self
}
pub fn gerrit(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::GerritSourceContext>> {
#[allow(unreachable_patterns)]
self.context.as_ref().and_then(|v| match v {
crate::model::source_context::Context::Gerrit(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_gerrit<T: std::convert::Into<std::boxed::Box<crate::model::GerritSourceContext>>>(
mut self,
v: T,
) -> Self {
self.context =
std::option::Option::Some(crate::model::source_context::Context::Gerrit(v.into()));
self
}
pub fn git(&self) -> std::option::Option<&std::boxed::Box<crate::model::GitSourceContext>> {
#[allow(unreachable_patterns)]
self.context.as_ref().and_then(|v| match v {
crate::model::source_context::Context::Git(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_git<T: std::convert::Into<std::boxed::Box<crate::model::GitSourceContext>>>(
mut self,
v: T,
) -> Self {
self.context =
std::option::Option::Some(crate::model::source_context::Context::Git(v.into()));
self
}
}
impl wkt::message::Message for SourceContext {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SourceContext"
}
}
pub mod source_context {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Context {
CloudRepo(std::boxed::Box<crate::model::CloudRepoSourceContext>),
Gerrit(std::boxed::Box<crate::model::GerritSourceContext>),
Git(std::boxed::Box<crate::model::GitSourceContext>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AliasContext {
pub kind: crate::model::alias_context::Kind,
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AliasContext {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_kind<T: std::convert::Into<crate::model::alias_context::Kind>>(
mut self,
v: T,
) -> Self {
self.kind = v.into();
self
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for AliasContext {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.AliasContext"
}
}
pub mod alias_context {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Kind {
Unspecified,
Fixed,
Movable,
Other,
UnknownValue(kind::UnknownValue),
}
#[doc(hidden)]
pub mod kind {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Kind {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Fixed => std::option::Option::Some(1),
Self::Movable => std::option::Option::Some(2),
Self::Other => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("KIND_UNSPECIFIED"),
Self::Fixed => std::option::Option::Some("FIXED"),
Self::Movable => std::option::Option::Some("MOVABLE"),
Self::Other => std::option::Option::Some("OTHER"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Kind {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Kind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Kind {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Fixed,
2 => Self::Movable,
4 => Self::Other,
_ => Self::UnknownValue(kind::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Kind {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"KIND_UNSPECIFIED" => Self::Unspecified,
"FIXED" => Self::Fixed,
"MOVABLE" => Self::Movable,
"OTHER" => Self::Other,
_ => Self::UnknownValue(kind::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Kind {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Fixed => serializer.serialize_i32(1),
Self::Movable => serializer.serialize_i32(2),
Self::Other => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Kind {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Kind>::new(
".grafeas.v1.AliasContext.Kind",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CloudRepoSourceContext {
pub repo_id: std::option::Option<crate::model::RepoId>,
pub revision: std::option::Option<crate::model::cloud_repo_source_context::Revision>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CloudRepoSourceContext {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_repo_id<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RepoId>,
{
self.repo_id = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_repo_id<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RepoId>,
{
self.repo_id = v.map(|x| x.into());
self
}
pub fn set_revision<
T: std::convert::Into<std::option::Option<crate::model::cloud_repo_source_context::Revision>>,
>(
mut self,
v: T,
) -> Self {
self.revision = v.into();
self
}
pub fn revision_id(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.revision.as_ref().and_then(|v| match v {
crate::model::cloud_repo_source_context::Revision::RevisionId(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.revision = std::option::Option::Some(
crate::model::cloud_repo_source_context::Revision::RevisionId(v.into()),
);
self
}
pub fn alias_context(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::AliasContext>> {
#[allow(unreachable_patterns)]
self.revision.as_ref().and_then(|v| match v {
crate::model::cloud_repo_source_context::Revision::AliasContext(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_alias_context<T: std::convert::Into<std::boxed::Box<crate::model::AliasContext>>>(
mut self,
v: T,
) -> Self {
self.revision = std::option::Option::Some(
crate::model::cloud_repo_source_context::Revision::AliasContext(v.into()),
);
self
}
}
impl wkt::message::Message for CloudRepoSourceContext {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.CloudRepoSourceContext"
}
}
pub mod cloud_repo_source_context {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Revision {
RevisionId(std::string::String),
AliasContext(std::boxed::Box<crate::model::AliasContext>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GerritSourceContext {
pub host_uri: std::string::String,
pub gerrit_project: std::string::String,
pub revision: std::option::Option<crate::model::gerrit_source_context::Revision>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GerritSourceContext {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_host_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.host_uri = v.into();
self
}
pub fn set_gerrit_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.gerrit_project = v.into();
self
}
pub fn set_revision<
T: std::convert::Into<std::option::Option<crate::model::gerrit_source_context::Revision>>,
>(
mut self,
v: T,
) -> Self {
self.revision = v.into();
self
}
pub fn revision_id(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.revision.as_ref().and_then(|v| match v {
crate::model::gerrit_source_context::Revision::RevisionId(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.revision = std::option::Option::Some(
crate::model::gerrit_source_context::Revision::RevisionId(v.into()),
);
self
}
pub fn alias_context(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::AliasContext>> {
#[allow(unreachable_patterns)]
self.revision.as_ref().and_then(|v| match v {
crate::model::gerrit_source_context::Revision::AliasContext(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_alias_context<T: std::convert::Into<std::boxed::Box<crate::model::AliasContext>>>(
mut self,
v: T,
) -> Self {
self.revision = std::option::Option::Some(
crate::model::gerrit_source_context::Revision::AliasContext(v.into()),
);
self
}
}
impl wkt::message::Message for GerritSourceContext {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.GerritSourceContext"
}
}
pub mod gerrit_source_context {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Revision {
RevisionId(std::string::String),
AliasContext(std::boxed::Box<crate::model::AliasContext>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GitSourceContext {
pub url: std::string::String,
pub revision_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GitSourceContext {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.url = v.into();
self
}
pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.revision_id = v.into();
self
}
}
impl wkt::message::Message for GitSourceContext {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.GitSourceContext"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RepoId {
pub id: std::option::Option<crate::model::repo_id::Id>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RepoId {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_id<T: std::convert::Into<std::option::Option<crate::model::repo_id::Id>>>(
mut self,
v: T,
) -> Self {
self.id = v.into();
self
}
pub fn project_repo_id(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::ProjectRepoId>> {
#[allow(unreachable_patterns)]
self.id.as_ref().and_then(|v| match v {
crate::model::repo_id::Id::ProjectRepoId(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_project_repo_id<
T: std::convert::Into<std::boxed::Box<crate::model::ProjectRepoId>>,
>(
mut self,
v: T,
) -> Self {
self.id = std::option::Option::Some(crate::model::repo_id::Id::ProjectRepoId(v.into()));
self
}
pub fn uid(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.id.as_ref().and_then(|v| match v {
crate::model::repo_id::Id::Uid(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = std::option::Option::Some(crate::model::repo_id::Id::Uid(v.into()));
self
}
}
impl wkt::message::Message for RepoId {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.RepoId"
}
}
pub mod repo_id {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Id {
ProjectRepoId(std::boxed::Box<crate::model::ProjectRepoId>),
Uid(std::string::String),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ProjectRepoId {
pub project_id: std::string::String,
pub repo_name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ProjectRepoId {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
pub fn set_repo_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.repo_name = v.into();
self
}
}
impl wkt::message::Message for ProjectRepoId {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.ProjectRepoId"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Risk {
pub cisa_kev: std::option::Option<crate::model::CISAKnownExploitedVulnerabilities>,
pub epss: std::option::Option<crate::model::ExploitPredictionScoringSystem>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Risk {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_cisa_kev<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CISAKnownExploitedVulnerabilities>,
{
self.cisa_kev = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_cisa_kev<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CISAKnownExploitedVulnerabilities>,
{
self.cisa_kev = v.map(|x| x.into());
self
}
pub fn set_epss<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ExploitPredictionScoringSystem>,
{
self.epss = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_epss<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ExploitPredictionScoringSystem>,
{
self.epss = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Risk {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.Risk"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CISAKnownExploitedVulnerabilities {
pub known_ransomware_campaign_use: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CISAKnownExploitedVulnerabilities {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_known_ransomware_campaign_use<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.known_ransomware_campaign_use = v.into();
self
}
}
impl wkt::message::Message for CISAKnownExploitedVulnerabilities {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.CISAKnownExploitedVulnerabilities"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExploitPredictionScoringSystem {
pub percentile: f64,
pub score: f64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExploitPredictionScoringSystem {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_percentile<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.percentile = v.into();
self
}
pub fn set_score<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.score = v.into();
self
}
}
impl wkt::message::Message for ExploitPredictionScoringSystem {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.ExploitPredictionScoringSystem"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SBOMReferenceNote {
pub format: std::string::String,
pub version: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SBOMReferenceNote {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.format = v.into();
self
}
pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.version = v.into();
self
}
}
impl wkt::message::Message for SBOMReferenceNote {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SBOMReferenceNote"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SBOMReferenceOccurrence {
pub payload: std::option::Option<crate::model::SbomReferenceIntotoPayload>,
pub payload_type: std::string::String,
pub signatures: std::vec::Vec<crate::model::EnvelopeSignature>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SBOMReferenceOccurrence {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_payload<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SbomReferenceIntotoPayload>,
{
self.payload = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_payload<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SbomReferenceIntotoPayload>,
{
self.payload = v.map(|x| x.into());
self
}
pub fn set_payload_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.payload_type = v.into();
self
}
pub fn set_signatures<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::EnvelopeSignature>,
{
use std::iter::Iterator;
self.signatures = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for SBOMReferenceOccurrence {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SBOMReferenceOccurrence"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SbomReferenceIntotoPayload {
pub r#type: std::string::String,
pub predicate_type: std::string::String,
pub subject: std::vec::Vec<crate::model::Subject>,
pub predicate: std::option::Option<crate::model::SbomReferenceIntotoPredicate>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SbomReferenceIntotoPayload {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
pub fn set_predicate_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.predicate_type = v.into();
self
}
pub fn set_subject<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Subject>,
{
use std::iter::Iterator;
self.subject = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_predicate<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SbomReferenceIntotoPredicate>,
{
self.predicate = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_predicate<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SbomReferenceIntotoPredicate>,
{
self.predicate = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for SbomReferenceIntotoPayload {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SbomReferenceIntotoPayload"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SbomReferenceIntotoPredicate {
pub referrer_id: std::string::String,
pub location: std::string::String,
pub mime_type: std::string::String,
pub digest: std::collections::HashMap<std::string::String, std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SbomReferenceIntotoPredicate {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_referrer_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.referrer_id = v.into();
self
}
pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.location = v.into();
self
}
pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.mime_type = v.into();
self
}
pub fn set_digest<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.digest = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for SbomReferenceIntotoPredicate {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SbomReferenceIntotoPredicate"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SecretNote {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SecretNote {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for SecretNote {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SecretNote"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SecretOccurrence {
pub kind: crate::model::SecretKind,
pub locations: std::vec::Vec<crate::model::SecretLocation>,
pub statuses: std::vec::Vec<crate::model::SecretStatus>,
pub data: std::option::Option<wkt::Any>,
pub digest: std::option::Option<crate::model::Digest>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SecretOccurrence {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_kind<T: std::convert::Into<crate::model::SecretKind>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
pub fn set_locations<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SecretLocation>,
{
use std::iter::Iterator;
self.locations = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_statuses<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SecretStatus>,
{
use std::iter::Iterator;
self.statuses = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_data<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Any>,
{
self.data = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_data<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Any>,
{
self.data = v.map(|x| x.into());
self
}
pub fn set_digest<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Digest>,
{
self.digest = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_digest<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Digest>,
{
self.digest = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for SecretOccurrence {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SecretOccurrence"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SecretLocation {
pub location: std::option::Option<crate::model::secret_location::Location>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SecretLocation {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_location<
T: std::convert::Into<std::option::Option<crate::model::secret_location::Location>>,
>(
mut self,
v: T,
) -> Self {
self.location = v.into();
self
}
pub fn file_location(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::FileLocation>> {
#[allow(unreachable_patterns)]
self.location.as_ref().and_then(|v| match v {
crate::model::secret_location::Location::FileLocation(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_file_location<T: std::convert::Into<std::boxed::Box<crate::model::FileLocation>>>(
mut self,
v: T,
) -> Self {
self.location = std::option::Option::Some(
crate::model::secret_location::Location::FileLocation(v.into()),
);
self
}
}
impl wkt::message::Message for SecretLocation {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SecretLocation"
}
}
pub mod secret_location {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Location {
FileLocation(std::boxed::Box<crate::model::FileLocation>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SecretStatus {
pub status: crate::model::secret_status::Status,
pub update_time: std::option::Option<wkt::Timestamp>,
pub message: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SecretStatus {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_status<T: std::convert::Into<crate::model::secret_status::Status>>(
mut self,
v: T,
) -> Self {
self.status = v.into();
self
}
pub fn set_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = v.map(|x| x.into());
self
}
pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.message = v.into();
self
}
}
impl wkt::message::Message for SecretStatus {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SecretStatus"
}
}
pub mod secret_status {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Status {
Unspecified,
Unknown,
Valid,
Invalid,
UnknownValue(status::UnknownValue),
}
#[doc(hidden)]
pub mod status {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Status {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Unknown => std::option::Option::Some(1),
Self::Valid => std::option::Option::Some(2),
Self::Invalid => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STATUS_UNSPECIFIED"),
Self::Unknown => std::option::Option::Some("UNKNOWN"),
Self::Valid => std::option::Option::Some("VALID"),
Self::Invalid => std::option::Option::Some("INVALID"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Status {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Status {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Status {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Unknown,
2 => Self::Valid,
3 => Self::Invalid,
_ => Self::UnknownValue(status::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Status {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STATUS_UNSPECIFIED" => Self::Unspecified,
"UNKNOWN" => Self::Unknown,
"VALID" => Self::Valid,
"INVALID" => Self::Invalid,
_ => Self::UnknownValue(status::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Status {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Unknown => serializer.serialize_i32(1),
Self::Valid => serializer.serialize_i32(2),
Self::Invalid => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Status {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Status>::new(
".grafeas.v1.SecretStatus.Status",
))
}
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SlsaProvenance {
#[allow(missing_docs)]
pub builder: std::option::Option<crate::model::slsa_provenance::SlsaBuilder>,
pub recipe: std::option::Option<crate::model::slsa_provenance::SlsaRecipe>,
#[allow(missing_docs)]
pub metadata: std::option::Option<crate::model::slsa_provenance::SlsaMetadata>,
pub materials: std::vec::Vec<crate::model::slsa_provenance::Material>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SlsaProvenance {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_builder<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::slsa_provenance::SlsaBuilder>,
{
self.builder = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_builder<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::slsa_provenance::SlsaBuilder>,
{
self.builder = v.map(|x| x.into());
self
}
pub fn set_recipe<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::slsa_provenance::SlsaRecipe>,
{
self.recipe = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_recipe<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::slsa_provenance::SlsaRecipe>,
{
self.recipe = v.map(|x| x.into());
self
}
pub fn set_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::slsa_provenance::SlsaMetadata>,
{
self.metadata = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::slsa_provenance::SlsaMetadata>,
{
self.metadata = v.map(|x| x.into());
self
}
pub fn set_materials<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::slsa_provenance::Material>,
{
use std::iter::Iterator;
self.materials = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for SlsaProvenance {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SlsaProvenance"
}
}
pub mod slsa_provenance {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SlsaRecipe {
pub r#type: std::string::String,
pub defined_in_material: i64,
pub entry_point: std::string::String,
pub arguments: std::option::Option<wkt::Any>,
pub environment: std::option::Option<wkt::Any>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SlsaRecipe {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
pub fn set_defined_in_material<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.defined_in_material = v.into();
self
}
pub fn set_entry_point<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.entry_point = v.into();
self
}
pub fn set_arguments<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Any>,
{
self.arguments = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_arguments<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Any>,
{
self.arguments = v.map(|x| x.into());
self
}
pub fn set_environment<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Any>,
{
self.environment = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_environment<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Any>,
{
self.environment = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for SlsaRecipe {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SlsaProvenance.SlsaRecipe"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SlsaCompleteness {
pub arguments: bool,
pub environment: bool,
pub materials: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SlsaCompleteness {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_arguments<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.arguments = v.into();
self
}
pub fn set_environment<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.environment = v.into();
self
}
pub fn set_materials<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.materials = v.into();
self
}
}
impl wkt::message::Message for SlsaCompleteness {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SlsaProvenance.SlsaCompleteness"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SlsaMetadata {
pub build_invocation_id: std::string::String,
pub build_started_on: std::option::Option<wkt::Timestamp>,
pub build_finished_on: std::option::Option<wkt::Timestamp>,
pub completeness: std::option::Option<crate::model::slsa_provenance::SlsaCompleteness>,
pub reproducible: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SlsaMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_build_invocation_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.build_invocation_id = v.into();
self
}
pub fn set_build_started_on<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.build_started_on = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_build_started_on<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.build_started_on = v.map(|x| x.into());
self
}
pub fn set_build_finished_on<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.build_finished_on = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_build_finished_on<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.build_finished_on = v.map(|x| x.into());
self
}
pub fn set_completeness<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::slsa_provenance::SlsaCompleteness>,
{
self.completeness = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_completeness<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::slsa_provenance::SlsaCompleteness>,
{
self.completeness = v.map(|x| x.into());
self
}
pub fn set_reproducible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.reproducible = v.into();
self
}
}
impl wkt::message::Message for SlsaMetadata {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SlsaProvenance.SlsaMetadata"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SlsaBuilder {
#[allow(missing_docs)]
pub id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SlsaBuilder {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
}
impl wkt::message::Message for SlsaBuilder {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SlsaProvenance.SlsaBuilder"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Material {
#[allow(missing_docs)]
pub uri: std::string::String,
#[allow(missing_docs)]
pub digest: std::collections::HashMap<std::string::String, std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Material {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uri = v.into();
self
}
pub fn set_digest<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.digest = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for Material {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SlsaProvenance.Material"
}
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SlsaProvenanceZeroTwo {
#[allow(missing_docs)]
pub builder: std::option::Option<crate::model::slsa_provenance_zero_two::SlsaBuilder>,
#[allow(missing_docs)]
pub build_type: std::string::String,
#[allow(missing_docs)]
pub invocation: std::option::Option<crate::model::slsa_provenance_zero_two::SlsaInvocation>,
#[allow(missing_docs)]
pub build_config: std::option::Option<wkt::Struct>,
#[allow(missing_docs)]
pub metadata: std::option::Option<crate::model::slsa_provenance_zero_two::SlsaMetadata>,
#[allow(missing_docs)]
pub materials: std::vec::Vec<crate::model::slsa_provenance_zero_two::SlsaMaterial>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SlsaProvenanceZeroTwo {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_builder<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaBuilder>,
{
self.builder = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_builder<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaBuilder>,
{
self.builder = v.map(|x| x.into());
self
}
pub fn set_build_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.build_type = v.into();
self
}
pub fn set_invocation<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaInvocation>,
{
self.invocation = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_invocation<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaInvocation>,
{
self.invocation = v.map(|x| x.into());
self
}
pub fn set_build_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.build_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_build_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.build_config = v.map(|x| x.into());
self
}
pub fn set_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaMetadata>,
{
self.metadata = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaMetadata>,
{
self.metadata = v.map(|x| x.into());
self
}
pub fn set_materials<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaMaterial>,
{
use std::iter::Iterator;
self.materials = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for SlsaProvenanceZeroTwo {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SlsaProvenanceZeroTwo"
}
}
pub mod slsa_provenance_zero_two {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SlsaBuilder {
#[allow(missing_docs)]
pub id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SlsaBuilder {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
}
impl wkt::message::Message for SlsaBuilder {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SlsaProvenanceZeroTwo.SlsaBuilder"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SlsaMaterial {
#[allow(missing_docs)]
pub uri: std::string::String,
#[allow(missing_docs)]
pub digest: std::collections::HashMap<std::string::String, std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SlsaMaterial {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uri = v.into();
self
}
pub fn set_digest<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.digest = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for SlsaMaterial {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SlsaProvenanceZeroTwo.SlsaMaterial"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SlsaInvocation {
#[allow(missing_docs)]
pub config_source:
std::option::Option<crate::model::slsa_provenance_zero_two::SlsaConfigSource>,
#[allow(missing_docs)]
pub parameters: std::option::Option<wkt::Struct>,
#[allow(missing_docs)]
pub environment: std::option::Option<wkt::Struct>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SlsaInvocation {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_config_source<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaConfigSource>,
{
self.config_source = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_config_source<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaConfigSource>,
{
self.config_source = v.map(|x| x.into());
self
}
pub fn set_parameters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.parameters = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.parameters = v.map(|x| x.into());
self
}
pub fn set_environment<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.environment = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_environment<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.environment = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for SlsaInvocation {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SlsaProvenanceZeroTwo.SlsaInvocation"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SlsaConfigSource {
#[allow(missing_docs)]
pub uri: std::string::String,
#[allow(missing_docs)]
pub digest: std::collections::HashMap<std::string::String, std::string::String>,
#[allow(missing_docs)]
pub entry_point: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SlsaConfigSource {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uri = v.into();
self
}
pub fn set_digest<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.digest = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_entry_point<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.entry_point = v.into();
self
}
}
impl wkt::message::Message for SlsaConfigSource {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SlsaProvenanceZeroTwo.SlsaConfigSource"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SlsaMetadata {
#[allow(missing_docs)]
pub build_invocation_id: std::string::String,
#[allow(missing_docs)]
pub build_started_on: std::option::Option<wkt::Timestamp>,
#[allow(missing_docs)]
pub build_finished_on: std::option::Option<wkt::Timestamp>,
#[allow(missing_docs)]
pub completeness:
std::option::Option<crate::model::slsa_provenance_zero_two::SlsaCompleteness>,
#[allow(missing_docs)]
pub reproducible: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SlsaMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_build_invocation_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.build_invocation_id = v.into();
self
}
pub fn set_build_started_on<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.build_started_on = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_build_started_on<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.build_started_on = v.map(|x| x.into());
self
}
pub fn set_build_finished_on<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.build_finished_on = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_build_finished_on<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.build_finished_on = v.map(|x| x.into());
self
}
pub fn set_completeness<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaCompleteness>,
{
self.completeness = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_completeness<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaCompleteness>,
{
self.completeness = v.map(|x| x.into());
self
}
pub fn set_reproducible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.reproducible = v.into();
self
}
}
impl wkt::message::Message for SlsaMetadata {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SlsaProvenanceZeroTwo.SlsaMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SlsaCompleteness {
#[allow(missing_docs)]
pub parameters: bool,
#[allow(missing_docs)]
pub environment: bool,
#[allow(missing_docs)]
pub materials: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SlsaCompleteness {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parameters<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.parameters = v.into();
self
}
pub fn set_environment<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.environment = v.into();
self
}
pub fn set_materials<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.materials = v.into();
self
}
}
impl wkt::message::Message for SlsaCompleteness {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.SlsaProvenanceZeroTwo.SlsaCompleteness"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpgradeNote {
pub package: std::string::String,
pub version: std::option::Option<crate::model::Version>,
pub distributions: std::vec::Vec<crate::model::UpgradeDistribution>,
pub windows_update: std::option::Option<crate::model::WindowsUpdate>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpgradeNote {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.package = v.into();
self
}
pub fn set_version<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.version = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.version = v.map(|x| x.into());
self
}
pub fn set_distributions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::UpgradeDistribution>,
{
use std::iter::Iterator;
self.distributions = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_windows_update<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::WindowsUpdate>,
{
self.windows_update = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_windows_update<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::WindowsUpdate>,
{
self.windows_update = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpgradeNote {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.UpgradeNote"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpgradeDistribution {
pub cpe_uri: std::string::String,
pub classification: std::string::String,
pub severity: std::string::String,
pub cve: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpgradeDistribution {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_cpe_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.cpe_uri = v.into();
self
}
pub fn set_classification<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.classification = v.into();
self
}
pub fn set_severity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.severity = v.into();
self
}
pub fn set_cve<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.cve = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for UpgradeDistribution {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.UpgradeDistribution"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct WindowsUpdate {
pub identity: std::option::Option<crate::model::windows_update::Identity>,
pub title: std::string::String,
pub description: std::string::String,
pub categories: std::vec::Vec<crate::model::windows_update::Category>,
pub kb_article_ids: std::vec::Vec<std::string::String>,
pub support_url: std::string::String,
pub last_published_timestamp: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl WindowsUpdate {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_identity<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::windows_update::Identity>,
{
self.identity = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_identity<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::windows_update::Identity>,
{
self.identity = v.map(|x| x.into());
self
}
pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.title = v.into();
self
}
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
pub fn set_categories<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::windows_update::Category>,
{
use std::iter::Iterator;
self.categories = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_kb_article_ids<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.kb_article_ids = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_support_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.support_url = v.into();
self
}
pub fn set_last_published_timestamp<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.last_published_timestamp = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_last_published_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.last_published_timestamp = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for WindowsUpdate {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.WindowsUpdate"
}
}
pub mod windows_update {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Identity {
pub update_id: std::string::String,
pub revision: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Identity {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_update_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.update_id = v.into();
self
}
pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.revision = v.into();
self
}
}
impl wkt::message::Message for Identity {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.WindowsUpdate.Identity"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Category {
pub category_id: std::string::String,
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Category {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_category_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.category_id = v.into();
self
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for Category {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.WindowsUpdate.Category"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpgradeOccurrence {
pub package: std::string::String,
pub parsed_version: std::option::Option<crate::model::Version>,
pub distribution: std::option::Option<crate::model::UpgradeDistribution>,
pub windows_update: std::option::Option<crate::model::WindowsUpdate>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpgradeOccurrence {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.package = v.into();
self
}
pub fn set_parsed_version<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.parsed_version = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_parsed_version<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.parsed_version = v.map(|x| x.into());
self
}
pub fn set_distribution<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::UpgradeDistribution>,
{
self.distribution = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_distribution<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::UpgradeDistribution>,
{
self.distribution = v.map(|x| x.into());
self
}
pub fn set_windows_update<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::WindowsUpdate>,
{
self.windows_update = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_windows_update<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::WindowsUpdate>,
{
self.windows_update = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpgradeOccurrence {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.UpgradeOccurrence"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct VulnerabilityAssessmentNote {
pub title: std::string::String,
pub short_description: std::string::String,
pub long_description: std::string::String,
pub language_code: std::string::String,
pub publisher: std::option::Option<crate::model::vulnerability_assessment_note::Publisher>,
pub product: std::option::Option<crate::model::vulnerability_assessment_note::Product>,
pub assessment: std::option::Option<crate::model::vulnerability_assessment_note::Assessment>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl VulnerabilityAssessmentNote {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.title = v.into();
self
}
pub fn set_short_description<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.short_description = v.into();
self
}
pub fn set_long_description<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.long_description = v.into();
self
}
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
pub fn set_publisher<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::vulnerability_assessment_note::Publisher>,
{
self.publisher = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_publisher<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::vulnerability_assessment_note::Publisher>,
{
self.publisher = v.map(|x| x.into());
self
}
pub fn set_product<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::vulnerability_assessment_note::Product>,
{
self.product = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::vulnerability_assessment_note::Product>,
{
self.product = v.map(|x| x.into());
self
}
pub fn set_assessment<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::vulnerability_assessment_note::Assessment>,
{
self.assessment = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_assessment<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::vulnerability_assessment_note::Assessment>,
{
self.assessment = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for VulnerabilityAssessmentNote {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.VulnerabilityAssessmentNote"
}
}
pub mod vulnerability_assessment_note {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Publisher {
pub name: std::string::String,
pub issuing_authority: std::string::String,
pub publisher_namespace: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Publisher {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_issuing_authority<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.issuing_authority = v.into();
self
}
pub fn set_publisher_namespace<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.publisher_namespace = v.into();
self
}
}
impl wkt::message::Message for Publisher {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.VulnerabilityAssessmentNote.Publisher"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Product {
pub name: std::string::String,
pub id: std::string::String,
#[allow(missing_docs)]
pub identifier:
std::option::Option<crate::model::vulnerability_assessment_note::product::Identifier>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Product {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
pub fn set_identifier<
T: std::convert::Into<
std::option::Option<
crate::model::vulnerability_assessment_note::product::Identifier,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.identifier = v.into();
self
}
pub fn generic_uri(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.identifier.as_ref().and_then(|v| match v {
crate::model::vulnerability_assessment_note::product::Identifier::GenericUri(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_generic_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.identifier = std::option::Option::Some(
crate::model::vulnerability_assessment_note::product::Identifier::GenericUri(
v.into(),
),
);
self
}
}
impl wkt::message::Message for Product {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.VulnerabilityAssessmentNote.Product"
}
}
pub mod product {
#[allow(unused_imports)]
use super::*;
#[allow(missing_docs)]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Identifier {
GenericUri(std::string::String),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Assessment {
#[deprecated]
pub cve: std::string::String,
pub vulnerability_id: std::string::String,
pub short_description: std::string::String,
pub long_description: std::string::String,
pub related_uris: std::vec::Vec<crate::model::RelatedUrl>,
pub state: crate::model::vulnerability_assessment_note::assessment::State,
pub impacts: std::vec::Vec<std::string::String>,
pub justification: std::option::Option<
crate::model::vulnerability_assessment_note::assessment::Justification,
>,
pub remediations:
std::vec::Vec<crate::model::vulnerability_assessment_note::assessment::Remediation>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Assessment {
pub fn new() -> Self {
std::default::Default::default()
}
#[deprecated]
pub fn set_cve<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.cve = v.into();
self
}
pub fn set_vulnerability_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.vulnerability_id = v.into();
self
}
pub fn set_short_description<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.short_description = v.into();
self
}
pub fn set_long_description<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.long_description = v.into();
self
}
pub fn set_related_uris<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::RelatedUrl>,
{
use std::iter::Iterator;
self.related_uris = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_state<
T: std::convert::Into<crate::model::vulnerability_assessment_note::assessment::State>,
>(
mut self,
v: T,
) -> Self {
self.state = v.into();
self
}
pub fn set_impacts<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.impacts = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_justification<T>(mut self, v: T) -> Self
where
T: std::convert::Into<
crate::model::vulnerability_assessment_note::assessment::Justification,
>,
{
self.justification = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_justification<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<
crate::model::vulnerability_assessment_note::assessment::Justification,
>,
{
self.justification = v.map(|x| x.into());
self
}
pub fn set_remediations<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::vulnerability_assessment_note::assessment::Remediation,
>,
{
use std::iter::Iterator;
self.remediations = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for Assessment {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.VulnerabilityAssessmentNote.Assessment"
}
}
pub mod assessment {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Justification {
pub justification_type: crate::model::vulnerability_assessment_note::assessment::justification::JustificationType,
pub details: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Justification {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_justification_type<T: std::convert::Into<crate::model::vulnerability_assessment_note::assessment::justification::JustificationType>>(mut self, v: T) -> Self{
self.justification_type = v.into();
self
}
pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.details = v.into();
self
}
}
impl wkt::message::Message for Justification {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.VulnerabilityAssessmentNote.Assessment.Justification"
}
}
pub mod justification {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum JustificationType {
Unspecified,
ComponentNotPresent,
VulnerableCodeNotPresent,
VulnerableCodeNotInExecutePath,
VulnerableCodeCannotBeControlledByAdversary,
InlineMitigationsAlreadyExist,
UnknownValue(justification_type::UnknownValue),
}
#[doc(hidden)]
pub mod justification_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl JustificationType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::ComponentNotPresent => std::option::Option::Some(1),
Self::VulnerableCodeNotPresent => std::option::Option::Some(2),
Self::VulnerableCodeNotInExecutePath => std::option::Option::Some(3),
Self::VulnerableCodeCannotBeControlledByAdversary => {
std::option::Option::Some(4)
}
Self::InlineMitigationsAlreadyExist => std::option::Option::Some(5),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("JUSTIFICATION_TYPE_UNSPECIFIED")
}
Self::ComponentNotPresent => {
std::option::Option::Some("COMPONENT_NOT_PRESENT")
}
Self::VulnerableCodeNotPresent => {
std::option::Option::Some("VULNERABLE_CODE_NOT_PRESENT")
}
Self::VulnerableCodeNotInExecutePath => {
std::option::Option::Some("VULNERABLE_CODE_NOT_IN_EXECUTE_PATH")
}
Self::VulnerableCodeCannotBeControlledByAdversary => {
std::option::Option::Some(
"VULNERABLE_CODE_CANNOT_BE_CONTROLLED_BY_ADVERSARY",
)
}
Self::InlineMitigationsAlreadyExist => {
std::option::Option::Some("INLINE_MITIGATIONS_ALREADY_EXIST")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for JustificationType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for JustificationType {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for JustificationType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::ComponentNotPresent,
2 => Self::VulnerableCodeNotPresent,
3 => Self::VulnerableCodeNotInExecutePath,
4 => Self::VulnerableCodeCannotBeControlledByAdversary,
5 => Self::InlineMitigationsAlreadyExist,
_ => Self::UnknownValue(justification_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for JustificationType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"JUSTIFICATION_TYPE_UNSPECIFIED" => Self::Unspecified,
"COMPONENT_NOT_PRESENT" => Self::ComponentNotPresent,
"VULNERABLE_CODE_NOT_PRESENT" => Self::VulnerableCodeNotPresent,
"VULNERABLE_CODE_NOT_IN_EXECUTE_PATH" => {
Self::VulnerableCodeNotInExecutePath
}
"VULNERABLE_CODE_CANNOT_BE_CONTROLLED_BY_ADVERSARY" => {
Self::VulnerableCodeCannotBeControlledByAdversary
}
"INLINE_MITIGATIONS_ALREADY_EXIST" => Self::InlineMitigationsAlreadyExist,
_ => Self::UnknownValue(justification_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for JustificationType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::ComponentNotPresent => serializer.serialize_i32(1),
Self::VulnerableCodeNotPresent => serializer.serialize_i32(2),
Self::VulnerableCodeNotInExecutePath => serializer.serialize_i32(3),
Self::VulnerableCodeCannotBeControlledByAdversary => {
serializer.serialize_i32(4)
}
Self::InlineMitigationsAlreadyExist => serializer.serialize_i32(5),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for JustificationType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<JustificationType>::new(
".grafeas.v1.VulnerabilityAssessmentNote.Assessment.Justification.JustificationType"))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Remediation {
pub remediation_type: crate::model::vulnerability_assessment_note::assessment::remediation::RemediationType,
pub details: std::string::String,
pub remediation_uri: std::option::Option<crate::model::RelatedUrl>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Remediation {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_remediation_type<T: std::convert::Into<crate::model::vulnerability_assessment_note::assessment::remediation::RemediationType>>(mut self, v: T) -> Self{
self.remediation_type = v.into();
self
}
pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.details = v.into();
self
}
pub fn set_remediation_uri<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RelatedUrl>,
{
self.remediation_uri = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_remediation_uri<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RelatedUrl>,
{
self.remediation_uri = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Remediation {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.VulnerabilityAssessmentNote.Assessment.Remediation"
}
}
pub mod remediation {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RemediationType {
Unspecified,
Mitigation,
NoFixPlanned,
NoneAvailable,
VendorFix,
Workaround,
UnknownValue(remediation_type::UnknownValue),
}
#[doc(hidden)]
pub mod remediation_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl RemediationType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Mitigation => std::option::Option::Some(1),
Self::NoFixPlanned => std::option::Option::Some(2),
Self::NoneAvailable => std::option::Option::Some(3),
Self::VendorFix => std::option::Option::Some(4),
Self::Workaround => std::option::Option::Some(5),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("REMEDIATION_TYPE_UNSPECIFIED")
}
Self::Mitigation => std::option::Option::Some("MITIGATION"),
Self::NoFixPlanned => std::option::Option::Some("NO_FIX_PLANNED"),
Self::NoneAvailable => std::option::Option::Some("NONE_AVAILABLE"),
Self::VendorFix => std::option::Option::Some("VENDOR_FIX"),
Self::Workaround => std::option::Option::Some("WORKAROUND"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for RemediationType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for RemediationType {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for RemediationType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Mitigation,
2 => Self::NoFixPlanned,
3 => Self::NoneAvailable,
4 => Self::VendorFix,
5 => Self::Workaround,
_ => Self::UnknownValue(remediation_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for RemediationType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"REMEDIATION_TYPE_UNSPECIFIED" => Self::Unspecified,
"MITIGATION" => Self::Mitigation,
"NO_FIX_PLANNED" => Self::NoFixPlanned,
"NONE_AVAILABLE" => Self::NoneAvailable,
"VENDOR_FIX" => Self::VendorFix,
"WORKAROUND" => Self::Workaround,
_ => Self::UnknownValue(remediation_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for RemediationType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Mitigation => serializer.serialize_i32(1),
Self::NoFixPlanned => serializer.serialize_i32(2),
Self::NoneAvailable => serializer.serialize_i32(3),
Self::VendorFix => serializer.serialize_i32(4),
Self::Workaround => serializer.serialize_i32(5),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for RemediationType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<RemediationType>::new(
".grafeas.v1.VulnerabilityAssessmentNote.Assessment.Remediation.RemediationType"))
}
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
Unspecified,
Affected,
NotAffected,
Fixed,
UnderInvestigation,
UnknownValue(state::UnknownValue),
}
#[doc(hidden)]
pub mod state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl State {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Affected => std::option::Option::Some(1),
Self::NotAffected => std::option::Option::Some(2),
Self::Fixed => std::option::Option::Some(3),
Self::UnderInvestigation => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
Self::Affected => std::option::Option::Some("AFFECTED"),
Self::NotAffected => std::option::Option::Some("NOT_AFFECTED"),
Self::Fixed => std::option::Option::Some("FIXED"),
Self::UnderInvestigation => std::option::Option::Some("UNDER_INVESTIGATION"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for State {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for State {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for State {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Affected,
2 => Self::NotAffected,
3 => Self::Fixed,
4 => Self::UnderInvestigation,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for State {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STATE_UNSPECIFIED" => Self::Unspecified,
"AFFECTED" => Self::Affected,
"NOT_AFFECTED" => Self::NotAffected,
"FIXED" => Self::Fixed,
"UNDER_INVESTIGATION" => Self::UnderInvestigation,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for State {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Affected => serializer.serialize_i32(1),
Self::NotAffected => serializer.serialize_i32(2),
Self::Fixed => serializer.serialize_i32(3),
Self::UnderInvestigation => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for State {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
".grafeas.v1.VulnerabilityAssessmentNote.Assessment.State",
))
}
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct VulnerabilityNote {
pub cvss_score: f32,
pub severity: crate::model::Severity,
pub details: std::vec::Vec<crate::model::vulnerability_note::Detail>,
pub cvss_v3: std::option::Option<crate::model::CVSSv3>,
pub windows_details: std::vec::Vec<crate::model::vulnerability_note::WindowsDetail>,
pub source_update_time: std::option::Option<wkt::Timestamp>,
pub cvss_version: crate::model::CVSSVersion,
pub cvss_v2: std::option::Option<crate::model::Cvss>,
pub advisory_publish_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl VulnerabilityNote {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_cvss_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.cvss_score = v.into();
self
}
pub fn set_severity<T: std::convert::Into<crate::model::Severity>>(mut self, v: T) -> Self {
self.severity = v.into();
self
}
pub fn set_details<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::vulnerability_note::Detail>,
{
use std::iter::Iterator;
self.details = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_cvss_v3<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CVSSv3>,
{
self.cvss_v3 = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_cvss_v3<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CVSSv3>,
{
self.cvss_v3 = v.map(|x| x.into());
self
}
pub fn set_windows_details<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::vulnerability_note::WindowsDetail>,
{
use std::iter::Iterator;
self.windows_details = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_source_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.source_update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_source_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.source_update_time = v.map(|x| x.into());
self
}
pub fn set_cvss_version<T: std::convert::Into<crate::model::CVSSVersion>>(
mut self,
v: T,
) -> Self {
self.cvss_version = v.into();
self
}
pub fn set_cvss_v2<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Cvss>,
{
self.cvss_v2 = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_cvss_v2<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Cvss>,
{
self.cvss_v2 = v.map(|x| x.into());
self
}
pub fn set_advisory_publish_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.advisory_publish_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_advisory_publish_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.advisory_publish_time = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for VulnerabilityNote {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.VulnerabilityNote"
}
}
pub mod vulnerability_note {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Detail {
pub severity_name: std::string::String,
pub description: std::string::String,
pub package_type: std::string::String,
pub affected_cpe_uri: std::string::String,
pub affected_package: std::string::String,
pub affected_version_start: std::option::Option<crate::model::Version>,
pub affected_version_end: std::option::Option<crate::model::Version>,
pub fixed_cpe_uri: std::string::String,
pub fixed_package: std::string::String,
pub fixed_version: std::option::Option<crate::model::Version>,
pub is_obsolete: bool,
pub source_update_time: std::option::Option<wkt::Timestamp>,
pub source: std::string::String,
pub vendor: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Detail {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_severity_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.severity_name = v.into();
self
}
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
pub fn set_package_type<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.package_type = v.into();
self
}
pub fn set_affected_cpe_uri<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.affected_cpe_uri = v.into();
self
}
pub fn set_affected_package<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.affected_package = v.into();
self
}
pub fn set_affected_version_start<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.affected_version_start = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_affected_version_start<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.affected_version_start = v.map(|x| x.into());
self
}
pub fn set_affected_version_end<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.affected_version_end = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_affected_version_end<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.affected_version_end = v.map(|x| x.into());
self
}
pub fn set_fixed_cpe_uri<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.fixed_cpe_uri = v.into();
self
}
pub fn set_fixed_package<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.fixed_package = v.into();
self
}
pub fn set_fixed_version<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.fixed_version = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_fixed_version<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.fixed_version = v.map(|x| x.into());
self
}
pub fn set_is_obsolete<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.is_obsolete = v.into();
self
}
pub fn set_source_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.source_update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_source_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.source_update_time = v.map(|x| x.into());
self
}
pub fn set_source<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.source = v.into();
self
}
pub fn set_vendor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.vendor = v.into();
self
}
}
impl wkt::message::Message for Detail {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.VulnerabilityNote.Detail"
}
}
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct WindowsDetail {
pub cpe_uri: std::string::String,
pub name: std::string::String,
pub description: std::string::String,
pub fixing_kbs:
std::vec::Vec<crate::model::vulnerability_note::windows_detail::KnowledgeBase>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl WindowsDetail {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_cpe_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.cpe_uri = v.into();
self
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
pub fn set_fixing_kbs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::vulnerability_note::windows_detail::KnowledgeBase>,
{
use std::iter::Iterator;
self.fixing_kbs = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for WindowsDetail {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.VulnerabilityNote.WindowsDetail"
}
}
pub mod windows_detail {
#[allow(unused_imports)]
use super::*;
#[allow(missing_docs)]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct KnowledgeBase {
pub name: std::string::String,
pub url: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl KnowledgeBase {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.url = v.into();
self
}
}
impl wkt::message::Message for KnowledgeBase {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.VulnerabilityNote.WindowsDetail.KnowledgeBase"
}
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct VulnerabilityOccurrence {
pub r#type: std::string::String,
pub severity: crate::model::Severity,
pub cvss_score: f32,
pub cvssv3: std::option::Option<crate::model::Cvss>,
pub package_issue: std::vec::Vec<crate::model::vulnerability_occurrence::PackageIssue>,
pub short_description: std::string::String,
pub long_description: std::string::String,
pub related_urls: std::vec::Vec<crate::model::RelatedUrl>,
pub effective_severity: crate::model::Severity,
pub fix_available: bool,
pub cvss_version: crate::model::CVSSVersion,
pub cvss_v2: std::option::Option<crate::model::Cvss>,
#[allow(missing_docs)]
pub vex_assessment: std::option::Option<crate::model::vulnerability_occurrence::VexAssessment>,
pub extra_details: std::string::String,
pub risk: std::option::Option<crate::model::Risk>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl VulnerabilityOccurrence {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
pub fn set_severity<T: std::convert::Into<crate::model::Severity>>(mut self, v: T) -> Self {
self.severity = v.into();
self
}
pub fn set_cvss_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.cvss_score = v.into();
self
}
pub fn set_cvssv3<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Cvss>,
{
self.cvssv3 = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_cvssv3<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Cvss>,
{
self.cvssv3 = v.map(|x| x.into());
self
}
pub fn set_package_issue<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::vulnerability_occurrence::PackageIssue>,
{
use std::iter::Iterator;
self.package_issue = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_short_description<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.short_description = v.into();
self
}
pub fn set_long_description<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.long_description = v.into();
self
}
pub fn set_related_urls<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::RelatedUrl>,
{
use std::iter::Iterator;
self.related_urls = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_effective_severity<T: std::convert::Into<crate::model::Severity>>(
mut self,
v: T,
) -> Self {
self.effective_severity = v.into();
self
}
pub fn set_fix_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.fix_available = v.into();
self
}
pub fn set_cvss_version<T: std::convert::Into<crate::model::CVSSVersion>>(
mut self,
v: T,
) -> Self {
self.cvss_version = v.into();
self
}
pub fn set_cvss_v2<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Cvss>,
{
self.cvss_v2 = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_cvss_v2<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Cvss>,
{
self.cvss_v2 = v.map(|x| x.into());
self
}
pub fn set_vex_assessment<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::vulnerability_occurrence::VexAssessment>,
{
self.vex_assessment = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_vex_assessment<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::vulnerability_occurrence::VexAssessment>,
{
self.vex_assessment = v.map(|x| x.into());
self
}
pub fn set_extra_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.extra_details = v.into();
self
}
pub fn set_risk<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Risk>,
{
self.risk = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_risk<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Risk>,
{
self.risk = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for VulnerabilityOccurrence {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.VulnerabilityOccurrence"
}
}
pub mod vulnerability_occurrence {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PackageIssue {
pub affected_cpe_uri: std::string::String,
pub affected_package: std::string::String,
pub affected_version: std::option::Option<crate::model::Version>,
pub fixed_cpe_uri: std::string::String,
pub fixed_package: std::string::String,
pub fixed_version: std::option::Option<crate::model::Version>,
pub fix_available: bool,
pub package_type: std::string::String,
pub effective_severity: crate::model::Severity,
pub file_location: std::vec::Vec<crate::model::FileLocation>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PackageIssue {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_affected_cpe_uri<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.affected_cpe_uri = v.into();
self
}
pub fn set_affected_package<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.affected_package = v.into();
self
}
pub fn set_affected_version<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.affected_version = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_affected_version<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.affected_version = v.map(|x| x.into());
self
}
pub fn set_fixed_cpe_uri<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.fixed_cpe_uri = v.into();
self
}
pub fn set_fixed_package<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.fixed_package = v.into();
self
}
pub fn set_fixed_version<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.fixed_version = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_fixed_version<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.fixed_version = v.map(|x| x.into());
self
}
pub fn set_fix_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.fix_available = v.into();
self
}
pub fn set_package_type<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.package_type = v.into();
self
}
pub fn set_effective_severity<T: std::convert::Into<crate::model::Severity>>(
mut self,
v: T,
) -> Self {
self.effective_severity = v.into();
self
}
pub fn set_file_location<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::FileLocation>,
{
use std::iter::Iterator;
self.file_location = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for PackageIssue {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.VulnerabilityOccurrence.PackageIssue"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct VexAssessment {
#[deprecated]
pub cve: std::string::String,
pub vulnerability_id: std::string::String,
pub related_uris: std::vec::Vec<crate::model::RelatedUrl>,
pub note_name: std::string::String,
pub state: crate::model::vulnerability_assessment_note::assessment::State,
pub impacts: std::vec::Vec<std::string::String>,
pub remediations:
std::vec::Vec<crate::model::vulnerability_assessment_note::assessment::Remediation>,
pub justification: std::option::Option<
crate::model::vulnerability_assessment_note::assessment::Justification,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl VexAssessment {
pub fn new() -> Self {
std::default::Default::default()
}
#[deprecated]
pub fn set_cve<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.cve = v.into();
self
}
pub fn set_vulnerability_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.vulnerability_id = v.into();
self
}
pub fn set_related_uris<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::RelatedUrl>,
{
use std::iter::Iterator;
self.related_uris = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_note_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.note_name = v.into();
self
}
pub fn set_state<
T: std::convert::Into<crate::model::vulnerability_assessment_note::assessment::State>,
>(
mut self,
v: T,
) -> Self {
self.state = v.into();
self
}
pub fn set_impacts<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.impacts = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_remediations<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::vulnerability_assessment_note::assessment::Remediation,
>,
{
use std::iter::Iterator;
self.remediations = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_justification<T>(mut self, v: T) -> Self
where
T: std::convert::Into<
crate::model::vulnerability_assessment_note::assessment::Justification,
>,
{
self.justification = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_justification<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<
crate::model::vulnerability_assessment_note::assessment::Justification,
>,
{
self.justification = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for VexAssessment {
fn typename() -> &'static str {
"type.googleapis.com/grafeas.v1.VulnerabilityOccurrence.VexAssessment"
}
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum NoteKind {
Unspecified,
Vulnerability,
Build,
Image,
Package,
Deployment,
Discovery,
Attestation,
Upgrade,
Compliance,
DsseAttestation,
VulnerabilityAssessment,
SbomReference,
Secret,
UnknownValue(note_kind::UnknownValue),
}
#[doc(hidden)]
pub mod note_kind {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl NoteKind {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Vulnerability => std::option::Option::Some(1),
Self::Build => std::option::Option::Some(2),
Self::Image => std::option::Option::Some(3),
Self::Package => std::option::Option::Some(4),
Self::Deployment => std::option::Option::Some(5),
Self::Discovery => std::option::Option::Some(6),
Self::Attestation => std::option::Option::Some(7),
Self::Upgrade => std::option::Option::Some(8),
Self::Compliance => std::option::Option::Some(9),
Self::DsseAttestation => std::option::Option::Some(10),
Self::VulnerabilityAssessment => std::option::Option::Some(11),
Self::SbomReference => std::option::Option::Some(12),
Self::Secret => std::option::Option::Some(13),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("NOTE_KIND_UNSPECIFIED"),
Self::Vulnerability => std::option::Option::Some("VULNERABILITY"),
Self::Build => std::option::Option::Some("BUILD"),
Self::Image => std::option::Option::Some("IMAGE"),
Self::Package => std::option::Option::Some("PACKAGE"),
Self::Deployment => std::option::Option::Some("DEPLOYMENT"),
Self::Discovery => std::option::Option::Some("DISCOVERY"),
Self::Attestation => std::option::Option::Some("ATTESTATION"),
Self::Upgrade => std::option::Option::Some("UPGRADE"),
Self::Compliance => std::option::Option::Some("COMPLIANCE"),
Self::DsseAttestation => std::option::Option::Some("DSSE_ATTESTATION"),
Self::VulnerabilityAssessment => std::option::Option::Some("VULNERABILITY_ASSESSMENT"),
Self::SbomReference => std::option::Option::Some("SBOM_REFERENCE"),
Self::Secret => std::option::Option::Some("SECRET"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for NoteKind {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for NoteKind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for NoteKind {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Vulnerability,
2 => Self::Build,
3 => Self::Image,
4 => Self::Package,
5 => Self::Deployment,
6 => Self::Discovery,
7 => Self::Attestation,
8 => Self::Upgrade,
9 => Self::Compliance,
10 => Self::DsseAttestation,
11 => Self::VulnerabilityAssessment,
12 => Self::SbomReference,
13 => Self::Secret,
_ => Self::UnknownValue(note_kind::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for NoteKind {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"NOTE_KIND_UNSPECIFIED" => Self::Unspecified,
"VULNERABILITY" => Self::Vulnerability,
"BUILD" => Self::Build,
"IMAGE" => Self::Image,
"PACKAGE" => Self::Package,
"DEPLOYMENT" => Self::Deployment,
"DISCOVERY" => Self::Discovery,
"ATTESTATION" => Self::Attestation,
"UPGRADE" => Self::Upgrade,
"COMPLIANCE" => Self::Compliance,
"DSSE_ATTESTATION" => Self::DsseAttestation,
"VULNERABILITY_ASSESSMENT" => Self::VulnerabilityAssessment,
"SBOM_REFERENCE" => Self::SbomReference,
"SECRET" => Self::Secret,
_ => Self::UnknownValue(note_kind::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for NoteKind {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Vulnerability => serializer.serialize_i32(1),
Self::Build => serializer.serialize_i32(2),
Self::Image => serializer.serialize_i32(3),
Self::Package => serializer.serialize_i32(4),
Self::Deployment => serializer.serialize_i32(5),
Self::Discovery => serializer.serialize_i32(6),
Self::Attestation => serializer.serialize_i32(7),
Self::Upgrade => serializer.serialize_i32(8),
Self::Compliance => serializer.serialize_i32(9),
Self::DsseAttestation => serializer.serialize_i32(10),
Self::VulnerabilityAssessment => serializer.serialize_i32(11),
Self::SbomReference => serializer.serialize_i32(12),
Self::Secret => serializer.serialize_i32(13),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for NoteKind {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<NoteKind>::new(
".grafeas.v1.NoteKind",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum CVSSVersion {
#[allow(missing_docs)]
Unspecified,
#[allow(missing_docs)]
CvssVersion2,
#[allow(missing_docs)]
CvssVersion3,
UnknownValue(cvss_version::UnknownValue),
}
#[doc(hidden)]
pub mod cvss_version {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl CVSSVersion {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::CvssVersion2 => std::option::Option::Some(1),
Self::CvssVersion3 => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("CVSS_VERSION_UNSPECIFIED"),
Self::CvssVersion2 => std::option::Option::Some("CVSS_VERSION_2"),
Self::CvssVersion3 => std::option::Option::Some("CVSS_VERSION_3"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for CVSSVersion {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for CVSSVersion {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for CVSSVersion {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::CvssVersion2,
2 => Self::CvssVersion3,
_ => Self::UnknownValue(cvss_version::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for CVSSVersion {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"CVSS_VERSION_UNSPECIFIED" => Self::Unspecified,
"CVSS_VERSION_2" => Self::CvssVersion2,
"CVSS_VERSION_3" => Self::CvssVersion3,
_ => Self::UnknownValue(cvss_version::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for CVSSVersion {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::CvssVersion2 => serializer.serialize_i32(1),
Self::CvssVersion3 => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for CVSSVersion {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<CVSSVersion>::new(
".grafeas.v1.CVSSVersion",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Architecture {
Unspecified,
X86,
X64,
UnknownValue(architecture::UnknownValue),
}
#[doc(hidden)]
pub mod architecture {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Architecture {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::X86 => std::option::Option::Some(1),
Self::X64 => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ARCHITECTURE_UNSPECIFIED"),
Self::X86 => std::option::Option::Some("X86"),
Self::X64 => std::option::Option::Some("X64"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Architecture {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Architecture {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Architecture {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::X86,
2 => Self::X64,
_ => Self::UnknownValue(architecture::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Architecture {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ARCHITECTURE_UNSPECIFIED" => Self::Unspecified,
"X86" => Self::X86,
"X64" => Self::X64,
_ => Self::UnknownValue(architecture::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Architecture {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::X86 => serializer.serialize_i32(1),
Self::X64 => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Architecture {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Architecture>::new(
".grafeas.v1.Architecture",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SecretKind {
Unspecified,
Unknown,
GcpServiceAccountKey,
GcpApiKey,
GcpOauth2ClientCredentials,
GcpOauth2AccessToken,
AnthropicAdminApiKey,
AnthropicApiKey,
AzureAccessToken,
AzureIdentityToken,
DockerHubPersonalAccessToken,
GithubAppRefreshToken,
GithubAppServerToServerToken,
GithubAppUserToServerToken,
GithubClassicPersonalAccessToken,
GithubFineGrainedPersonalAccessToken,
GithubOauthToken,
HuggingfaceApiKey,
OpenaiApiKey,
PerplexityApiKey,
StripeSecretKey,
StripeRestrictedKey,
StripeWebhookSecret,
UnknownValue(secret_kind::UnknownValue),
}
#[doc(hidden)]
pub mod secret_kind {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl SecretKind {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Unknown => std::option::Option::Some(1),
Self::GcpServiceAccountKey => std::option::Option::Some(2),
Self::GcpApiKey => std::option::Option::Some(3),
Self::GcpOauth2ClientCredentials => std::option::Option::Some(4),
Self::GcpOauth2AccessToken => std::option::Option::Some(5),
Self::AnthropicAdminApiKey => std::option::Option::Some(6),
Self::AnthropicApiKey => std::option::Option::Some(7),
Self::AzureAccessToken => std::option::Option::Some(8),
Self::AzureIdentityToken => std::option::Option::Some(9),
Self::DockerHubPersonalAccessToken => std::option::Option::Some(10),
Self::GithubAppRefreshToken => std::option::Option::Some(11),
Self::GithubAppServerToServerToken => std::option::Option::Some(12),
Self::GithubAppUserToServerToken => std::option::Option::Some(13),
Self::GithubClassicPersonalAccessToken => std::option::Option::Some(14),
Self::GithubFineGrainedPersonalAccessToken => std::option::Option::Some(15),
Self::GithubOauthToken => std::option::Option::Some(16),
Self::HuggingfaceApiKey => std::option::Option::Some(17),
Self::OpenaiApiKey => std::option::Option::Some(18),
Self::PerplexityApiKey => std::option::Option::Some(19),
Self::StripeSecretKey => std::option::Option::Some(20),
Self::StripeRestrictedKey => std::option::Option::Some(21),
Self::StripeWebhookSecret => std::option::Option::Some(22),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SECRET_KIND_UNSPECIFIED"),
Self::Unknown => std::option::Option::Some("SECRET_KIND_UNKNOWN"),
Self::GcpServiceAccountKey => {
std::option::Option::Some("SECRET_KIND_GCP_SERVICE_ACCOUNT_KEY")
}
Self::GcpApiKey => std::option::Option::Some("SECRET_KIND_GCP_API_KEY"),
Self::GcpOauth2ClientCredentials => {
std::option::Option::Some("SECRET_KIND_GCP_OAUTH2_CLIENT_CREDENTIALS")
}
Self::GcpOauth2AccessToken => {
std::option::Option::Some("SECRET_KIND_GCP_OAUTH2_ACCESS_TOKEN")
}
Self::AnthropicAdminApiKey => {
std::option::Option::Some("SECRET_KIND_ANTHROPIC_ADMIN_API_KEY")
}
Self::AnthropicApiKey => std::option::Option::Some("SECRET_KIND_ANTHROPIC_API_KEY"),
Self::AzureAccessToken => std::option::Option::Some("SECRET_KIND_AZURE_ACCESS_TOKEN"),
Self::AzureIdentityToken => {
std::option::Option::Some("SECRET_KIND_AZURE_IDENTITY_TOKEN")
}
Self::DockerHubPersonalAccessToken => {
std::option::Option::Some("SECRET_KIND_DOCKER_HUB_PERSONAL_ACCESS_TOKEN")
}
Self::GithubAppRefreshToken => {
std::option::Option::Some("SECRET_KIND_GITHUB_APP_REFRESH_TOKEN")
}
Self::GithubAppServerToServerToken => {
std::option::Option::Some("SECRET_KIND_GITHUB_APP_SERVER_TO_SERVER_TOKEN")
}
Self::GithubAppUserToServerToken => {
std::option::Option::Some("SECRET_KIND_GITHUB_APP_USER_TO_SERVER_TOKEN")
}
Self::GithubClassicPersonalAccessToken => {
std::option::Option::Some("SECRET_KIND_GITHUB_CLASSIC_PERSONAL_ACCESS_TOKEN")
}
Self::GithubFineGrainedPersonalAccessToken => {
std::option::Option::Some("SECRET_KIND_GITHUB_FINE_GRAINED_PERSONAL_ACCESS_TOKEN")
}
Self::GithubOauthToken => std::option::Option::Some("SECRET_KIND_GITHUB_OAUTH_TOKEN"),
Self::HuggingfaceApiKey => std::option::Option::Some("SECRET_KIND_HUGGINGFACE_API_KEY"),
Self::OpenaiApiKey => std::option::Option::Some("SECRET_KIND_OPENAI_API_KEY"),
Self::PerplexityApiKey => std::option::Option::Some("SECRET_KIND_PERPLEXITY_API_KEY"),
Self::StripeSecretKey => std::option::Option::Some("SECRET_KIND_STRIPE_SECRET_KEY"),
Self::StripeRestrictedKey => {
std::option::Option::Some("SECRET_KIND_STRIPE_RESTRICTED_KEY")
}
Self::StripeWebhookSecret => {
std::option::Option::Some("SECRET_KIND_STRIPE_WEBHOOK_SECRET")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for SecretKind {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for SecretKind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for SecretKind {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Unknown,
2 => Self::GcpServiceAccountKey,
3 => Self::GcpApiKey,
4 => Self::GcpOauth2ClientCredentials,
5 => Self::GcpOauth2AccessToken,
6 => Self::AnthropicAdminApiKey,
7 => Self::AnthropicApiKey,
8 => Self::AzureAccessToken,
9 => Self::AzureIdentityToken,
10 => Self::DockerHubPersonalAccessToken,
11 => Self::GithubAppRefreshToken,
12 => Self::GithubAppServerToServerToken,
13 => Self::GithubAppUserToServerToken,
14 => Self::GithubClassicPersonalAccessToken,
15 => Self::GithubFineGrainedPersonalAccessToken,
16 => Self::GithubOauthToken,
17 => Self::HuggingfaceApiKey,
18 => Self::OpenaiApiKey,
19 => Self::PerplexityApiKey,
20 => Self::StripeSecretKey,
21 => Self::StripeRestrictedKey,
22 => Self::StripeWebhookSecret,
_ => Self::UnknownValue(secret_kind::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for SecretKind {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SECRET_KIND_UNSPECIFIED" => Self::Unspecified,
"SECRET_KIND_UNKNOWN" => Self::Unknown,
"SECRET_KIND_GCP_SERVICE_ACCOUNT_KEY" => Self::GcpServiceAccountKey,
"SECRET_KIND_GCP_API_KEY" => Self::GcpApiKey,
"SECRET_KIND_GCP_OAUTH2_CLIENT_CREDENTIALS" => Self::GcpOauth2ClientCredentials,
"SECRET_KIND_GCP_OAUTH2_ACCESS_TOKEN" => Self::GcpOauth2AccessToken,
"SECRET_KIND_ANTHROPIC_ADMIN_API_KEY" => Self::AnthropicAdminApiKey,
"SECRET_KIND_ANTHROPIC_API_KEY" => Self::AnthropicApiKey,
"SECRET_KIND_AZURE_ACCESS_TOKEN" => Self::AzureAccessToken,
"SECRET_KIND_AZURE_IDENTITY_TOKEN" => Self::AzureIdentityToken,
"SECRET_KIND_DOCKER_HUB_PERSONAL_ACCESS_TOKEN" => Self::DockerHubPersonalAccessToken,
"SECRET_KIND_GITHUB_APP_REFRESH_TOKEN" => Self::GithubAppRefreshToken,
"SECRET_KIND_GITHUB_APP_SERVER_TO_SERVER_TOKEN" => Self::GithubAppServerToServerToken,
"SECRET_KIND_GITHUB_APP_USER_TO_SERVER_TOKEN" => Self::GithubAppUserToServerToken,
"SECRET_KIND_GITHUB_CLASSIC_PERSONAL_ACCESS_TOKEN" => {
Self::GithubClassicPersonalAccessToken
}
"SECRET_KIND_GITHUB_FINE_GRAINED_PERSONAL_ACCESS_TOKEN" => {
Self::GithubFineGrainedPersonalAccessToken
}
"SECRET_KIND_GITHUB_OAUTH_TOKEN" => Self::GithubOauthToken,
"SECRET_KIND_HUGGINGFACE_API_KEY" => Self::HuggingfaceApiKey,
"SECRET_KIND_OPENAI_API_KEY" => Self::OpenaiApiKey,
"SECRET_KIND_PERPLEXITY_API_KEY" => Self::PerplexityApiKey,
"SECRET_KIND_STRIPE_SECRET_KEY" => Self::StripeSecretKey,
"SECRET_KIND_STRIPE_RESTRICTED_KEY" => Self::StripeRestrictedKey,
"SECRET_KIND_STRIPE_WEBHOOK_SECRET" => Self::StripeWebhookSecret,
_ => Self::UnknownValue(secret_kind::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for SecretKind {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Unknown => serializer.serialize_i32(1),
Self::GcpServiceAccountKey => serializer.serialize_i32(2),
Self::GcpApiKey => serializer.serialize_i32(3),
Self::GcpOauth2ClientCredentials => serializer.serialize_i32(4),
Self::GcpOauth2AccessToken => serializer.serialize_i32(5),
Self::AnthropicAdminApiKey => serializer.serialize_i32(6),
Self::AnthropicApiKey => serializer.serialize_i32(7),
Self::AzureAccessToken => serializer.serialize_i32(8),
Self::AzureIdentityToken => serializer.serialize_i32(9),
Self::DockerHubPersonalAccessToken => serializer.serialize_i32(10),
Self::GithubAppRefreshToken => serializer.serialize_i32(11),
Self::GithubAppServerToServerToken => serializer.serialize_i32(12),
Self::GithubAppUserToServerToken => serializer.serialize_i32(13),
Self::GithubClassicPersonalAccessToken => serializer.serialize_i32(14),
Self::GithubFineGrainedPersonalAccessToken => serializer.serialize_i32(15),
Self::GithubOauthToken => serializer.serialize_i32(16),
Self::HuggingfaceApiKey => serializer.serialize_i32(17),
Self::OpenaiApiKey => serializer.serialize_i32(18),
Self::PerplexityApiKey => serializer.serialize_i32(19),
Self::StripeSecretKey => serializer.serialize_i32(20),
Self::StripeRestrictedKey => serializer.serialize_i32(21),
Self::StripeWebhookSecret => serializer.serialize_i32(22),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for SecretKind {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<SecretKind>::new(
".grafeas.v1.SecretKind",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Severity {
Unspecified,
Minimal,
Low,
Medium,
High,
Critical,
UnknownValue(severity::UnknownValue),
}
#[doc(hidden)]
pub mod severity {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Severity {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Minimal => std::option::Option::Some(1),
Self::Low => std::option::Option::Some(2),
Self::Medium => std::option::Option::Some(3),
Self::High => std::option::Option::Some(4),
Self::Critical => std::option::Option::Some(5),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
Self::Minimal => std::option::Option::Some("MINIMAL"),
Self::Low => std::option::Option::Some("LOW"),
Self::Medium => std::option::Option::Some("MEDIUM"),
Self::High => std::option::Option::Some("HIGH"),
Self::Critical => std::option::Option::Some("CRITICAL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Severity {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Severity {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Severity {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Minimal,
2 => Self::Low,
3 => Self::Medium,
4 => Self::High,
5 => Self::Critical,
_ => Self::UnknownValue(severity::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Severity {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SEVERITY_UNSPECIFIED" => Self::Unspecified,
"MINIMAL" => Self::Minimal,
"LOW" => Self::Low,
"MEDIUM" => Self::Medium,
"HIGH" => Self::High,
"CRITICAL" => Self::Critical,
_ => Self::UnknownValue(severity::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Severity {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Minimal => serializer.serialize_i32(1),
Self::Low => serializer.serialize_i32(2),
Self::Medium => serializer.serialize_i32(3),
Self::High => serializer.serialize_i32(4),
Self::Critical => serializer.serialize_i32(5),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Severity {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
".grafeas.v1.Severity",
))
}
}