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.

/// Input for CreatePlan. This operation carries no scope selector: plan authoring always addresses the live app. The sandbox always runs the live app's draft, so its plans are read-only through this API. Read them with GetPlan or ListPlans using scope=sandbox or stage=DRAFT.
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct CreatePlanInput {
    /// The ID of the app the plan belongs to.
    pub app_id: ::std::option::Option<::std::string::String>,
    /// The pricing and packaging definition for the plan. The plan's identifier is not supplied here: CreatePlan mints a server-generated planId and returns it on the created plan.
    pub definition: ::std::option::Option<crate::types::PlanDefinition>,
    /// A unique, case-sensitive identifier to ensure that the operation completes no more than one time. If this token matches a previous request, the service ignores the request but does not return an error.
    pub client_token: ::std::option::Option<::std::string::String>,
    /// Optional tags to add to the plan when it is created. Tagging on create also requires permission for appmonetization:TagResource.
    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
}
impl CreatePlanInput {
    /// The ID of the app the plan belongs to.
    pub fn app_id(&self) -> ::std::option::Option<&str> {
        self.app_id.as_deref()
    }
    /// The pricing and packaging definition for the plan. The plan's identifier is not supplied here: CreatePlan mints a server-generated planId and returns it on the created plan.
    pub fn definition(&self) -> ::std::option::Option<&crate::types::PlanDefinition> {
        self.definition.as_ref()
    }
    /// A unique, case-sensitive identifier to ensure that the operation completes no more than one time. If this token matches a previous request, the service ignores the request but does not return an error.
    pub fn client_token(&self) -> ::std::option::Option<&str> {
        self.client_token.as_deref()
    }
    /// Optional tags to add to the plan when it is created. Tagging on create also requires permission for appmonetization:TagResource.
    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        self.tags.as_ref()
    }
}
impl CreatePlanInput {
    /// Creates a new builder-style object to manufacture [`CreatePlanInput`](crate::operation::create_plan::CreatePlanInput).
    pub fn builder() -> crate::operation::create_plan::builders::CreatePlanInputBuilder {
        crate::operation::create_plan::builders::CreatePlanInputBuilder::default()
    }
}

/// A builder for [`CreatePlanInput`](crate::operation::create_plan::CreatePlanInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct CreatePlanInputBuilder {
    pub(crate) app_id: ::std::option::Option<::std::string::String>,
    pub(crate) definition: ::std::option::Option<crate::types::PlanDefinition>,
    pub(crate) client_token: ::std::option::Option<::std::string::String>,
    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
}
impl CreatePlanInputBuilder {
    /// The ID of the app the plan belongs to.
    /// 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 ID of the app the plan belongs to.
    pub fn set_app_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.app_id = input;
        self
    }
    /// The ID of the app the plan belongs to.
    pub fn get_app_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.app_id
    }
    /// The pricing and packaging definition for the plan. The plan's identifier is not supplied here: CreatePlan mints a server-generated planId and returns it on the created plan.
    /// This field is required.
    pub fn definition(mut self, input: crate::types::PlanDefinition) -> Self {
        self.definition = ::std::option::Option::Some(input);
        self
    }
    /// The pricing and packaging definition for the plan. The plan's identifier is not supplied here: CreatePlan mints a server-generated planId and returns it on the created plan.
    pub fn set_definition(mut self, input: ::std::option::Option<crate::types::PlanDefinition>) -> Self {
        self.definition = input;
        self
    }
    /// The pricing and packaging definition for the plan. The plan's identifier is not supplied here: CreatePlan mints a server-generated planId and returns it on the created plan.
    pub fn get_definition(&self) -> &::std::option::Option<crate::types::PlanDefinition> {
        &self.definition
    }
    /// A unique, case-sensitive identifier to ensure that the operation completes no more than one time. If this token matches a previous request, the service ignores the request but does not return an error.
    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.client_token = ::std::option::Option::Some(input.into());
        self
    }
    /// A unique, case-sensitive identifier to ensure that the operation completes no more than one time. If this token matches a previous request, the service ignores the request but does not return an error.
    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.client_token = input;
        self
    }
    /// A unique, case-sensitive identifier to ensure that the operation completes no more than one time. If this token matches a previous request, the service ignores the request but does not return an error.
    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
        &self.client_token
    }
    /// Adds a key-value pair to `tags`.
    ///
    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
    ///
    /// Optional tags to add to the plan when it is created. Tagging on create also requires permission for appmonetization:TagResource.
    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut hash_map = self.tags.unwrap_or_default();
        hash_map.insert(k.into(), v.into());
        self.tags = ::std::option::Option::Some(hash_map);
        self
    }
    /// Optional tags to add to the plan when it is created. Tagging on create also requires permission for appmonetization:TagResource.
    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
        self.tags = input;
        self
    }
    /// Optional tags to add to the plan when it is created. Tagging on create also requires permission for appmonetization:TagResource.
    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        &self.tags
    }
    /// Consumes the builder and constructs a [`CreatePlanInput`](crate::operation::create_plan::CreatePlanInput).
    pub fn build(self) -> ::std::result::Result<crate::operation::create_plan::CreatePlanInput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::create_plan::CreatePlanInput {
            app_id: self.app_id,
            definition: self.definition,
            client_token: self.client_token,
            tags: self.tags,
        })
    }
}