aws-sdk-resourcegroups 1.57.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 Amazon resource name (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>,
    /// <p>The critical rank of the application group on a scale of 1 to 10, with a rank of 1 being the most critical, and a rank of 10 being least critical.</p>
    pub criticality: ::std::option::Option<i32>,
    /// <p>A name, email address or other identifier for the person or group who is considered as the owner of this application group within your organization.</p>
    pub owner: ::std::option::Option<::std::string::String>,
    /// <p>The name of the application group, which you can change at any time.</p>
    pub display_name: ::std::option::Option<::std::string::String>,
    /// <p>A tag that defines the application group membership. This tag is only supported for application groups.</p>
    pub application_tag: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
}
impl Group {
    /// <p>The Amazon resource name (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()
    }
    /// <p>The critical rank of the application group on a scale of 1 to 10, with a rank of 1 being the most critical, and a rank of 10 being least critical.</p>
    pub fn criticality(&self) -> ::std::option::Option<i32> {
        self.criticality
    }
    /// <p>A name, email address or other identifier for the person or group who is considered as the owner of this application group within your organization.</p>
    pub fn owner(&self) -> ::std::option::Option<&str> {
        self.owner.as_deref()
    }
    /// <p>The name of the application group, which you can change at any time.</p>
    pub fn display_name(&self) -> ::std::option::Option<&str> {
        self.display_name.as_deref()
    }
    /// <p>A tag that defines the application group membership. This tag is only supported for application groups.</p>
    pub fn application_tag(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        self.application_tag.as_ref()
    }
}
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).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
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>,
    pub(crate) criticality: ::std::option::Option<i32>,
    pub(crate) owner: ::std::option::Option<::std::string::String>,
    pub(crate) display_name: ::std::option::Option<::std::string::String>,
    pub(crate) application_tag: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
}
impl GroupBuilder {
    /// <p>The Amazon resource name (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 Amazon resource name (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 Amazon resource name (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
    }
    /// <p>The critical rank of the application group on a scale of 1 to 10, with a rank of 1 being the most critical, and a rank of 10 being least critical.</p>
    pub fn criticality(mut self, input: i32) -> Self {
        self.criticality = ::std::option::Option::Some(input);
        self
    }
    /// <p>The critical rank of the application group on a scale of 1 to 10, with a rank of 1 being the most critical, and a rank of 10 being least critical.</p>
    pub fn set_criticality(mut self, input: ::std::option::Option<i32>) -> Self {
        self.criticality = input;
        self
    }
    /// <p>The critical rank of the application group on a scale of 1 to 10, with a rank of 1 being the most critical, and a rank of 10 being least critical.</p>
    pub fn get_criticality(&self) -> &::std::option::Option<i32> {
        &self.criticality
    }
    /// <p>A name, email address or other identifier for the person or group who is considered as the owner of this application group within your organization.</p>
    pub fn owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.owner = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A name, email address or other identifier for the person or group who is considered as the owner of this application group within your organization.</p>
    pub fn set_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.owner = input;
        self
    }
    /// <p>A name, email address or other identifier for the person or group who is considered as the owner of this application group within your organization.</p>
    pub fn get_owner(&self) -> &::std::option::Option<::std::string::String> {
        &self.owner
    }
    /// <p>The name of the application group, which you can change at any time.</p>
    pub fn display_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.display_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the application group, which you can change at any time.</p>
    pub fn set_display_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.display_name = input;
        self
    }
    /// <p>The name of the application group, which you can change at any time.</p>
    pub fn get_display_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.display_name
    }
    /// Adds a key-value pair to `application_tag`.
    ///
    /// To override the contents of this collection use [`set_application_tag`](Self::set_application_tag).
    ///
    /// <p>A tag that defines the application group membership. This tag is only supported for application groups.</p>
    pub fn application_tag(
        mut self,
        k: impl ::std::convert::Into<::std::string::String>,
        v: impl ::std::convert::Into<::std::string::String>,
    ) -> Self {
        let mut hash_map = self.application_tag.unwrap_or_default();
        hash_map.insert(k.into(), v.into());
        self.application_tag = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>A tag that defines the application group membership. This tag is only supported for application groups.</p>
    pub fn set_application_tag(
        mut self,
        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    ) -> Self {
        self.application_tag = input;
        self
    }
    /// <p>A tag that defines the application group membership. This tag is only supported for application groups.</p>
    pub fn get_application_tag(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        &self.application_tag
    }
    /// 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,
            criticality: self.criticality,
            owner: self.owner,
            display_name: self.display_name,
            application_tag: self.application_tag,
        })
    }
}