aws-sdk-mobile 1.35.0

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

/// <p>Information about an instance of an AWS resource associated with a project.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Resource {
    /// <p>Simplified name for type of AWS resource (e.g., bucket is an Amazon S3 bucket).</p>
    pub r#type: ::std::option::Option<::std::string::String>,
    /// <p>Name of the AWS resource (e.g., for an Amazon S3 bucket this is the name of the bucket).</p>
    pub name: ::std::option::Option<::std::string::String>,
    /// <p>AWS resource name which uniquely identifies the resource in AWS systems.</p>
    pub arn: ::std::option::Option<::std::string::String>,
    /// <p>Identifies which feature in AWS Mobile Hub is associated with this AWS resource.</p>
    pub feature: ::std::option::Option<::std::string::String>,
    /// <p>Key-value attribute pairs.</p>
    pub attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
}
impl Resource {
    /// <p>Simplified name for type of AWS resource (e.g., bucket is an Amazon S3 bucket).</p>
    pub fn r#type(&self) -> ::std::option::Option<&str> {
        self.r#type.as_deref()
    }
    /// <p>Name of the AWS resource (e.g., for an Amazon S3 bucket this is the name of the bucket).</p>
    pub fn name(&self) -> ::std::option::Option<&str> {
        self.name.as_deref()
    }
    /// <p>AWS resource name which uniquely identifies the resource in AWS systems.</p>
    pub fn arn(&self) -> ::std::option::Option<&str> {
        self.arn.as_deref()
    }
    /// <p>Identifies which feature in AWS Mobile Hub is associated with this AWS resource.</p>
    pub fn feature(&self) -> ::std::option::Option<&str> {
        self.feature.as_deref()
    }
    /// <p>Key-value attribute pairs.</p>
    pub fn attributes(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        self.attributes.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) r#type: ::std::option::Option<::std::string::String>,
    pub(crate) name: ::std::option::Option<::std::string::String>,
    pub(crate) arn: ::std::option::Option<::std::string::String>,
    pub(crate) feature: ::std::option::Option<::std::string::String>,
    pub(crate) attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
}
impl ResourceBuilder {
    /// <p>Simplified name for type of AWS resource (e.g., bucket is an Amazon S3 bucket).</p>
    pub fn r#type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.r#type = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Simplified name for type of AWS resource (e.g., bucket is an Amazon S3 bucket).</p>
    pub fn set_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.r#type = input;
        self
    }
    /// <p>Simplified name for type of AWS resource (e.g., bucket is an Amazon S3 bucket).</p>
    pub fn get_type(&self) -> &::std::option::Option<::std::string::String> {
        &self.r#type
    }
    /// <p>Name of the AWS resource (e.g., for an Amazon S3 bucket this is the name of the bucket).</p>
    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Name of the AWS resource (e.g., for an Amazon S3 bucket this is the name of the bucket).</p>
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.name = input;
        self
    }
    /// <p>Name of the AWS resource (e.g., for an Amazon S3 bucket this is the name of the bucket).</p>
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// <p>AWS resource name which uniquely identifies the resource in AWS systems.</p>
    pub fn arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>AWS resource name which uniquely identifies the resource in AWS systems.</p>
    pub fn set_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.arn = input;
        self
    }
    /// <p>AWS resource name which uniquely identifies the resource in AWS systems.</p>
    pub fn get_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.arn
    }
    /// <p>Identifies which feature in AWS Mobile Hub is associated with this AWS resource.</p>
    pub fn feature(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.feature = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Identifies which feature in AWS Mobile Hub is associated with this AWS resource.</p>
    pub fn set_feature(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.feature = input;
        self
    }
    /// <p>Identifies which feature in AWS Mobile Hub is associated with this AWS resource.</p>
    pub fn get_feature(&self) -> &::std::option::Option<::std::string::String> {
        &self.feature
    }
    /// Adds a key-value pair to `attributes`.
    ///
    /// To override the contents of this collection use [`set_attributes`](Self::set_attributes).
    ///
    /// <p>Key-value attribute pairs.</p>
    pub fn attributes(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut hash_map = self.attributes.unwrap_or_default();
        hash_map.insert(k.into(), v.into());
        self.attributes = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>Key-value attribute pairs.</p>
    pub fn set_attributes(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
        self.attributes = input;
        self
    }
    /// <p>Key-value attribute pairs.</p>
    pub fn get_attributes(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        &self.attributes
    }
    /// Consumes the builder and constructs a [`Resource`](crate::types::Resource).
    pub fn build(self) -> crate::types::Resource {
        crate::types::Resource {
            r#type: self.r#type,
            name: self.name,
            arn: self.arn,
            feature: self.feature,
            attributes: self.attributes,
        }
    }
}