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>Output of <code>GetControlStatus</code>: the effective status of one control in a project.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct GetControlStatusOutput {
    /// <p>The identifier of the control.</p>
    pub control_id: ::std::string::String,
    /// <p>The identifier of the control group that contains the control. Absent when the control isn't in a control group.</p>
    pub control_group_id: ::std::option::Option<::std::string::String>,
    /// <p>The effective compliance status of the control. Valid values:</p>
    /// <ul>
    /// <li>
    /// <p><code>COMPLIANT</code> or <code>NEEDS_ATTENTION</code> – Based on the compliance percentage that the most recent assessment calculated.</p></li>
    /// <li>
    /// <p><code>NOT_APPLICABLE</code> – The control, or every one of its requirements, is not applicable to the project.</p></li>
    /// <li>
    /// <p><code>NOT_ASSESSED</code> – The most recent assessment hasn't finished, ended in an error, or found no outcome for any applicable requirement.</p></li>
    /// </ul>
    pub status: crate::types::ComplianceStatus,
    /// <p>The compliance percentage that the most recent assessment of the control calculated. A decision that you declare after that assessment doesn't change this value. The next assessment calculates a new percentage. Absent when <code>status</code> is <code>NOT_ASSESSED</code> or <code>NOT_APPLICABLE</code>.</p>
    pub outcome_percentage: ::std::option::Option<f64>,
    /// <p>The number of the control's requirements that apply to the project.</p>
    pub applicable_requirement_count: i32,
    /// <p>The number of the control's requirements whose status is <code>not_applicable</code>. The count includes requirements that you declare not applicable, directly or through the control. It also includes requirements that the assessment determines don't apply.</p>
    pub excluded_requirement_count: i32,
    /// <p>The decision declared on the control itself. Absent when no decision is declared on the control. Decisions on individual requirements are returned in <code>requirementStatuses</code>.</p>
    pub status_override: ::std::option::Option<crate::types::StatusOverride>,
    /// <p>The identifier of the most recent assessment of the control in the project. Absent if no assessment has run for the control.</p>
    pub last_assessment_id: ::std::option::Option<::std::string::String>,
    /// <p>The time when the most recent assessment of the control was last updated.</p>
    pub last_assessed_at: ::std::option::Option<::aws_smithy_types::DateTime>,
    /// <p>The state of the most recent assessment of the control.</p>
    pub last_assessment_status: ::std::option::Option<crate::types::AssessmentStatus>,
    /// <p>The effective status of each of the control's requirements, including requirements that are not applicable.</p>
    pub requirement_statuses: ::std::vec::Vec<crate::types::RequirementStatus>,
    _request_id: Option<String>,
}
impl GetControlStatusOutput {
    /// <p>The identifier of the control.</p>
    pub fn control_id(&self) -> &str {
        use std::ops::Deref;
        self.control_id.deref()
    }
    /// <p>The identifier of the control group that contains the control. Absent when the control isn't in a control group.</p>
    pub fn control_group_id(&self) -> ::std::option::Option<&str> {
        self.control_group_id.as_deref()
    }
    /// <p>The effective compliance status of the control. Valid values:</p>
    /// <ul>
    /// <li>
    /// <p><code>COMPLIANT</code> or <code>NEEDS_ATTENTION</code> – Based on the compliance percentage that the most recent assessment calculated.</p></li>
    /// <li>
    /// <p><code>NOT_APPLICABLE</code> – The control, or every one of its requirements, is not applicable to the project.</p></li>
    /// <li>
    /// <p><code>NOT_ASSESSED</code> – The most recent assessment hasn't finished, ended in an error, or found no outcome for any applicable requirement.</p></li>
    /// </ul>
    pub fn status(&self) -> &crate::types::ComplianceStatus {
        &self.status
    }
    /// <p>The compliance percentage that the most recent assessment of the control calculated. A decision that you declare after that assessment doesn't change this value. The next assessment calculates a new percentage. Absent when <code>status</code> is <code>NOT_ASSESSED</code> or <code>NOT_APPLICABLE</code>.</p>
    pub fn outcome_percentage(&self) -> ::std::option::Option<f64> {
        self.outcome_percentage
    }
    /// <p>The number of the control's requirements that apply to the project.</p>
    pub fn applicable_requirement_count(&self) -> i32 {
        self.applicable_requirement_count
    }
    /// <p>The number of the control's requirements whose status is <code>not_applicable</code>. The count includes requirements that you declare not applicable, directly or through the control. It also includes requirements that the assessment determines don't apply.</p>
    pub fn excluded_requirement_count(&self) -> i32 {
        self.excluded_requirement_count
    }
    /// <p>The decision declared on the control itself. Absent when no decision is declared on the control. Decisions on individual requirements are returned in <code>requirementStatuses</code>.</p>
    pub fn status_override(&self) -> ::std::option::Option<&crate::types::StatusOverride> {
        self.status_override.as_ref()
    }
    /// <p>The identifier of the most recent assessment of the control in the project. Absent if no assessment has run for the control.</p>
    pub fn last_assessment_id(&self) -> ::std::option::Option<&str> {
        self.last_assessment_id.as_deref()
    }
    /// <p>The time when the most recent assessment of the control was last updated.</p>
    pub fn last_assessed_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
        self.last_assessed_at.as_ref()
    }
    /// <p>The state of the most recent assessment of the control.</p>
    pub fn last_assessment_status(&self) -> ::std::option::Option<&crate::types::AssessmentStatus> {
        self.last_assessment_status.as_ref()
    }
    /// <p>The effective status of each of the control's requirements, including requirements that are not applicable.</p>
    pub fn requirement_statuses(&self) -> &[crate::types::RequirementStatus] {
        use std::ops::Deref;
        self.requirement_statuses.deref()
    }
}
impl ::aws_types::request_id::RequestId for GetControlStatusOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl GetControlStatusOutput {
    /// Creates a new builder-style object to manufacture [`GetControlStatusOutput`](crate::operation::get_control_status::GetControlStatusOutput).
    pub fn builder() -> crate::operation::get_control_status::builders::GetControlStatusOutputBuilder {
        crate::operation::get_control_status::builders::GetControlStatusOutputBuilder::default()
    }
}

/// A builder for [`GetControlStatusOutput`](crate::operation::get_control_status::GetControlStatusOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct GetControlStatusOutputBuilder {
    pub(crate) control_id: ::std::option::Option<::std::string::String>,
    pub(crate) control_group_id: ::std::option::Option<::std::string::String>,
    pub(crate) status: ::std::option::Option<crate::types::ComplianceStatus>,
    pub(crate) outcome_percentage: ::std::option::Option<f64>,
    pub(crate) applicable_requirement_count: ::std::option::Option<i32>,
    pub(crate) excluded_requirement_count: ::std::option::Option<i32>,
    pub(crate) status_override: ::std::option::Option<crate::types::StatusOverride>,
    pub(crate) last_assessment_id: ::std::option::Option<::std::string::String>,
    pub(crate) last_assessed_at: ::std::option::Option<::aws_smithy_types::DateTime>,
    pub(crate) last_assessment_status: ::std::option::Option<crate::types::AssessmentStatus>,
    pub(crate) requirement_statuses: ::std::option::Option<::std::vec::Vec<crate::types::RequirementStatus>>,
    _request_id: Option<String>,
}
impl GetControlStatusOutputBuilder {
    /// <p>The identifier of the control.</p>
    /// This field is required.
    pub fn control_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.control_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The identifier of the control.</p>
    pub fn set_control_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.control_id = input;
        self
    }
    /// <p>The identifier of the control.</p>
    pub fn get_control_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.control_id
    }
    /// <p>The identifier of the control group that contains the control. Absent when the control isn't in a control group.</p>
    pub fn control_group_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.control_group_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The identifier of the control group that contains the control. Absent when the control isn't in a control group.</p>
    pub fn set_control_group_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.control_group_id = input;
        self
    }
    /// <p>The identifier of the control group that contains the control. Absent when the control isn't in a control group.</p>
    pub fn get_control_group_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.control_group_id
    }
    /// <p>The effective compliance status of the control. Valid values:</p>
    /// <ul>
    /// <li>
    /// <p><code>COMPLIANT</code> or <code>NEEDS_ATTENTION</code> – Based on the compliance percentage that the most recent assessment calculated.</p></li>
    /// <li>
    /// <p><code>NOT_APPLICABLE</code> – The control, or every one of its requirements, is not applicable to the project.</p></li>
    /// <li>
    /// <p><code>NOT_ASSESSED</code> – The most recent assessment hasn't finished, ended in an error, or found no outcome for any applicable requirement.</p></li>
    /// </ul>
    /// This field is required.
    pub fn status(mut self, input: crate::types::ComplianceStatus) -> Self {
        self.status = ::std::option::Option::Some(input);
        self
    }
    /// <p>The effective compliance status of the control. Valid values:</p>
    /// <ul>
    /// <li>
    /// <p><code>COMPLIANT</code> or <code>NEEDS_ATTENTION</code> – Based on the compliance percentage that the most recent assessment calculated.</p></li>
    /// <li>
    /// <p><code>NOT_APPLICABLE</code> – The control, or every one of its requirements, is not applicable to the project.</p></li>
    /// <li>
    /// <p><code>NOT_ASSESSED</code> – The most recent assessment hasn't finished, ended in an error, or found no outcome for any applicable requirement.</p></li>
    /// </ul>
    pub fn set_status(mut self, input: ::std::option::Option<crate::types::ComplianceStatus>) -> Self {
        self.status = input;
        self
    }
    /// <p>The effective compliance status of the control. Valid values:</p>
    /// <ul>
    /// <li>
    /// <p><code>COMPLIANT</code> or <code>NEEDS_ATTENTION</code> – Based on the compliance percentage that the most recent assessment calculated.</p></li>
    /// <li>
    /// <p><code>NOT_APPLICABLE</code> – The control, or every one of its requirements, is not applicable to the project.</p></li>
    /// <li>
    /// <p><code>NOT_ASSESSED</code> – The most recent assessment hasn't finished, ended in an error, or found no outcome for any applicable requirement.</p></li>
    /// </ul>
    pub fn get_status(&self) -> &::std::option::Option<crate::types::ComplianceStatus> {
        &self.status
    }
    /// <p>The compliance percentage that the most recent assessment of the control calculated. A decision that you declare after that assessment doesn't change this value. The next assessment calculates a new percentage. Absent when <code>status</code> is <code>NOT_ASSESSED</code> or <code>NOT_APPLICABLE</code>.</p>
    pub fn outcome_percentage(mut self, input: f64) -> Self {
        self.outcome_percentage = ::std::option::Option::Some(input);
        self
    }
    /// <p>The compliance percentage that the most recent assessment of the control calculated. A decision that you declare after that assessment doesn't change this value. The next assessment calculates a new percentage. Absent when <code>status</code> is <code>NOT_ASSESSED</code> or <code>NOT_APPLICABLE</code>.</p>
    pub fn set_outcome_percentage(mut self, input: ::std::option::Option<f64>) -> Self {
        self.outcome_percentage = input;
        self
    }
    /// <p>The compliance percentage that the most recent assessment of the control calculated. A decision that you declare after that assessment doesn't change this value. The next assessment calculates a new percentage. Absent when <code>status</code> is <code>NOT_ASSESSED</code> or <code>NOT_APPLICABLE</code>.</p>
    pub fn get_outcome_percentage(&self) -> &::std::option::Option<f64> {
        &self.outcome_percentage
    }
    /// <p>The number of the control's requirements that apply to the project.</p>
    /// This field is required.
    pub fn applicable_requirement_count(mut self, input: i32) -> Self {
        self.applicable_requirement_count = ::std::option::Option::Some(input);
        self
    }
    /// <p>The number of the control's requirements that apply to the project.</p>
    pub fn set_applicable_requirement_count(mut self, input: ::std::option::Option<i32>) -> Self {
        self.applicable_requirement_count = input;
        self
    }
    /// <p>The number of the control's requirements that apply to the project.</p>
    pub fn get_applicable_requirement_count(&self) -> &::std::option::Option<i32> {
        &self.applicable_requirement_count
    }
    /// <p>The number of the control's requirements whose status is <code>not_applicable</code>. The count includes requirements that you declare not applicable, directly or through the control. It also includes requirements that the assessment determines don't apply.</p>
    /// This field is required.
    pub fn excluded_requirement_count(mut self, input: i32) -> Self {
        self.excluded_requirement_count = ::std::option::Option::Some(input);
        self
    }
    /// <p>The number of the control's requirements whose status is <code>not_applicable</code>. The count includes requirements that you declare not applicable, directly or through the control. It also includes requirements that the assessment determines don't apply.</p>
    pub fn set_excluded_requirement_count(mut self, input: ::std::option::Option<i32>) -> Self {
        self.excluded_requirement_count = input;
        self
    }
    /// <p>The number of the control's requirements whose status is <code>not_applicable</code>. The count includes requirements that you declare not applicable, directly or through the control. It also includes requirements that the assessment determines don't apply.</p>
    pub fn get_excluded_requirement_count(&self) -> &::std::option::Option<i32> {
        &self.excluded_requirement_count
    }
    /// <p>The decision declared on the control itself. Absent when no decision is declared on the control. Decisions on individual requirements are returned in <code>requirementStatuses</code>.</p>
    pub fn status_override(mut self, input: crate::types::StatusOverride) -> Self {
        self.status_override = ::std::option::Option::Some(input);
        self
    }
    /// <p>The decision declared on the control itself. Absent when no decision is declared on the control. Decisions on individual requirements are returned in <code>requirementStatuses</code>.</p>
    pub fn set_status_override(mut self, input: ::std::option::Option<crate::types::StatusOverride>) -> Self {
        self.status_override = input;
        self
    }
    /// <p>The decision declared on the control itself. Absent when no decision is declared on the control. Decisions on individual requirements are returned in <code>requirementStatuses</code>.</p>
    pub fn get_status_override(&self) -> &::std::option::Option<crate::types::StatusOverride> {
        &self.status_override
    }
    /// <p>The identifier of the most recent assessment of the control in the project. Absent if no assessment has run for the control.</p>
    pub fn last_assessment_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.last_assessment_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The identifier of the most recent assessment of the control in the project. Absent if no assessment has run for the control.</p>
    pub fn set_last_assessment_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.last_assessment_id = input;
        self
    }
    /// <p>The identifier of the most recent assessment of the control in the project. Absent if no assessment has run for the control.</p>
    pub fn get_last_assessment_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.last_assessment_id
    }
    /// <p>The time when the most recent assessment of the control was last updated.</p>
    pub fn last_assessed_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.last_assessed_at = ::std::option::Option::Some(input);
        self
    }
    /// <p>The time when the most recent assessment of the control was last updated.</p>
    pub fn set_last_assessed_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.last_assessed_at = input;
        self
    }
    /// <p>The time when the most recent assessment of the control was last updated.</p>
    pub fn get_last_assessed_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.last_assessed_at
    }
    /// <p>The state of the most recent assessment of the control.</p>
    pub fn last_assessment_status(mut self, input: crate::types::AssessmentStatus) -> Self {
        self.last_assessment_status = ::std::option::Option::Some(input);
        self
    }
    /// <p>The state of the most recent assessment of the control.</p>
    pub fn set_last_assessment_status(mut self, input: ::std::option::Option<crate::types::AssessmentStatus>) -> Self {
        self.last_assessment_status = input;
        self
    }
    /// <p>The state of the most recent assessment of the control.</p>
    pub fn get_last_assessment_status(&self) -> &::std::option::Option<crate::types::AssessmentStatus> {
        &self.last_assessment_status
    }
    /// Appends an item to `requirement_statuses`.
    ///
    /// To override the contents of this collection use [`set_requirement_statuses`](Self::set_requirement_statuses).
    ///
    /// <p>The effective status of each of the control's requirements, including requirements that are not applicable.</p>
    pub fn requirement_statuses(mut self, input: crate::types::RequirementStatus) -> Self {
        let mut v = self.requirement_statuses.unwrap_or_default();
        v.push(input);
        self.requirement_statuses = ::std::option::Option::Some(v);
        self
    }
    /// <p>The effective status of each of the control's requirements, including requirements that are not applicable.</p>
    pub fn set_requirement_statuses(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RequirementStatus>>) -> Self {
        self.requirement_statuses = input;
        self
    }
    /// <p>The effective status of each of the control's requirements, including requirements that are not applicable.</p>
    pub fn get_requirement_statuses(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RequirementStatus>> {
        &self.requirement_statuses
    }
    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
        self._request_id = Some(request_id.into());
        self
    }

    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
        self._request_id = request_id;
        self
    }
    /// Consumes the builder and constructs a [`GetControlStatusOutput`](crate::operation::get_control_status::GetControlStatusOutput).
    /// This method will fail if any of the following fields are not set:
    /// - [`control_id`](crate::operation::get_control_status::builders::GetControlStatusOutputBuilder::control_id)
    /// - [`status`](crate::operation::get_control_status::builders::GetControlStatusOutputBuilder::status)
    /// - [`applicable_requirement_count`](crate::operation::get_control_status::builders::GetControlStatusOutputBuilder::applicable_requirement_count)
    /// - [`excluded_requirement_count`](crate::operation::get_control_status::builders::GetControlStatusOutputBuilder::excluded_requirement_count)
    /// - [`requirement_statuses`](crate::operation::get_control_status::builders::GetControlStatusOutputBuilder::requirement_statuses)
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::get_control_status::GetControlStatusOutput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::get_control_status::GetControlStatusOutput {
            control_id: self.control_id.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "control_id",
                    "control_id was not specified but it is required when building GetControlStatusOutput",
                )
            })?,
            control_group_id: self.control_group_id,
            status: self.status.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "status",
                    "status was not specified but it is required when building GetControlStatusOutput",
                )
            })?,
            outcome_percentage: self.outcome_percentage,
            applicable_requirement_count: self.applicable_requirement_count.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "applicable_requirement_count",
                    "applicable_requirement_count was not specified but it is required when building GetControlStatusOutput",
                )
            })?,
            excluded_requirement_count: self.excluded_requirement_count.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "excluded_requirement_count",
                    "excluded_requirement_count was not specified but it is required when building GetControlStatusOutput",
                )
            })?,
            status_override: self.status_override,
            last_assessment_id: self.last_assessment_id,
            last_assessed_at: self.last_assessed_at,
            last_assessment_status: self.last_assessment_status,
            requirement_statuses: self.requirement_statuses.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "requirement_statuses",
                    "requirement_statuses was not specified but it is required when building GetControlStatusOutput",
                )
            })?,
            _request_id: self._request_id,
        })
    }
}