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 PutEvent.
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct PutEventInput {
    /// The ID of the app the event belongs to.
    pub app_id: ::std::option::Option<::std::string::String>,
    /// 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>,
    /// The ID of the end user the event is attributed to. Do not include personally identifiable or otherwise sensitive data in this value.
    pub user_id: ::std::option::Option<::std::string::String>,
    /// The event type. Correlates with the event type of the metrics that aggregate it.
    pub event_type: ::std::option::Option<::std::string::String>,
    /// The amount of usage the event represents, as a non-negative decimal string (for example, "1" or "12.5").
    pub quantity: ::std::option::Option<::std::string::String>,
    /// The time the event occurred.
    pub timestamp: ::std::option::Option<::aws_smithy_types::DateTime>,
    /// The key/value properties carried on the event, usable in metric filters and grouping. When a metric sums or takes the max of a property, that property's value must be a plain non-negative decimal (up to 15 digits before the point and 6 after; no sign, exponent, spaces, or commas, for example "1200" or "12.5"), and events that break this are rejected.
    pub properties: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    /// The environment of the app that this operation applies to: the live app or the app's isolated sandbox test environment.
    pub scope: ::std::option::Option<crate::types::RequestScope>,
}
impl PutEventInput {
    /// The ID of the app the event belongs to.
    pub fn app_id(&self) -> ::std::option::Option<&str> {
        self.app_id.as_deref()
    }
    /// 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()
    }
    /// The ID of the end user the event is attributed to. Do not include personally identifiable or otherwise sensitive data in this value.
    pub fn user_id(&self) -> ::std::option::Option<&str> {
        self.user_id.as_deref()
    }
    /// The event type. Correlates with the event type of the metrics that aggregate it.
    pub fn event_type(&self) -> ::std::option::Option<&str> {
        self.event_type.as_deref()
    }
    /// The amount of usage the event represents, as a non-negative decimal string (for example, "1" or "12.5").
    pub fn quantity(&self) -> ::std::option::Option<&str> {
        self.quantity.as_deref()
    }
    /// The time the event occurred.
    pub fn timestamp(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
        self.timestamp.as_ref()
    }
    /// The key/value properties carried on the event, usable in metric filters and grouping. When a metric sums or takes the max of a property, that property's value must be a plain non-negative decimal (up to 15 digits before the point and 6 after; no sign, exponent, spaces, or commas, for example "1200" or "12.5"), and events that break this are rejected.
    pub fn properties(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        self.properties.as_ref()
    }
    /// The environment of the app that this operation applies to: the live app or the app's isolated sandbox test environment.
    pub fn scope(&self) -> ::std::option::Option<&crate::types::RequestScope> {
        self.scope.as_ref()
    }
}
impl PutEventInput {
    /// Creates a new builder-style object to manufacture [`PutEventInput`](crate::operation::put_event::PutEventInput).
    pub fn builder() -> crate::operation::put_event::builders::PutEventInputBuilder {
        crate::operation::put_event::builders::PutEventInputBuilder::default()
    }
}

/// A builder for [`PutEventInput`](crate::operation::put_event::PutEventInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct PutEventInputBuilder {
    pub(crate) app_id: ::std::option::Option<::std::string::String>,
    pub(crate) client_token: ::std::option::Option<::std::string::String>,
    pub(crate) user_id: ::std::option::Option<::std::string::String>,
    pub(crate) event_type: ::std::option::Option<::std::string::String>,
    pub(crate) quantity: ::std::option::Option<::std::string::String>,
    pub(crate) timestamp: ::std::option::Option<::aws_smithy_types::DateTime>,
    pub(crate) properties: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    pub(crate) scope: ::std::option::Option<crate::types::RequestScope>,
}
impl PutEventInputBuilder {
    /// The ID of the app the event 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 event 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 event belongs to.
    pub fn get_app_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.app_id
    }
    /// 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
    }
    /// The ID of the end user the event is attributed to. Do not include personally identifiable or otherwise sensitive data in this value.
    /// This field is required.
    pub fn user_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.user_id = ::std::option::Option::Some(input.into());
        self
    }
    /// The ID of the end user the event is attributed to. Do not include personally identifiable or otherwise sensitive data in this value.
    pub fn set_user_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.user_id = input;
        self
    }
    /// The ID of the end user the event is attributed to. Do not include personally identifiable or otherwise sensitive data in this value.
    pub fn get_user_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.user_id
    }
    /// The event type. Correlates with the event type of the metrics that aggregate it.
    /// 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. Correlates with the event type of the metrics that aggregate it.
    pub fn set_event_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.event_type = input;
        self
    }
    /// The event type. Correlates with the event type of the metrics that aggregate it.
    pub fn get_event_type(&self) -> &::std::option::Option<::std::string::String> {
        &self.event_type
    }
    /// The amount of usage the event represents, as a non-negative decimal string (for example, "1" or "12.5").
    /// This field is required.
    pub fn quantity(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.quantity = ::std::option::Option::Some(input.into());
        self
    }
    /// The amount of usage the event represents, as a non-negative decimal string (for example, "1" or "12.5").
    pub fn set_quantity(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.quantity = input;
        self
    }
    /// The amount of usage the event represents, as a non-negative decimal string (for example, "1" or "12.5").
    pub fn get_quantity(&self) -> &::std::option::Option<::std::string::String> {
        &self.quantity
    }
    /// The time the event occurred.
    /// This field is required.
    pub fn timestamp(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.timestamp = ::std::option::Option::Some(input);
        self
    }
    /// The time the event occurred.
    pub fn set_timestamp(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.timestamp = input;
        self
    }
    /// The time the event occurred.
    pub fn get_timestamp(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.timestamp
    }
    /// Adds a key-value pair to `properties`.
    ///
    /// To override the contents of this collection use [`set_properties`](Self::set_properties).
    ///
    /// The key/value properties carried on the event, usable in metric filters and grouping. When a metric sums or takes the max of a property, that property's value must be a plain non-negative decimal (up to 15 digits before the point and 6 after; no sign, exponent, spaces, or commas, for example "1200" or "12.5"), and events that break this are rejected.
    pub fn properties(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut hash_map = self.properties.unwrap_or_default();
        hash_map.insert(k.into(), v.into());
        self.properties = ::std::option::Option::Some(hash_map);
        self
    }
    /// The key/value properties carried on the event, usable in metric filters and grouping. When a metric sums or takes the max of a property, that property's value must be a plain non-negative decimal (up to 15 digits before the point and 6 after; no sign, exponent, spaces, or commas, for example "1200" or "12.5"), and events that break this are rejected.
    pub fn set_properties(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
        self.properties = input;
        self
    }
    /// The key/value properties carried on the event, usable in metric filters and grouping. When a metric sums or takes the max of a property, that property's value must be a plain non-negative decimal (up to 15 digits before the point and 6 after; no sign, exponent, spaces, or commas, for example "1200" or "12.5"), and events that break this are rejected.
    pub fn get_properties(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        &self.properties
    }
    /// The environment of the app that this operation applies to: the live app or the app's isolated sandbox test environment.
    /// This field is required.
    pub fn scope(mut self, input: crate::types::RequestScope) -> Self {
        self.scope = ::std::option::Option::Some(input);
        self
    }
    /// The environment of the app that this operation applies to: the live app or the app's isolated sandbox test environment.
    pub fn set_scope(mut self, input: ::std::option::Option<crate::types::RequestScope>) -> Self {
        self.scope = input;
        self
    }
    /// The environment of the app that this operation applies to: the live app or the app's isolated sandbox test environment.
    pub fn get_scope(&self) -> &::std::option::Option<crate::types::RequestScope> {
        &self.scope
    }
    /// Consumes the builder and constructs a [`PutEventInput`](crate::operation::put_event::PutEventInput).
    pub fn build(self) -> ::std::result::Result<crate::operation::put_event::PutEventInput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::put_event::PutEventInput {
            app_id: self.app_id,
            client_token: self.client_token,
            user_id: self.user_id,
            event_type: self.event_type,
            quantity: self.quantity,
            timestamp: self.timestamp,
            properties: self.properties,
            scope: self.scope,
        })
    }
}