aws-sdk-assurance 1.0.0

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

/// <p>A single check within a leaf control, scored independently during an assessment. For document-based controls, the description defines what the evaluation looks for. Findings, assessment results, and remediation tasks reference the requirement by <code>id</code>.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Requirement {
    /// <p>The unique identifier of the requirement.</p>
    pub id: ::std::string::String,
    /// <p>A description of the requirement.</p>
    pub description: ::std::string::String,
}
impl Requirement {
    /// <p>The unique identifier of the requirement.</p>
    pub fn id(&self) -> &str {
        use std::ops::Deref;
        self.id.deref()
    }
    /// <p>A description of the requirement.</p>
    pub fn description(&self) -> &str {
        use std::ops::Deref;
        self.description.deref()
    }
}
impl Requirement {
    /// Creates a new builder-style object to manufacture [`Requirement`](crate::types::Requirement).
    pub fn builder() -> crate::types::builders::RequirementBuilder {
        crate::types::builders::RequirementBuilder::default()
    }
}

/// A builder for [`Requirement`](crate::types::Requirement).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct RequirementBuilder {
    pub(crate) id: ::std::option::Option<::std::string::String>,
    pub(crate) description: ::std::option::Option<::std::string::String>,
}
impl RequirementBuilder {
    /// <p>The unique identifier of the requirement.</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 unique identifier of the requirement.</p>
    pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.id = input;
        self
    }
    /// <p>The unique identifier of the requirement.</p>
    pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.id
    }
    /// <p>A description of the requirement.</p>
    /// This field is required.
    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.description = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A description of the requirement.</p>
    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.description = input;
        self
    }
    /// <p>A description of the requirement.</p>
    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
        &self.description
    }
    /// Consumes the builder and constructs a [`Requirement`](crate::types::Requirement).
    /// This method will fail if any of the following fields are not set:
    /// - [`id`](crate::types::builders::RequirementBuilder::id)
    /// - [`description`](crate::types::builders::RequirementBuilder::description)
    pub fn build(self) -> ::std::result::Result<crate::types::Requirement, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Requirement {
            id: self.id.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "id",
                    "id was not specified but it is required when building Requirement",
                )
            })?,
            description: self.description.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "description",
                    "description was not specified but it is required when building Requirement",
                )
            })?,
        })
    }
}