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 CreateMetric. This operation carries no scope selector: metric authoring always addresses the live app. The sandbox always runs the live app's draft, so its metrics are read-only through this API. Read them with GetMetric or ListMetrics using scope=sandbox or stage=DRAFT.
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct CreateMetricInput {
    /// The ID of the app the metric belongs to.
    pub app_id: ::std::option::Option<::std::string::String>,
    /// A human-readable display name for the metric (for example, `Riddles Solved`).
    pub name: ::std::option::Option<::std::string::String>,
    /// A description of what the metric measures.
    pub description: ::std::option::Option<::std::string::String>,
    /// The event type this metric aggregates. Must match the eventType sent on PutEvent.
    pub event_type: ::std::option::Option<::std::string::String>,
    /// The unit of measure for the metric (for example, "requests" or "tokens").
    pub unit_name: ::std::option::Option<::std::string::String>,
    /// The aggregation definition: filters, aggregation function, grouping, and period.
    pub definition: ::std::option::Option<crate::types::MetricDefinition>,
    /// 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 metric 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 CreateMetricInput {
    /// The ID of the app the metric belongs to.
    pub fn app_id(&self) -> ::std::option::Option<&str> {
        self.app_id.as_deref()
    }
    /// A human-readable display name for the metric (for example, `Riddles Solved`).
    pub fn name(&self) -> ::std::option::Option<&str> {
        self.name.as_deref()
    }
    /// A description of what the metric measures.
    pub fn description(&self) -> ::std::option::Option<&str> {
        self.description.as_deref()
    }
    /// The event type this metric aggregates. Must match the eventType sent on PutEvent.
    pub fn event_type(&self) -> ::std::option::Option<&str> {
        self.event_type.as_deref()
    }
    /// The unit of measure for the metric (for example, "requests" or "tokens").
    pub fn unit_name(&self) -> ::std::option::Option<&str> {
        self.unit_name.as_deref()
    }
    /// The aggregation definition: filters, aggregation function, grouping, and period.
    pub fn definition(&self) -> ::std::option::Option<&crate::types::MetricDefinition> {
        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 metric 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 CreateMetricInput {
    /// Creates a new builder-style object to manufacture [`CreateMetricInput`](crate::operation::create_metric::CreateMetricInput).
    pub fn builder() -> crate::operation::create_metric::builders::CreateMetricInputBuilder {
        crate::operation::create_metric::builders::CreateMetricInputBuilder::default()
    }
}

/// A builder for [`CreateMetricInput`](crate::operation::create_metric::CreateMetricInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct CreateMetricInputBuilder {
    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) event_type: ::std::option::Option<::std::string::String>,
    pub(crate) unit_name: ::std::option::Option<::std::string::String>,
    pub(crate) definition: ::std::option::Option<crate::types::MetricDefinition>,
    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 CreateMetricInputBuilder {
    /// The ID of the app the metric 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 metric 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 metric belongs to.
    pub fn get_app_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.app_id
    }
    /// A human-readable display name for the metric (for example, `Riddles Solved`).
    /// 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 metric (for example, `Riddles Solved`).
    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 metric (for example, `Riddles Solved`).
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// A description of what the metric measures.
    /// This field is required.
    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.description = ::std::option::Option::Some(input.into());
        self
    }
    /// A description of what the metric measures.
    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.description = input;
        self
    }
    /// A description of what the metric measures.
    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
        &self.description
    }
    /// The event type this metric aggregates. Must match the eventType sent on PutEvent.
    /// This field is required.
    pub fn event_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.event_type = ::std::option::Option::Some(input.into());
        self
    }
    /// The event type this metric aggregates. Must match the eventType sent on PutEvent.
    pub fn set_event_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.event_type = input;
        self
    }
    /// The event type this metric aggregates. Must match the eventType sent on PutEvent.
    pub fn get_event_type(&self) -> &::std::option::Option<::std::string::String> {
        &self.event_type
    }
    /// The unit of measure for the metric (for example, "requests" or "tokens").
    /// This field is required.
    pub fn unit_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.unit_name = ::std::option::Option::Some(input.into());
        self
    }
    /// The unit of measure for the metric (for example, "requests" or "tokens").
    pub fn set_unit_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.unit_name = input;
        self
    }
    /// The unit of measure for the metric (for example, "requests" or "tokens").
    pub fn get_unit_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.unit_name
    }
    /// The aggregation definition: filters, aggregation function, grouping, and period.
    /// This field is required.
    pub fn definition(mut self, input: crate::types::MetricDefinition) -> Self {
        self.definition = ::std::option::Option::Some(input);
        self
    }
    /// The aggregation definition: filters, aggregation function, grouping, and period.
    pub fn set_definition(mut self, input: ::std::option::Option<crate::types::MetricDefinition>) -> Self {
        self.definition = input;
        self
    }
    /// The aggregation definition: filters, aggregation function, grouping, and period.
    pub fn get_definition(&self) -> &::std::option::Option<crate::types::MetricDefinition> {
        &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 metric 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 metric 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 metric 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 [`CreateMetricInput`](crate::operation::create_metric::CreateMetricInput).
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::create_metric::CreateMetricInput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::create_metric::CreateMetricInput {
            app_id: self.app_id,
            name: self.name,
            description: self.description,
            event_type: self.event_type,
            unit_name: self.unit_name,
            definition: self.definition,
            client_token: self.client_token,
            tags: self.tags,
        })
    }
}