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 leaf control within a framework version, with its full attributes including its requirements. To retrieve the attributes of the control group it belongs to, use <code>GetControlGroup</code>. To retrieve the other controls in that group, use <code>ListControls</code>.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Control {
    /// <p>The type of the control.</p>
    pub r#type: crate::types::ControlType,
    /// <p>The name of the compliance framework.</p>
    pub framework: ::std::option::Option<::std::string::String>,
    /// <p>The control identifier. Optional. If omitted, the operation applies to the full framework.</p>
    pub control_id: ::std::option::Option<::std::string::String>,
    /// <p>The version of the compliance framework.</p>
    pub framework_version: ::std::option::Option<::std::string::String>,
    /// <p>The parent group ID (for example, "A.2" for control "A.2.2").</p>
    pub group_id: ::std::option::Option<::std::string::String>,
    /// <p>The human-readable title of the control.</p>
    pub title: ::std::option::Option<::std::string::String>,
    /// <p>A description of the control.</p>
    pub description: ::std::option::Option<::std::string::String>,
    /// <p>The individual checks an assessment scores for this control. Absent when the control has none.</p>
    pub requirements: ::std::option::Option<::std::vec::Vec<crate::types::Requirement>>,
    /// <p>The technical control intents classify how an assessment evaluates this leaf control. Leaf controls only.</p>
    pub control_intents: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    /// <p>How AWS Assurance evaluates the control. Applies only to leaf controls. Valid values:</p>
    /// <ul>
    /// <li>
    /// <p><code>automated-scan</code> – Evaluates the configuration of your AWS resources.</p></li>
    /// <li>
    /// <p><code>document</code> – Evaluates the evidence documents that you provide.</p></li>
    /// <li>
    /// <p><code>hybrid</code> – Evaluates both resource configuration and evidence documents.</p></li>
    /// </ul>
    pub workflow_type: ::std::option::Option<crate::types::WorkflowType>,
    /// <p>The lifecycle status of the control.</p>
    pub status: ::std::option::Option<crate::types::ReleaseStatus>,
    /// <p>The time when you created the control. The response includes it only for controls in custom frameworks.</p>
    pub created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
    /// <p>The time when the control was last modified. Returned for controls in custom frameworks only.</p>
    pub updated_at: ::std::option::Option<::aws_smithy_types::DateTime>,
}
impl Control {
    /// <p>The type of the control.</p>
    pub fn r#type(&self) -> &crate::types::ControlType {
        &self.r#type
    }
    /// <p>The name of the compliance framework.</p>
    pub fn framework(&self) -> ::std::option::Option<&str> {
        self.framework.as_deref()
    }
    /// <p>The control identifier. Optional. If omitted, the operation applies to the full framework.</p>
    pub fn control_id(&self) -> ::std::option::Option<&str> {
        self.control_id.as_deref()
    }
    /// <p>The version of the compliance framework.</p>
    pub fn framework_version(&self) -> ::std::option::Option<&str> {
        self.framework_version.as_deref()
    }
    /// <p>The parent group ID (for example, "A.2" for control "A.2.2").</p>
    pub fn group_id(&self) -> ::std::option::Option<&str> {
        self.group_id.as_deref()
    }
    /// <p>The human-readable title of the control.</p>
    pub fn title(&self) -> ::std::option::Option<&str> {
        self.title.as_deref()
    }
    /// <p>A description of the control.</p>
    pub fn description(&self) -> ::std::option::Option<&str> {
        self.description.as_deref()
    }
    /// <p>The individual checks an assessment scores for this control. Absent when the control has none.</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 `.requirements.is_none()`.
    pub fn requirements(&self) -> &[crate::types::Requirement] {
        self.requirements.as_deref().unwrap_or_default()
    }
    /// <p>The technical control intents classify how an assessment evaluates this leaf control. Leaf controls only.</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 `.control_intents.is_none()`.
    pub fn control_intents(&self) -> &[::std::string::String] {
        self.control_intents.as_deref().unwrap_or_default()
    }
    /// <p>How AWS Assurance evaluates the control. Applies only to leaf controls. Valid values:</p>
    /// <ul>
    /// <li>
    /// <p><code>automated-scan</code> – Evaluates the configuration of your AWS resources.</p></li>
    /// <li>
    /// <p><code>document</code> – Evaluates the evidence documents that you provide.</p></li>
    /// <li>
    /// <p><code>hybrid</code> – Evaluates both resource configuration and evidence documents.</p></li>
    /// </ul>
    pub fn workflow_type(&self) -> ::std::option::Option<&crate::types::WorkflowType> {
        self.workflow_type.as_ref()
    }
    /// <p>The lifecycle status of the control.</p>
    pub fn status(&self) -> ::std::option::Option<&crate::types::ReleaseStatus> {
        self.status.as_ref()
    }
    /// <p>The time when you created the control. The response includes it only for controls in custom frameworks.</p>
    pub fn created_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
        self.created_at.as_ref()
    }
    /// <p>The time when the control was last modified. Returned for controls in custom frameworks only.</p>
    pub fn updated_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
        self.updated_at.as_ref()
    }
}
impl Control {
    /// Creates a new builder-style object to manufacture [`Control`](crate::types::Control).
    pub fn builder() -> crate::types::builders::ControlBuilder {
        crate::types::builders::ControlBuilder::default()
    }
}

/// A builder for [`Control`](crate::types::Control).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ControlBuilder {
    pub(crate) r#type: ::std::option::Option<crate::types::ControlType>,
    pub(crate) framework: ::std::option::Option<::std::string::String>,
    pub(crate) control_id: ::std::option::Option<::std::string::String>,
    pub(crate) framework_version: ::std::option::Option<::std::string::String>,
    pub(crate) group_id: ::std::option::Option<::std::string::String>,
    pub(crate) title: ::std::option::Option<::std::string::String>,
    pub(crate) description: ::std::option::Option<::std::string::String>,
    pub(crate) requirements: ::std::option::Option<::std::vec::Vec<crate::types::Requirement>>,
    pub(crate) control_intents: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) workflow_type: ::std::option::Option<crate::types::WorkflowType>,
    pub(crate) status: ::std::option::Option<crate::types::ReleaseStatus>,
    pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
    pub(crate) updated_at: ::std::option::Option<::aws_smithy_types::DateTime>,
}
impl ControlBuilder {
    /// <p>The type of the control.</p>
    /// This field is required.
    pub fn r#type(mut self, input: crate::types::ControlType) -> Self {
        self.r#type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The type of the control.</p>
    pub fn set_type(mut self, input: ::std::option::Option<crate::types::ControlType>) -> Self {
        self.r#type = input;
        self
    }
    /// <p>The type of the control.</p>
    pub fn get_type(&self) -> &::std::option::Option<crate::types::ControlType> {
        &self.r#type
    }
    /// <p>The name of the compliance framework.</p>
    pub fn framework(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.framework = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the compliance framework.</p>
    pub fn set_framework(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.framework = input;
        self
    }
    /// <p>The name of the compliance framework.</p>
    pub fn get_framework(&self) -> &::std::option::Option<::std::string::String> {
        &self.framework
    }
    /// <p>The control identifier. Optional. If omitted, the operation applies to the full framework.</p>
    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 control identifier. Optional. If omitted, the operation applies to the full framework.</p>
    pub fn set_control_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.control_id = input;
        self
    }
    /// <p>The control identifier. Optional. If omitted, the operation applies to the full framework.</p>
    pub fn get_control_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.control_id
    }
    /// <p>The version of the compliance framework.</p>
    pub fn framework_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.framework_version = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The version of the compliance framework.</p>
    pub fn set_framework_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.framework_version = input;
        self
    }
    /// <p>The version of the compliance framework.</p>
    pub fn get_framework_version(&self) -> &::std::option::Option<::std::string::String> {
        &self.framework_version
    }
    /// <p>The parent group ID (for example, "A.2" for control "A.2.2").</p>
    pub fn group_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.group_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The parent group ID (for example, "A.2" for control "A.2.2").</p>
    pub fn set_group_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.group_id = input;
        self
    }
    /// <p>The parent group ID (for example, "A.2" for control "A.2.2").</p>
    pub fn get_group_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.group_id
    }
    /// <p>The human-readable title of the control.</p>
    pub fn title(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.title = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The human-readable title of the control.</p>
    pub fn set_title(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.title = input;
        self
    }
    /// <p>The human-readable title of the control.</p>
    pub fn get_title(&self) -> &::std::option::Option<::std::string::String> {
        &self.title
    }
    /// <p>A description of the control.</p>
    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 control.</p>
    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.description = input;
        self
    }
    /// <p>A description of the control.</p>
    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
        &self.description
    }
    /// Appends an item to `requirements`.
    ///
    /// To override the contents of this collection use [`set_requirements`](Self::set_requirements).
    ///
    /// <p>The individual checks an assessment scores for this control. Absent when the control has none.</p>
    pub fn requirements(mut self, input: crate::types::Requirement) -> Self {
        let mut v = self.requirements.unwrap_or_default();
        v.push(input);
        self.requirements = ::std::option::Option::Some(v);
        self
    }
    /// <p>The individual checks an assessment scores for this control. Absent when the control has none.</p>
    pub fn set_requirements(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Requirement>>) -> Self {
        self.requirements = input;
        self
    }
    /// <p>The individual checks an assessment scores for this control. Absent when the control has none.</p>
    pub fn get_requirements(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Requirement>> {
        &self.requirements
    }
    /// Appends an item to `control_intents`.
    ///
    /// To override the contents of this collection use [`set_control_intents`](Self::set_control_intents).
    ///
    /// <p>The technical control intents classify how an assessment evaluates this leaf control. Leaf controls only.</p>
    pub fn control_intents(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.control_intents.unwrap_or_default();
        v.push(input.into());
        self.control_intents = ::std::option::Option::Some(v);
        self
    }
    /// <p>The technical control intents classify how an assessment evaluates this leaf control. Leaf controls only.</p>
    pub fn set_control_intents(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.control_intents = input;
        self
    }
    /// <p>The technical control intents classify how an assessment evaluates this leaf control. Leaf controls only.</p>
    pub fn get_control_intents(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.control_intents
    }
    /// <p>How AWS Assurance evaluates the control. Applies only to leaf controls. Valid values:</p>
    /// <ul>
    /// <li>
    /// <p><code>automated-scan</code> – Evaluates the configuration of your AWS resources.</p></li>
    /// <li>
    /// <p><code>document</code> – Evaluates the evidence documents that you provide.</p></li>
    /// <li>
    /// <p><code>hybrid</code> – Evaluates both resource configuration and evidence documents.</p></li>
    /// </ul>
    pub fn workflow_type(mut self, input: crate::types::WorkflowType) -> Self {
        self.workflow_type = ::std::option::Option::Some(input);
        self
    }
    /// <p>How AWS Assurance evaluates the control. Applies only to leaf controls. Valid values:</p>
    /// <ul>
    /// <li>
    /// <p><code>automated-scan</code> – Evaluates the configuration of your AWS resources.</p></li>
    /// <li>
    /// <p><code>document</code> – Evaluates the evidence documents that you provide.</p></li>
    /// <li>
    /// <p><code>hybrid</code> – Evaluates both resource configuration and evidence documents.</p></li>
    /// </ul>
    pub fn set_workflow_type(mut self, input: ::std::option::Option<crate::types::WorkflowType>) -> Self {
        self.workflow_type = input;
        self
    }
    /// <p>How AWS Assurance evaluates the control. Applies only to leaf controls. Valid values:</p>
    /// <ul>
    /// <li>
    /// <p><code>automated-scan</code> – Evaluates the configuration of your AWS resources.</p></li>
    /// <li>
    /// <p><code>document</code> – Evaluates the evidence documents that you provide.</p></li>
    /// <li>
    /// <p><code>hybrid</code> – Evaluates both resource configuration and evidence documents.</p></li>
    /// </ul>
    pub fn get_workflow_type(&self) -> &::std::option::Option<crate::types::WorkflowType> {
        &self.workflow_type
    }
    /// <p>The lifecycle status of the control.</p>
    pub fn status(mut self, input: crate::types::ReleaseStatus) -> Self {
        self.status = ::std::option::Option::Some(input);
        self
    }
    /// <p>The lifecycle status of the control.</p>
    pub fn set_status(mut self, input: ::std::option::Option<crate::types::ReleaseStatus>) -> Self {
        self.status = input;
        self
    }
    /// <p>The lifecycle status of the control.</p>
    pub fn get_status(&self) -> &::std::option::Option<crate::types::ReleaseStatus> {
        &self.status
    }
    /// <p>The time when you created the control. The response includes it only for controls in custom frameworks.</p>
    pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.created_at = ::std::option::Option::Some(input);
        self
    }
    /// <p>The time when you created the control. The response includes it only for controls in custom frameworks.</p>
    pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.created_at = input;
        self
    }
    /// <p>The time when you created the control. The response includes it only for controls in custom frameworks.</p>
    pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.created_at
    }
    /// <p>The time when the control was last modified. Returned for controls in custom frameworks only.</p>
    pub fn updated_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.updated_at = ::std::option::Option::Some(input);
        self
    }
    /// <p>The time when the control was last modified. Returned for controls in custom frameworks only.</p>
    pub fn set_updated_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.updated_at = input;
        self
    }
    /// <p>The time when the control was last modified. Returned for controls in custom frameworks only.</p>
    pub fn get_updated_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.updated_at
    }
    /// Consumes the builder and constructs a [`Control`](crate::types::Control).
    /// This method will fail if any of the following fields are not set:
    /// - [`r#type`](crate::types::builders::ControlBuilder::type)
    pub fn build(self) -> ::std::result::Result<crate::types::Control, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Control {
            r#type: self.r#type.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "r#type",
                    "r#type was not specified but it is required when building Control",
                )
            })?,
            framework: self.framework,
            control_id: self.control_id,
            framework_version: self.framework_version,
            group_id: self.group_id,
            title: self.title,
            description: self.description,
            requirements: self.requirements,
            control_intents: self.control_intents,
            workflow_type: self.workflow_type,
            status: self.status,
            created_at: self.created_at,
            updated_at: self.updated_at,
        })
    }
}