aws-sdk-appmonetization 1.0.0

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

/// A monetizable application. Apps are the top-level resource that own plans, metrics, subscriptions, and usage data.
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct App {
    /// The service-assigned identifier for the app.
    pub app_id: ::std::string::String,
    /// A human-readable display name for the app.
    pub name: ::std::string::String,
    /// A longer description of what the app does.
    pub description: ::std::option::Option<::std::string::String>,
    /// The lifecycle status of the app.
    pub status: crate::types::AppStatus,
    /// The time the app was created.
    pub created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
    /// The resource ARN of this app.
    pub arn: ::std::option::Option<::std::string::String>,
}
impl App {
    /// The service-assigned identifier for the app.
    pub fn app_id(&self) -> &str {
        use std::ops::Deref;
        self.app_id.deref()
    }
    /// A human-readable display name for the app.
    pub fn name(&self) -> &str {
        use std::ops::Deref;
        self.name.deref()
    }
    /// A longer description of what the app does.
    pub fn description(&self) -> ::std::option::Option<&str> {
        self.description.as_deref()
    }
    /// The lifecycle status of the app.
    pub fn status(&self) -> &crate::types::AppStatus {
        &self.status
    }
    /// The time the app was created.
    pub fn created_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
        self.created_at.as_ref()
    }
    /// The resource ARN of this app.
    pub fn arn(&self) -> ::std::option::Option<&str> {
        self.arn.as_deref()
    }
}
impl App {
    /// Creates a new builder-style object to manufacture [`App`](crate::types::App).
    pub fn builder() -> crate::types::builders::AppBuilder {
        crate::types::builders::AppBuilder::default()
    }
}

/// A builder for [`App`](crate::types::App).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct AppBuilder {
    pub(crate) app_id: ::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) status: ::std::option::Option<crate::types::AppStatus>,
    pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
    pub(crate) arn: ::std::option::Option<::std::string::String>,
}
impl AppBuilder {
    /// The service-assigned identifier for the app.
    /// This field is required.
    pub fn app_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.app_id = ::std::option::Option::Some(input.into());
        self
    }
    /// The service-assigned identifier for the app.
    pub fn set_app_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.app_id = input;
        self
    }
    /// The service-assigned identifier for the app.
    pub fn get_app_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.app_id
    }
    /// A human-readable display name for the app.
    /// 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
    }
    /// A human-readable display name for the app.
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.name = input;
        self
    }
    /// A human-readable display name for the app.
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// A longer description of what the app does.
    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.description = ::std::option::Option::Some(input.into());
        self
    }
    /// A longer description of what the app does.
    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.description = input;
        self
    }
    /// A longer description of what the app does.
    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
        &self.description
    }
    /// The lifecycle status of the app.
    /// This field is required.
    pub fn status(mut self, input: crate::types::AppStatus) -> Self {
        self.status = ::std::option::Option::Some(input);
        self
    }
    /// The lifecycle status of the app.
    pub fn set_status(mut self, input: ::std::option::Option<crate::types::AppStatus>) -> Self {
        self.status = input;
        self
    }
    /// The lifecycle status of the app.
    pub fn get_status(&self) -> &::std::option::Option<crate::types::AppStatus> {
        &self.status
    }
    /// The time the app was created.
    pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.created_at = ::std::option::Option::Some(input);
        self
    }
    /// The time the app was created.
    pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.created_at = input;
        self
    }
    /// The time the app was created.
    pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.created_at
    }
    /// The resource ARN of this app.
    pub fn arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.arn = ::std::option::Option::Some(input.into());
        self
    }
    /// The resource ARN of this app.
    pub fn set_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.arn = input;
        self
    }
    /// The resource ARN of this app.
    pub fn get_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.arn
    }
    /// Consumes the builder and constructs a [`App`](crate::types::App).
    /// This method will fail if any of the following fields are not set:
    /// - [`app_id`](crate::types::builders::AppBuilder::app_id)
    /// - [`name`](crate::types::builders::AppBuilder::name)
    /// - [`status`](crate::types::builders::AppBuilder::status)
    pub fn build(self) -> ::std::result::Result<crate::types::App, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::App {
            app_id: self.app_id.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "app_id",
                    "app_id was not specified but it is required when building App",
                )
            })?,
            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 App")
            })?,
            description: self.description,
            status: self.status.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "status",
                    "status was not specified but it is required when building App",
                )
            })?,
            created_at: self.created_at,
            arn: self.arn,
        })
    }
}