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>Full comment structure returned in responses.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct Comment {
    /// <p>The name of the governance environment the comment belongs to.</p>
    pub environment: ::std::string::String,
    /// <p>The name of the project.</p>
    pub project: ::std::string::String,
    /// <p>The name of the compliance framework.</p>
    pub framework: ::std::string::String,
    /// <p>The version of the compliance framework.</p>
    pub framework_version: ::std::string::String,
    /// <p>The control identifier. Optional. If omitted, the operation applies to the full framework.</p>
    pub control_id: ::std::string::String,
    /// <p>The identifier of the task.</p>
    pub task_id: ::std::option::Option<::std::string::String>,
    /// <p>The unique identifier of the comment.</p>
    pub comment_id: ::std::string::String,
    /// <p>The free-text content of the comment.</p>
    pub content: ::std::string::String,
    /// <p>The identity of the principal who added the comment.</p>
    pub added_by: ::std::option::Option<::std::string::String>,
    /// <p>The timestamp when the comment was created.</p>
    pub created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
    /// <p>The timestamp when the comment was last updated.</p>
    pub updated_at: ::std::option::Option<::aws_smithy_types::DateTime>,
}
impl Comment {
    /// <p>The name of the governance environment the comment belongs to.</p>
    pub fn environment(&self) -> &str {
        use std::ops::Deref;
        self.environment.deref()
    }
    /// <p>The name of the project.</p>
    pub fn project(&self) -> &str {
        use std::ops::Deref;
        self.project.deref()
    }
    /// <p>The name of the compliance framework.</p>
    pub fn framework(&self) -> &str {
        use std::ops::Deref;
        self.framework.deref()
    }
    /// <p>The version of the compliance framework.</p>
    pub fn framework_version(&self) -> &str {
        use std::ops::Deref;
        self.framework_version.deref()
    }
    /// <p>The control identifier. Optional. If omitted, the operation applies to the full framework.</p>
    pub fn control_id(&self) -> &str {
        use std::ops::Deref;
        self.control_id.deref()
    }
    /// <p>The identifier of the task.</p>
    pub fn task_id(&self) -> ::std::option::Option<&str> {
        self.task_id.as_deref()
    }
    /// <p>The unique identifier of the comment.</p>
    pub fn comment_id(&self) -> &str {
        use std::ops::Deref;
        self.comment_id.deref()
    }
    /// <p>The free-text content of the comment.</p>
    pub fn content(&self) -> &str {
        use std::ops::Deref;
        self.content.deref()
    }
    /// <p>The identity of the principal who added the comment.</p>
    pub fn added_by(&self) -> ::std::option::Option<&str> {
        self.added_by.as_deref()
    }
    /// <p>The timestamp when the comment was created.</p>
    pub fn created_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
        self.created_at.as_ref()
    }
    /// <p>The timestamp when the comment was last updated.</p>
    pub fn updated_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
        self.updated_at.as_ref()
    }
}
impl ::std::fmt::Debug for Comment {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("Comment");
        formatter.field("environment", &self.environment);
        formatter.field("project", &self.project);
        formatter.field("framework", &self.framework);
        formatter.field("framework_version", &self.framework_version);
        formatter.field("control_id", &self.control_id);
        formatter.field("task_id", &self.task_id);
        formatter.field("comment_id", &self.comment_id);
        formatter.field("content", &"*** Sensitive Data Redacted ***");
        formatter.field("added_by", &self.added_by);
        formatter.field("created_at", &self.created_at);
        formatter.field("updated_at", &self.updated_at);
        formatter.finish()
    }
}
impl Comment {
    /// Creates a new builder-style object to manufacture [`Comment`](crate::types::Comment).
    pub fn builder() -> crate::types::builders::CommentBuilder {
        crate::types::builders::CommentBuilder::default()
    }
}

/// A builder for [`Comment`](crate::types::Comment).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
#[non_exhaustive]
pub struct CommentBuilder {
    pub(crate) environment: ::std::option::Option<::std::string::String>,
    pub(crate) project: ::std::option::Option<::std::string::String>,
    pub(crate) framework: ::std::option::Option<::std::string::String>,
    pub(crate) framework_version: ::std::option::Option<::std::string::String>,
    pub(crate) control_id: ::std::option::Option<::std::string::String>,
    pub(crate) task_id: ::std::option::Option<::std::string::String>,
    pub(crate) comment_id: ::std::option::Option<::std::string::String>,
    pub(crate) content: ::std::option::Option<::std::string::String>,
    pub(crate) added_by: ::std::option::Option<::std::string::String>,
    pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
    pub(crate) updated_at: ::std::option::Option<::aws_smithy_types::DateTime>,
}
impl CommentBuilder {
    /// <p>The name of the governance environment the comment belongs to.</p>
    /// This field is required.
    pub fn environment(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.environment = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the governance environment the comment belongs to.</p>
    pub fn set_environment(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.environment = input;
        self
    }
    /// <p>The name of the governance environment the comment belongs to.</p>
    pub fn get_environment(&self) -> &::std::option::Option<::std::string::String> {
        &self.environment
    }
    /// <p>The name of the project.</p>
    /// This field is required.
    pub fn project(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.project = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the project.</p>
    pub fn set_project(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.project = input;
        self
    }
    /// <p>The name of the project.</p>
    pub fn get_project(&self) -> &::std::option::Option<::std::string::String> {
        &self.project
    }
    /// <p>The name of the compliance framework.</p>
    /// This field is required.
    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 version of the compliance framework.</p>
    /// This field is required.
    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 control identifier. Optional. If omitted, the operation applies to the full framework.</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 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 identifier of the task.</p>
    pub fn task_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.task_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The identifier of the task.</p>
    pub fn set_task_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.task_id = input;
        self
    }
    /// <p>The identifier of the task.</p>
    pub fn get_task_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.task_id
    }
    /// <p>The unique identifier of the comment.</p>
    /// This field is required.
    pub fn comment_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.comment_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The unique identifier of the comment.</p>
    pub fn set_comment_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.comment_id = input;
        self
    }
    /// <p>The unique identifier of the comment.</p>
    pub fn get_comment_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.comment_id
    }
    /// <p>The free-text content of the comment.</p>
    /// This field is required.
    pub fn content(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.content = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The free-text content of the comment.</p>
    pub fn set_content(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.content = input;
        self
    }
    /// <p>The free-text content of the comment.</p>
    pub fn get_content(&self) -> &::std::option::Option<::std::string::String> {
        &self.content
    }
    /// <p>The identity of the principal who added the comment.</p>
    pub fn added_by(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.added_by = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The identity of the principal who added the comment.</p>
    pub fn set_added_by(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.added_by = input;
        self
    }
    /// <p>The identity of the principal who added the comment.</p>
    pub fn get_added_by(&self) -> &::std::option::Option<::std::string::String> {
        &self.added_by
    }
    /// <p>The timestamp when the comment was created.</p>
    pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.created_at = ::std::option::Option::Some(input);
        self
    }
    /// <p>The timestamp when the comment was created.</p>
    pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.created_at = input;
        self
    }
    /// <p>The timestamp when the comment was created.</p>
    pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.created_at
    }
    /// <p>The timestamp when the comment was last updated.</p>
    pub fn updated_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.updated_at = ::std::option::Option::Some(input);
        self
    }
    /// <p>The timestamp when the comment was last updated.</p>
    pub fn set_updated_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.updated_at = input;
        self
    }
    /// <p>The timestamp when the comment was last updated.</p>
    pub fn get_updated_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.updated_at
    }
    /// Consumes the builder and constructs a [`Comment`](crate::types::Comment).
    /// This method will fail if any of the following fields are not set:
    /// - [`environment`](crate::types::builders::CommentBuilder::environment)
    /// - [`project`](crate::types::builders::CommentBuilder::project)
    /// - [`framework`](crate::types::builders::CommentBuilder::framework)
    /// - [`framework_version`](crate::types::builders::CommentBuilder::framework_version)
    /// - [`control_id`](crate::types::builders::CommentBuilder::control_id)
    /// - [`comment_id`](crate::types::builders::CommentBuilder::comment_id)
    /// - [`content`](crate::types::builders::CommentBuilder::content)
    pub fn build(self) -> ::std::result::Result<crate::types::Comment, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Comment {
            environment: self.environment.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "environment",
                    "environment was not specified but it is required when building Comment",
                )
            })?,
            project: self.project.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "project",
                    "project was not specified but it is required when building Comment",
                )
            })?,
            framework: self.framework.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "framework",
                    "framework was not specified but it is required when building Comment",
                )
            })?,
            framework_version: self.framework_version.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "framework_version",
                    "framework_version was not specified but it is required when building Comment",
                )
            })?,
            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 Comment",
                )
            })?,
            task_id: self.task_id,
            comment_id: self.comment_id.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "comment_id",
                    "comment_id was not specified but it is required when building Comment",
                )
            })?,
            content: self.content.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "content",
                    "content was not specified but it is required when building Comment",
                )
            })?,
            added_by: self.added_by,
            created_at: self.created_at,
            updated_at: self.updated_at,
        })
    }
}
impl ::std::fmt::Debug for CommentBuilder {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("CommentBuilder");
        formatter.field("environment", &self.environment);
        formatter.field("project", &self.project);
        formatter.field("framework", &self.framework);
        formatter.field("framework_version", &self.framework_version);
        formatter.field("control_id", &self.control_id);
        formatter.field("task_id", &self.task_id);
        formatter.field("comment_id", &self.comment_id);
        formatter.field("content", &"*** Sensitive Data Redacted ***");
        formatter.field("added_by", &self.added_by);
        formatter.field("created_at", &self.created_at);
        formatter.field("updated_at", &self.updated_at);
        formatter.finish()
    }
}