aws-sdk-securityhub 1.109.0

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

/// <p>A vulnerability associated with a finding.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Vulnerability {
    /// <p>The identifier of the vulnerability.</p>
    pub id: ::std::option::Option<::std::string::String>,
    /// <p>List of software packages that have the vulnerability.</p>
    pub vulnerable_packages: ::std::option::Option<::std::vec::Vec<crate::types::SoftwarePackage>>,
    /// <p>CVSS scores from the advisory related to the vulnerability.</p>
    pub cvss: ::std::option::Option<::std::vec::Vec<crate::types::Cvss>>,
    /// <p>List of vulnerabilities that are related to this vulnerability.</p>
    pub related_vulnerabilities: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    /// <p>Information about the vendor that generates the vulnerability report.</p>
    pub vendor: ::std::option::Option<crate::types::VulnerabilityVendor>,
    /// <p>A list of URLs that provide additional information about the vulnerability.</p>
    pub reference_urls: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    /// <p>Specifies if all vulnerable packages in a finding have a value for <code>FixedInVersion</code> and <code>Remediation</code>. This field is evaluated for each vulnerability <code>Id</code> based on the number of vulnerable packages that have a value for both <code>FixedInVersion</code> and <code>Remediation</code>. Valid values are as follows:</p>
    /// <ul>
    /// <li>
    /// <p><code>YES</code> if all vulnerable packages have a value for both <code>FixedInVersion</code> and <code>Remediation</code></p></li>
    /// <li>
    /// <p><code>NO</code> if no vulnerable packages have a value for <code>FixedInVersion</code> and <code>Remediation</code></p></li>
    /// <li>
    /// <p><code>PARTIAL</code> otherwise</p></li>
    /// </ul>
    pub fix_available: ::std::option::Option<crate::types::VulnerabilityFixAvailable>,
    /// <p>The Exploit Prediction Scoring System (EPSS) score for a finding.</p>
    pub epss_score: ::std::option::Option<f64>,
    /// <p>Whether an exploit is available for a finding.</p>
    pub exploit_available: ::std::option::Option<crate::types::VulnerabilityExploitAvailable>,
    /// <p>The date and time of the last exploit associated with a finding discovered in your environment.</p>
    pub last_known_exploit_at: ::std::option::Option<::std::string::String>,
    /// <p>The vulnerabilities found in your Lambda function code. This field pertains to findings that Security Hub CSPM receives from Amazon Inspector.</p>
    pub code_vulnerabilities: ::std::option::Option<::std::vec::Vec<crate::types::VulnerabilityCodeVulnerabilities>>,
}
impl Vulnerability {
    /// <p>The identifier of the vulnerability.</p>
    pub fn id(&self) -> ::std::option::Option<&str> {
        self.id.as_deref()
    }
    /// <p>List of software packages that have the vulnerability.</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 `.vulnerable_packages.is_none()`.
    pub fn vulnerable_packages(&self) -> &[crate::types::SoftwarePackage] {
        self.vulnerable_packages.as_deref().unwrap_or_default()
    }
    /// <p>CVSS scores from the advisory related to the vulnerability.</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 `.cvss.is_none()`.
    pub fn cvss(&self) -> &[crate::types::Cvss] {
        self.cvss.as_deref().unwrap_or_default()
    }
    /// <p>List of vulnerabilities that are related to this vulnerability.</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 `.related_vulnerabilities.is_none()`.
    pub fn related_vulnerabilities(&self) -> &[::std::string::String] {
        self.related_vulnerabilities.as_deref().unwrap_or_default()
    }
    /// <p>Information about the vendor that generates the vulnerability report.</p>
    pub fn vendor(&self) -> ::std::option::Option<&crate::types::VulnerabilityVendor> {
        self.vendor.as_ref()
    }
    /// <p>A list of URLs that provide additional information about the vulnerability.</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 `.reference_urls.is_none()`.
    pub fn reference_urls(&self) -> &[::std::string::String] {
        self.reference_urls.as_deref().unwrap_or_default()
    }
    /// <p>Specifies if all vulnerable packages in a finding have a value for <code>FixedInVersion</code> and <code>Remediation</code>. This field is evaluated for each vulnerability <code>Id</code> based on the number of vulnerable packages that have a value for both <code>FixedInVersion</code> and <code>Remediation</code>. Valid values are as follows:</p>
    /// <ul>
    /// <li>
    /// <p><code>YES</code> if all vulnerable packages have a value for both <code>FixedInVersion</code> and <code>Remediation</code></p></li>
    /// <li>
    /// <p><code>NO</code> if no vulnerable packages have a value for <code>FixedInVersion</code> and <code>Remediation</code></p></li>
    /// <li>
    /// <p><code>PARTIAL</code> otherwise</p></li>
    /// </ul>
    pub fn fix_available(&self) -> ::std::option::Option<&crate::types::VulnerabilityFixAvailable> {
        self.fix_available.as_ref()
    }
    /// <p>The Exploit Prediction Scoring System (EPSS) score for a finding.</p>
    pub fn epss_score(&self) -> ::std::option::Option<f64> {
        self.epss_score
    }
    /// <p>Whether an exploit is available for a finding.</p>
    pub fn exploit_available(&self) -> ::std::option::Option<&crate::types::VulnerabilityExploitAvailable> {
        self.exploit_available.as_ref()
    }
    /// <p>The date and time of the last exploit associated with a finding discovered in your environment.</p>
    pub fn last_known_exploit_at(&self) -> ::std::option::Option<&str> {
        self.last_known_exploit_at.as_deref()
    }
    /// <p>The vulnerabilities found in your Lambda function code. This field pertains to findings that Security Hub CSPM receives from Amazon Inspector.</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 `.code_vulnerabilities.is_none()`.
    pub fn code_vulnerabilities(&self) -> &[crate::types::VulnerabilityCodeVulnerabilities] {
        self.code_vulnerabilities.as_deref().unwrap_or_default()
    }
}
impl Vulnerability {
    /// Creates a new builder-style object to manufacture [`Vulnerability`](crate::types::Vulnerability).
    pub fn builder() -> crate::types::builders::VulnerabilityBuilder {
        crate::types::builders::VulnerabilityBuilder::default()
    }
}

/// A builder for [`Vulnerability`](crate::types::Vulnerability).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct VulnerabilityBuilder {
    pub(crate) id: ::std::option::Option<::std::string::String>,
    pub(crate) vulnerable_packages: ::std::option::Option<::std::vec::Vec<crate::types::SoftwarePackage>>,
    pub(crate) cvss: ::std::option::Option<::std::vec::Vec<crate::types::Cvss>>,
    pub(crate) related_vulnerabilities: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) vendor: ::std::option::Option<crate::types::VulnerabilityVendor>,
    pub(crate) reference_urls: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) fix_available: ::std::option::Option<crate::types::VulnerabilityFixAvailable>,
    pub(crate) epss_score: ::std::option::Option<f64>,
    pub(crate) exploit_available: ::std::option::Option<crate::types::VulnerabilityExploitAvailable>,
    pub(crate) last_known_exploit_at: ::std::option::Option<::std::string::String>,
    pub(crate) code_vulnerabilities: ::std::option::Option<::std::vec::Vec<crate::types::VulnerabilityCodeVulnerabilities>>,
}
impl VulnerabilityBuilder {
    /// <p>The identifier of the vulnerability.</p>
    /// This field is required.
    pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The identifier of the vulnerability.</p>
    pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.id = input;
        self
    }
    /// <p>The identifier of the vulnerability.</p>
    pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.id
    }
    /// Appends an item to `vulnerable_packages`.
    ///
    /// To override the contents of this collection use [`set_vulnerable_packages`](Self::set_vulnerable_packages).
    ///
    /// <p>List of software packages that have the vulnerability.</p>
    pub fn vulnerable_packages(mut self, input: crate::types::SoftwarePackage) -> Self {
        let mut v = self.vulnerable_packages.unwrap_or_default();
        v.push(input);
        self.vulnerable_packages = ::std::option::Option::Some(v);
        self
    }
    /// <p>List of software packages that have the vulnerability.</p>
    pub fn set_vulnerable_packages(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SoftwarePackage>>) -> Self {
        self.vulnerable_packages = input;
        self
    }
    /// <p>List of software packages that have the vulnerability.</p>
    pub fn get_vulnerable_packages(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SoftwarePackage>> {
        &self.vulnerable_packages
    }
    /// Appends an item to `cvss`.
    ///
    /// To override the contents of this collection use [`set_cvss`](Self::set_cvss).
    ///
    /// <p>CVSS scores from the advisory related to the vulnerability.</p>
    pub fn cvss(mut self, input: crate::types::Cvss) -> Self {
        let mut v = self.cvss.unwrap_or_default();
        v.push(input);
        self.cvss = ::std::option::Option::Some(v);
        self
    }
    /// <p>CVSS scores from the advisory related to the vulnerability.</p>
    pub fn set_cvss(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Cvss>>) -> Self {
        self.cvss = input;
        self
    }
    /// <p>CVSS scores from the advisory related to the vulnerability.</p>
    pub fn get_cvss(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Cvss>> {
        &self.cvss
    }
    /// Appends an item to `related_vulnerabilities`.
    ///
    /// To override the contents of this collection use [`set_related_vulnerabilities`](Self::set_related_vulnerabilities).
    ///
    /// <p>List of vulnerabilities that are related to this vulnerability.</p>
    pub fn related_vulnerabilities(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.related_vulnerabilities.unwrap_or_default();
        v.push(input.into());
        self.related_vulnerabilities = ::std::option::Option::Some(v);
        self
    }
    /// <p>List of vulnerabilities that are related to this vulnerability.</p>
    pub fn set_related_vulnerabilities(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.related_vulnerabilities = input;
        self
    }
    /// <p>List of vulnerabilities that are related to this vulnerability.</p>
    pub fn get_related_vulnerabilities(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.related_vulnerabilities
    }
    /// <p>Information about the vendor that generates the vulnerability report.</p>
    pub fn vendor(mut self, input: crate::types::VulnerabilityVendor) -> Self {
        self.vendor = ::std::option::Option::Some(input);
        self
    }
    /// <p>Information about the vendor that generates the vulnerability report.</p>
    pub fn set_vendor(mut self, input: ::std::option::Option<crate::types::VulnerabilityVendor>) -> Self {
        self.vendor = input;
        self
    }
    /// <p>Information about the vendor that generates the vulnerability report.</p>
    pub fn get_vendor(&self) -> &::std::option::Option<crate::types::VulnerabilityVendor> {
        &self.vendor
    }
    /// Appends an item to `reference_urls`.
    ///
    /// To override the contents of this collection use [`set_reference_urls`](Self::set_reference_urls).
    ///
    /// <p>A list of URLs that provide additional information about the vulnerability.</p>
    pub fn reference_urls(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.reference_urls.unwrap_or_default();
        v.push(input.into());
        self.reference_urls = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of URLs that provide additional information about the vulnerability.</p>
    pub fn set_reference_urls(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.reference_urls = input;
        self
    }
    /// <p>A list of URLs that provide additional information about the vulnerability.</p>
    pub fn get_reference_urls(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.reference_urls
    }
    /// <p>Specifies if all vulnerable packages in a finding have a value for <code>FixedInVersion</code> and <code>Remediation</code>. This field is evaluated for each vulnerability <code>Id</code> based on the number of vulnerable packages that have a value for both <code>FixedInVersion</code> and <code>Remediation</code>. Valid values are as follows:</p>
    /// <ul>
    /// <li>
    /// <p><code>YES</code> if all vulnerable packages have a value for both <code>FixedInVersion</code> and <code>Remediation</code></p></li>
    /// <li>
    /// <p><code>NO</code> if no vulnerable packages have a value for <code>FixedInVersion</code> and <code>Remediation</code></p></li>
    /// <li>
    /// <p><code>PARTIAL</code> otherwise</p></li>
    /// </ul>
    pub fn fix_available(mut self, input: crate::types::VulnerabilityFixAvailable) -> Self {
        self.fix_available = ::std::option::Option::Some(input);
        self
    }
    /// <p>Specifies if all vulnerable packages in a finding have a value for <code>FixedInVersion</code> and <code>Remediation</code>. This field is evaluated for each vulnerability <code>Id</code> based on the number of vulnerable packages that have a value for both <code>FixedInVersion</code> and <code>Remediation</code>. Valid values are as follows:</p>
    /// <ul>
    /// <li>
    /// <p><code>YES</code> if all vulnerable packages have a value for both <code>FixedInVersion</code> and <code>Remediation</code></p></li>
    /// <li>
    /// <p><code>NO</code> if no vulnerable packages have a value for <code>FixedInVersion</code> and <code>Remediation</code></p></li>
    /// <li>
    /// <p><code>PARTIAL</code> otherwise</p></li>
    /// </ul>
    pub fn set_fix_available(mut self, input: ::std::option::Option<crate::types::VulnerabilityFixAvailable>) -> Self {
        self.fix_available = input;
        self
    }
    /// <p>Specifies if all vulnerable packages in a finding have a value for <code>FixedInVersion</code> and <code>Remediation</code>. This field is evaluated for each vulnerability <code>Id</code> based on the number of vulnerable packages that have a value for both <code>FixedInVersion</code> and <code>Remediation</code>. Valid values are as follows:</p>
    /// <ul>
    /// <li>
    /// <p><code>YES</code> if all vulnerable packages have a value for both <code>FixedInVersion</code> and <code>Remediation</code></p></li>
    /// <li>
    /// <p><code>NO</code> if no vulnerable packages have a value for <code>FixedInVersion</code> and <code>Remediation</code></p></li>
    /// <li>
    /// <p><code>PARTIAL</code> otherwise</p></li>
    /// </ul>
    pub fn get_fix_available(&self) -> &::std::option::Option<crate::types::VulnerabilityFixAvailable> {
        &self.fix_available
    }
    /// <p>The Exploit Prediction Scoring System (EPSS) score for a finding.</p>
    pub fn epss_score(mut self, input: f64) -> Self {
        self.epss_score = ::std::option::Option::Some(input);
        self
    }
    /// <p>The Exploit Prediction Scoring System (EPSS) score for a finding.</p>
    pub fn set_epss_score(mut self, input: ::std::option::Option<f64>) -> Self {
        self.epss_score = input;
        self
    }
    /// <p>The Exploit Prediction Scoring System (EPSS) score for a finding.</p>
    pub fn get_epss_score(&self) -> &::std::option::Option<f64> {
        &self.epss_score
    }
    /// <p>Whether an exploit is available for a finding.</p>
    pub fn exploit_available(mut self, input: crate::types::VulnerabilityExploitAvailable) -> Self {
        self.exploit_available = ::std::option::Option::Some(input);
        self
    }
    /// <p>Whether an exploit is available for a finding.</p>
    pub fn set_exploit_available(mut self, input: ::std::option::Option<crate::types::VulnerabilityExploitAvailable>) -> Self {
        self.exploit_available = input;
        self
    }
    /// <p>Whether an exploit is available for a finding.</p>
    pub fn get_exploit_available(&self) -> &::std::option::Option<crate::types::VulnerabilityExploitAvailable> {
        &self.exploit_available
    }
    /// <p>The date and time of the last exploit associated with a finding discovered in your environment.</p>
    pub fn last_known_exploit_at(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.last_known_exploit_at = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The date and time of the last exploit associated with a finding discovered in your environment.</p>
    pub fn set_last_known_exploit_at(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.last_known_exploit_at = input;
        self
    }
    /// <p>The date and time of the last exploit associated with a finding discovered in your environment.</p>
    pub fn get_last_known_exploit_at(&self) -> &::std::option::Option<::std::string::String> {
        &self.last_known_exploit_at
    }
    /// Appends an item to `code_vulnerabilities`.
    ///
    /// To override the contents of this collection use [`set_code_vulnerabilities`](Self::set_code_vulnerabilities).
    ///
    /// <p>The vulnerabilities found in your Lambda function code. This field pertains to findings that Security Hub CSPM receives from Amazon Inspector.</p>
    pub fn code_vulnerabilities(mut self, input: crate::types::VulnerabilityCodeVulnerabilities) -> Self {
        let mut v = self.code_vulnerabilities.unwrap_or_default();
        v.push(input);
        self.code_vulnerabilities = ::std::option::Option::Some(v);
        self
    }
    /// <p>The vulnerabilities found in your Lambda function code. This field pertains to findings that Security Hub CSPM receives from Amazon Inspector.</p>
    pub fn set_code_vulnerabilities(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::VulnerabilityCodeVulnerabilities>>) -> Self {
        self.code_vulnerabilities = input;
        self
    }
    /// <p>The vulnerabilities found in your Lambda function code. This field pertains to findings that Security Hub CSPM receives from Amazon Inspector.</p>
    pub fn get_code_vulnerabilities(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::VulnerabilityCodeVulnerabilities>> {
        &self.code_vulnerabilities
    }
    /// Consumes the builder and constructs a [`Vulnerability`](crate::types::Vulnerability).
    pub fn build(self) -> crate::types::Vulnerability {
        crate::types::Vulnerability {
            id: self.id,
            vulnerable_packages: self.vulnerable_packages,
            cvss: self.cvss,
            related_vulnerabilities: self.related_vulnerabilities,
            vendor: self.vendor,
            reference_urls: self.reference_urls,
            fix_available: self.fix_available,
            epss_score: self.epss_score,
            exploit_available: self.exploit_available,
            last_known_exploit_at: self.last_known_exploit_at,
            code_vulnerabilities: self.code_vulnerabilities,
        }
    }
}