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>Provides information about the threat detected in a security finding and the file paths that were affected by the threat.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Threat {
    /// <p>The name of the threat.</p>
    /// <p>Length Constraints: Minimum of 1 length. Maximum of 128 length.</p>
    pub name: ::std::option::Option<::std::string::String>,
    /// <p>The severity of the threat.</p>
    /// <p>Length Constraints: Minimum of 1 length. Maximum of 128 length.</p>
    pub severity: ::std::option::Option<::std::string::String>,
    /// <p>This total number of items in which the threat has been detected.</p>
    pub item_count: ::std::option::Option<i32>,
    /// <p>Provides information about the file paths that were affected by the threat.</p>
    /// <p>Array Members: Minimum number of 1 item. Maximum number of 5 items.</p>
    pub file_paths: ::std::option::Option<::std::vec::Vec<crate::types::FilePaths>>,
}
impl Threat {
    /// <p>The name of the threat.</p>
    /// <p>Length Constraints: Minimum of 1 length. Maximum of 128 length.</p>
    pub fn name(&self) -> ::std::option::Option<&str> {
        self.name.as_deref()
    }
    /// <p>The severity of the threat.</p>
    /// <p>Length Constraints: Minimum of 1 length. Maximum of 128 length.</p>
    pub fn severity(&self) -> ::std::option::Option<&str> {
        self.severity.as_deref()
    }
    /// <p>This total number of items in which the threat has been detected.</p>
    pub fn item_count(&self) -> ::std::option::Option<i32> {
        self.item_count
    }
    /// <p>Provides information about the file paths that were affected by the threat.</p>
    /// <p>Array Members: Minimum number of 1 item. Maximum number of 5 items.</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 `.file_paths.is_none()`.
    pub fn file_paths(&self) -> &[crate::types::FilePaths] {
        self.file_paths.as_deref().unwrap_or_default()
    }
}
impl Threat {
    /// Creates a new builder-style object to manufacture [`Threat`](crate::types::Threat).
    pub fn builder() -> crate::types::builders::ThreatBuilder {
        crate::types::builders::ThreatBuilder::default()
    }
}

/// A builder for [`Threat`](crate::types::Threat).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ThreatBuilder {
    pub(crate) name: ::std::option::Option<::std::string::String>,
    pub(crate) severity: ::std::option::Option<::std::string::String>,
    pub(crate) item_count: ::std::option::Option<i32>,
    pub(crate) file_paths: ::std::option::Option<::std::vec::Vec<crate::types::FilePaths>>,
}
impl ThreatBuilder {
    /// <p>The name of the threat.</p>
    /// <p>Length Constraints: Minimum of 1 length. Maximum of 128 length.</p>
    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the threat.</p>
    /// <p>Length Constraints: Minimum of 1 length. Maximum of 128 length.</p>
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.name = input;
        self
    }
    /// <p>The name of the threat.</p>
    /// <p>Length Constraints: Minimum of 1 length. Maximum of 128 length.</p>
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// <p>The severity of the threat.</p>
    /// <p>Length Constraints: Minimum of 1 length. Maximum of 128 length.</p>
    pub fn severity(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.severity = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The severity of the threat.</p>
    /// <p>Length Constraints: Minimum of 1 length. Maximum of 128 length.</p>
    pub fn set_severity(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.severity = input;
        self
    }
    /// <p>The severity of the threat.</p>
    /// <p>Length Constraints: Minimum of 1 length. Maximum of 128 length.</p>
    pub fn get_severity(&self) -> &::std::option::Option<::std::string::String> {
        &self.severity
    }
    /// <p>This total number of items in which the threat has been detected.</p>
    pub fn item_count(mut self, input: i32) -> Self {
        self.item_count = ::std::option::Option::Some(input);
        self
    }
    /// <p>This total number of items in which the threat has been detected.</p>
    pub fn set_item_count(mut self, input: ::std::option::Option<i32>) -> Self {
        self.item_count = input;
        self
    }
    /// <p>This total number of items in which the threat has been detected.</p>
    pub fn get_item_count(&self) -> &::std::option::Option<i32> {
        &self.item_count
    }
    /// Appends an item to `file_paths`.
    ///
    /// To override the contents of this collection use [`set_file_paths`](Self::set_file_paths).
    ///
    /// <p>Provides information about the file paths that were affected by the threat.</p>
    /// <p>Array Members: Minimum number of 1 item. Maximum number of 5 items.</p>
    pub fn file_paths(mut self, input: crate::types::FilePaths) -> Self {
        let mut v = self.file_paths.unwrap_or_default();
        v.push(input);
        self.file_paths = ::std::option::Option::Some(v);
        self
    }
    /// <p>Provides information about the file paths that were affected by the threat.</p>
    /// <p>Array Members: Minimum number of 1 item. Maximum number of 5 items.</p>
    pub fn set_file_paths(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::FilePaths>>) -> Self {
        self.file_paths = input;
        self
    }
    /// <p>Provides information about the file paths that were affected by the threat.</p>
    /// <p>Array Members: Minimum number of 1 item. Maximum number of 5 items.</p>
    pub fn get_file_paths(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::FilePaths>> {
        &self.file_paths
    }
    /// Consumes the builder and constructs a [`Threat`](crate::types::Threat).
    pub fn build(self) -> crate::types::Threat {
        crate::types::Threat {
            name: self.name,
            severity: self.severity,
            item_count: self.item_count,
            file_paths: self.file_paths,
        }
    }
}