aws-sdk-securityhub 1.110.0

AWS SDK for AWS SecurityHub
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>CVSS scores from the advisory related to the vulnerability.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Cvss {
    /// <p>The version of CVSS for the CVSS score.</p>
    pub version: ::std::option::Option<::std::string::String>,
    /// <p>The base CVSS score.</p>
    pub base_score: ::std::option::Option<f64>,
    /// <p>The base scoring vector for the CVSS score.</p>
    pub base_vector: ::std::option::Option<::std::string::String>,
    /// <p>The origin of the original CVSS score and vector.</p>
    pub source: ::std::option::Option<::std::string::String>,
    /// <p>Adjustments to the CVSS metrics.</p>
    pub adjustments: ::std::option::Option<::std::vec::Vec<crate::types::Adjustment>>,
}
impl Cvss {
    /// <p>The version of CVSS for the CVSS score.</p>
    pub fn version(&self) -> ::std::option::Option<&str> {
        self.version.as_deref()
    }
    /// <p>The base CVSS score.</p>
    pub fn base_score(&self) -> ::std::option::Option<f64> {
        self.base_score
    }
    /// <p>The base scoring vector for the CVSS score.</p>
    pub fn base_vector(&self) -> ::std::option::Option<&str> {
        self.base_vector.as_deref()
    }
    /// <p>The origin of the original CVSS score and vector.</p>
    pub fn source(&self) -> ::std::option::Option<&str> {
        self.source.as_deref()
    }
    /// <p>Adjustments to the CVSS metrics.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.adjustments.is_none()`.
    pub fn adjustments(&self) -> &[crate::types::Adjustment] {
        self.adjustments.as_deref().unwrap_or_default()
    }
}
impl Cvss {
    /// Creates a new builder-style object to manufacture [`Cvss`](crate::types::Cvss).
    pub fn builder() -> crate::types::builders::CvssBuilder {
        crate::types::builders::CvssBuilder::default()
    }
}

/// A builder for [`Cvss`](crate::types::Cvss).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct CvssBuilder {
    pub(crate) version: ::std::option::Option<::std::string::String>,
    pub(crate) base_score: ::std::option::Option<f64>,
    pub(crate) base_vector: ::std::option::Option<::std::string::String>,
    pub(crate) source: ::std::option::Option<::std::string::String>,
    pub(crate) adjustments: ::std::option::Option<::std::vec::Vec<crate::types::Adjustment>>,
}
impl CvssBuilder {
    /// <p>The version of CVSS for the CVSS score.</p>
    pub fn version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.version = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The version of CVSS for the CVSS score.</p>
    pub fn set_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.version = input;
        self
    }
    /// <p>The version of CVSS for the CVSS score.</p>
    pub fn get_version(&self) -> &::std::option::Option<::std::string::String> {
        &self.version
    }
    /// <p>The base CVSS score.</p>
    pub fn base_score(mut self, input: f64) -> Self {
        self.base_score = ::std::option::Option::Some(input);
        self
    }
    /// <p>The base CVSS score.</p>
    pub fn set_base_score(mut self, input: ::std::option::Option<f64>) -> Self {
        self.base_score = input;
        self
    }
    /// <p>The base CVSS score.</p>
    pub fn get_base_score(&self) -> &::std::option::Option<f64> {
        &self.base_score
    }
    /// <p>The base scoring vector for the CVSS score.</p>
    pub fn base_vector(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.base_vector = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The base scoring vector for the CVSS score.</p>
    pub fn set_base_vector(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.base_vector = input;
        self
    }
    /// <p>The base scoring vector for the CVSS score.</p>
    pub fn get_base_vector(&self) -> &::std::option::Option<::std::string::String> {
        &self.base_vector
    }
    /// <p>The origin of the original CVSS score and vector.</p>
    pub fn source(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.source = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The origin of the original CVSS score and vector.</p>
    pub fn set_source(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.source = input;
        self
    }
    /// <p>The origin of the original CVSS score and vector.</p>
    pub fn get_source(&self) -> &::std::option::Option<::std::string::String> {
        &self.source
    }
    /// Appends an item to `adjustments`.
    ///
    /// To override the contents of this collection use [`set_adjustments`](Self::set_adjustments).
    ///
    /// <p>Adjustments to the CVSS metrics.</p>
    pub fn adjustments(mut self, input: crate::types::Adjustment) -> Self {
        let mut v = self.adjustments.unwrap_or_default();
        v.push(input);
        self.adjustments = ::std::option::Option::Some(v);
        self
    }
    /// <p>Adjustments to the CVSS metrics.</p>
    pub fn set_adjustments(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Adjustment>>) -> Self {
        self.adjustments = input;
        self
    }
    /// <p>Adjustments to the CVSS metrics.</p>
    pub fn get_adjustments(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Adjustment>> {
        &self.adjustments
    }
    /// Consumes the builder and constructs a [`Cvss`](crate::types::Cvss).
    pub fn build(self) -> crate::types::Cvss {
        crate::types::Cvss {
            version: self.version,
            base_score: self.base_score,
            base_vector: self.base_vector,
            source: self.source,
            adjustments: self.adjustments,
        }
    }
}