aws-sdk-securityagent 1.1.0

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

/// Files containing relevant data for review
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Artifact {
    /// The content of the artifact
    pub contents: ::std::string::String,
    /// The file type of the artifact
    pub r#type: crate::types::ArtifactType,
}
impl Artifact {
    /// The content of the artifact
    pub fn contents(&self) -> &str {
        use std::ops::Deref;
        self.contents.deref()
    }
    /// The file type of the artifact
    pub fn r#type(&self) -> &crate::types::ArtifactType {
        &self.r#type
    }
}
impl Artifact {
    /// Creates a new builder-style object to manufacture [`Artifact`](crate::types::Artifact).
    pub fn builder() -> crate::types::builders::ArtifactBuilder {
        crate::types::builders::ArtifactBuilder::default()
    }
}

/// A builder for [`Artifact`](crate::types::Artifact).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ArtifactBuilder {
    pub(crate) contents: ::std::option::Option<::std::string::String>,
    pub(crate) r#type: ::std::option::Option<crate::types::ArtifactType>,
}
impl ArtifactBuilder {
    /// The content of the artifact
    /// This field is required.
    pub fn contents(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.contents = ::std::option::Option::Some(input.into());
        self
    }
    /// The content of the artifact
    pub fn set_contents(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.contents = input;
        self
    }
    /// The content of the artifact
    pub fn get_contents(&self) -> &::std::option::Option<::std::string::String> {
        &self.contents
    }
    /// The file type of the artifact
    /// This field is required.
    pub fn r#type(mut self, input: crate::types::ArtifactType) -> Self {
        self.r#type = ::std::option::Option::Some(input);
        self
    }
    /// The file type of the artifact
    pub fn set_type(mut self, input: ::std::option::Option<crate::types::ArtifactType>) -> Self {
        self.r#type = input;
        self
    }
    /// The file type of the artifact
    pub fn get_type(&self) -> &::std::option::Option<crate::types::ArtifactType> {
        &self.r#type
    }
    /// Consumes the builder and constructs a [`Artifact`](crate::types::Artifact).
    /// This method will fail if any of the following fields are not set:
    /// - [`contents`](crate::types::builders::ArtifactBuilder::contents)
    /// - [`r#type`](crate::types::builders::ArtifactBuilder::type)
    pub fn build(self) -> ::std::result::Result<crate::types::Artifact, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Artifact {
            contents: self.contents.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "contents",
                    "contents was not specified but it is required when building Artifact",
                )
            })?,
            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 Artifact",
                )
            })?,
        })
    }
}