aws-sdk-apptest 1.57.0

AWS SDK for AWS Mainframe Modernization Application Testing
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Specifies a resource.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Resource {
    /// <p>The name of the resource.</p>
    pub name: ::std::string::String,
    /// <p>The type of the resource.</p>
    pub r#type: ::std::option::Option<crate::types::ResourceType>,
}
impl Resource {
    /// <p>The name of the resource.</p>
    pub fn name(&self) -> &str {
        use std::ops::Deref;
        self.name.deref()
    }
    /// <p>The type of the resource.</p>
    pub fn r#type(&self) -> ::std::option::Option<&crate::types::ResourceType> {
        self.r#type.as_ref()
    }
}
impl Resource {
    /// Creates a new builder-style object to manufacture [`Resource`](crate::types::Resource).
    pub fn builder() -> crate::types::builders::ResourceBuilder {
        crate::types::builders::ResourceBuilder::default()
    }
}

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