aws-sdk-resourcegroups 1.23.0

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

/// <p>A resource group that contains Amazon Web Services resources. You can assign resources to the group by associating either of the following elements with the group:</p>
/// <ul>
/// <li>
/// <p><code>ResourceQuery</code> - Use a resource query to specify a set of tag keys and values. All resources in the same Amazon Web Services Region and Amazon Web Services account that have those keys with the same values are included in the group. You can add a resource query when you create the group, or later by using the <code>PutGroupConfiguration</code> operation.</p></li>
/// <li>
/// <p><code>GroupConfiguration</code> - Use a service configuration to associate the group with an Amazon Web Services service. The configuration specifies which resource types can be included in the group.</p></li>
/// </ul>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Group {
    /// <p>The ARN of the resource group.</p>
    pub group_arn: ::std::string::String,
    /// <p>The name of the resource group.</p>
    pub name: ::std::string::String,
    /// <p>The description of the resource group.</p>
    pub description: ::std::option::Option<::std::string::String>,
}
impl Group {
    /// <p>The ARN of the resource group.</p>
    pub fn group_arn(&self) -> &str {
        use std::ops::Deref;
        self.group_arn.deref()
    }
    /// <p>The name of the resource group.</p>
    pub fn name(&self) -> &str {
        use std::ops::Deref;
        self.name.deref()
    }
    /// <p>The description of the resource group.</p>
    pub fn description(&self) -> ::std::option::Option<&str> {
        self.description.as_deref()
    }
}
impl Group {
    /// Creates a new builder-style object to manufacture [`Group`](crate::types::Group).
    pub fn builder() -> crate::types::builders::GroupBuilder {
        crate::types::builders::GroupBuilder::default()
    }
}

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