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 comparable app, read from its public pricing page. Give `quality` or `features`: one of them is required.
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct Comparable {
    /// Short name of the comparable app. Absent: the host of `url`, lowercased, without a leading `www.`; when two comparables get the same name, the later ones get ` (2)`, ` (3)`.
    pub name: ::std::option::Option<::std::string::String>,
    /// The public pricing page the price was read from.
    pub url: ::std::string::String,
    /// How the comparable charges.
    pub mechanism: crate::types::ComparableMechanism,
    /// Its price: per month for PAID_SUB, per use for PER_REQUEST, 0 for FREE_CAPPED and FREEMIUM, the one-time price for ONE_TIME. USD only: another currencyCode is rejected.
    pub price: ::std::option::Option<crate::types::Price>,
    /// Monthly usage cap of the free tier, for FREE_CAPPED and FREEMIUM. A free tier without a cap is not used.
    pub cap: ::std::option::Option<f64>,
    /// For PAID_SUB: units of this app's billable action the plan includes per month. With `overageRate`, a customer pays the plan price plus overage at their own usage; without it, the plan stops at this allowance. Absent: the plan price covers any usage.
    pub included_units: ::std::option::Option<f64>,
    /// For PAID_SUB with `includedUnits`: price per unit past the allowance, in USD. Absent: the plan stops at `includedUnits` (no overage).
    pub overage_rate: ::std::option::Option<f64>,
    /// How good it is compared with this app, where this app is 1.
    pub quality: ::std::option::Option<f64>,
    /// Its scores on the characteristics in `features`, instead of `quality`. Required when `quality` is absent.
    pub features: ::std::option::Option<::std::collections::HashMap<::std::string::String, f64>>,
}
impl Comparable {
    /// Short name of the comparable app. Absent: the host of `url`, lowercased, without a leading `www.`; when two comparables get the same name, the later ones get ` (2)`, ` (3)`.
    pub fn name(&self) -> ::std::option::Option<&str> {
        self.name.as_deref()
    }
    /// The public pricing page the price was read from.
    pub fn url(&self) -> &str {
        use std::ops::Deref;
        self.url.deref()
    }
    /// How the comparable charges.
    pub fn mechanism(&self) -> &crate::types::ComparableMechanism {
        &self.mechanism
    }
    /// Its price: per month for PAID_SUB, per use for PER_REQUEST, 0 for FREE_CAPPED and FREEMIUM, the one-time price for ONE_TIME. USD only: another currencyCode is rejected.
    pub fn price(&self) -> ::std::option::Option<&crate::types::Price> {
        self.price.as_ref()
    }
    /// Monthly usage cap of the free tier, for FREE_CAPPED and FREEMIUM. A free tier without a cap is not used.
    pub fn cap(&self) -> ::std::option::Option<f64> {
        self.cap
    }
    /// For PAID_SUB: units of this app's billable action the plan includes per month. With `overageRate`, a customer pays the plan price plus overage at their own usage; without it, the plan stops at this allowance. Absent: the plan price covers any usage.
    pub fn included_units(&self) -> ::std::option::Option<f64> {
        self.included_units
    }
    /// For PAID_SUB with `includedUnits`: price per unit past the allowance, in USD. Absent: the plan stops at `includedUnits` (no overage).
    pub fn overage_rate(&self) -> ::std::option::Option<f64> {
        self.overage_rate
    }
    /// How good it is compared with this app, where this app is 1.
    pub fn quality(&self) -> ::std::option::Option<f64> {
        self.quality
    }
    /// Its scores on the characteristics in `features`, instead of `quality`. Required when `quality` is absent.
    pub fn features(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, f64>> {
        self.features.as_ref()
    }
}
impl ::std::fmt::Debug for Comparable {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("Comparable");
        formatter.field("name", &"*** Sensitive Data Redacted ***");
        formatter.field("url", &"*** Sensitive Data Redacted ***");
        formatter.field("mechanism", &"*** Sensitive Data Redacted ***");
        formatter.field("price", &"*** Sensitive Data Redacted ***");
        formatter.field("cap", &"*** Sensitive Data Redacted ***");
        formatter.field("included_units", &"*** Sensitive Data Redacted ***");
        formatter.field("overage_rate", &"*** Sensitive Data Redacted ***");
        formatter.field("quality", &"*** Sensitive Data Redacted ***");
        formatter.field("features", &"*** Sensitive Data Redacted ***");
        formatter.finish()
    }
}
impl Comparable {
    /// Creates a new builder-style object to manufacture [`Comparable`](crate::types::Comparable).
    pub fn builder() -> crate::types::builders::ComparableBuilder {
        crate::types::builders::ComparableBuilder::default()
    }
}

/// A builder for [`Comparable`](crate::types::Comparable).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
#[non_exhaustive]
pub struct ComparableBuilder {
    pub(crate) name: ::std::option::Option<::std::string::String>,
    pub(crate) url: ::std::option::Option<::std::string::String>,
    pub(crate) mechanism: ::std::option::Option<crate::types::ComparableMechanism>,
    pub(crate) price: ::std::option::Option<crate::types::Price>,
    pub(crate) cap: ::std::option::Option<f64>,
    pub(crate) included_units: ::std::option::Option<f64>,
    pub(crate) overage_rate: ::std::option::Option<f64>,
    pub(crate) quality: ::std::option::Option<f64>,
    pub(crate) features: ::std::option::Option<::std::collections::HashMap<::std::string::String, f64>>,
}
impl ComparableBuilder {
    /// Short name of the comparable app. Absent: the host of `url`, lowercased, without a leading `www.`; when two comparables get the same name, the later ones get ` (2)`, ` (3)`.
    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.name = ::std::option::Option::Some(input.into());
        self
    }
    /// Short name of the comparable app. Absent: the host of `url`, lowercased, without a leading `www.`; when two comparables get the same name, the later ones get ` (2)`, ` (3)`.
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.name = input;
        self
    }
    /// Short name of the comparable app. Absent: the host of `url`, lowercased, without a leading `www.`; when two comparables get the same name, the later ones get ` (2)`, ` (3)`.
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// The public pricing page the price was read from.
    /// This field is required.
    pub fn url(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.url = ::std::option::Option::Some(input.into());
        self
    }
    /// The public pricing page the price was read from.
    pub fn set_url(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.url = input;
        self
    }
    /// The public pricing page the price was read from.
    pub fn get_url(&self) -> &::std::option::Option<::std::string::String> {
        &self.url
    }
    /// How the comparable charges.
    /// This field is required.
    pub fn mechanism(mut self, input: crate::types::ComparableMechanism) -> Self {
        self.mechanism = ::std::option::Option::Some(input);
        self
    }
    /// How the comparable charges.
    pub fn set_mechanism(mut self, input: ::std::option::Option<crate::types::ComparableMechanism>) -> Self {
        self.mechanism = input;
        self
    }
    /// How the comparable charges.
    pub fn get_mechanism(&self) -> &::std::option::Option<crate::types::ComparableMechanism> {
        &self.mechanism
    }
    /// Its price: per month for PAID_SUB, per use for PER_REQUEST, 0 for FREE_CAPPED and FREEMIUM, the one-time price for ONE_TIME. USD only: another currencyCode is rejected.
    /// This field is required.
    pub fn price(mut self, input: crate::types::Price) -> Self {
        self.price = ::std::option::Option::Some(input);
        self
    }
    /// Its price: per month for PAID_SUB, per use for PER_REQUEST, 0 for FREE_CAPPED and FREEMIUM, the one-time price for ONE_TIME. USD only: another currencyCode is rejected.
    pub fn set_price(mut self, input: ::std::option::Option<crate::types::Price>) -> Self {
        self.price = input;
        self
    }
    /// Its price: per month for PAID_SUB, per use for PER_REQUEST, 0 for FREE_CAPPED and FREEMIUM, the one-time price for ONE_TIME. USD only: another currencyCode is rejected.
    pub fn get_price(&self) -> &::std::option::Option<crate::types::Price> {
        &self.price
    }
    /// Monthly usage cap of the free tier, for FREE_CAPPED and FREEMIUM. A free tier without a cap is not used.
    pub fn cap(mut self, input: f64) -> Self {
        self.cap = ::std::option::Option::Some(input);
        self
    }
    /// Monthly usage cap of the free tier, for FREE_CAPPED and FREEMIUM. A free tier without a cap is not used.
    pub fn set_cap(mut self, input: ::std::option::Option<f64>) -> Self {
        self.cap = input;
        self
    }
    /// Monthly usage cap of the free tier, for FREE_CAPPED and FREEMIUM. A free tier without a cap is not used.
    pub fn get_cap(&self) -> &::std::option::Option<f64> {
        &self.cap
    }
    /// For PAID_SUB: units of this app's billable action the plan includes per month. With `overageRate`, a customer pays the plan price plus overage at their own usage; without it, the plan stops at this allowance. Absent: the plan price covers any usage.
    pub fn included_units(mut self, input: f64) -> Self {
        self.included_units = ::std::option::Option::Some(input);
        self
    }
    /// For PAID_SUB: units of this app's billable action the plan includes per month. With `overageRate`, a customer pays the plan price plus overage at their own usage; without it, the plan stops at this allowance. Absent: the plan price covers any usage.
    pub fn set_included_units(mut self, input: ::std::option::Option<f64>) -> Self {
        self.included_units = input;
        self
    }
    /// For PAID_SUB: units of this app's billable action the plan includes per month. With `overageRate`, a customer pays the plan price plus overage at their own usage; without it, the plan stops at this allowance. Absent: the plan price covers any usage.
    pub fn get_included_units(&self) -> &::std::option::Option<f64> {
        &self.included_units
    }
    /// For PAID_SUB with `includedUnits`: price per unit past the allowance, in USD. Absent: the plan stops at `includedUnits` (no overage).
    pub fn overage_rate(mut self, input: f64) -> Self {
        self.overage_rate = ::std::option::Option::Some(input);
        self
    }
    /// For PAID_SUB with `includedUnits`: price per unit past the allowance, in USD. Absent: the plan stops at `includedUnits` (no overage).
    pub fn set_overage_rate(mut self, input: ::std::option::Option<f64>) -> Self {
        self.overage_rate = input;
        self
    }
    /// For PAID_SUB with `includedUnits`: price per unit past the allowance, in USD. Absent: the plan stops at `includedUnits` (no overage).
    pub fn get_overage_rate(&self) -> &::std::option::Option<f64> {
        &self.overage_rate
    }
    /// How good it is compared with this app, where this app is 1.
    pub fn quality(mut self, input: f64) -> Self {
        self.quality = ::std::option::Option::Some(input);
        self
    }
    /// How good it is compared with this app, where this app is 1.
    pub fn set_quality(mut self, input: ::std::option::Option<f64>) -> Self {
        self.quality = input;
        self
    }
    /// How good it is compared with this app, where this app is 1.
    pub fn get_quality(&self) -> &::std::option::Option<f64> {
        &self.quality
    }
    /// Adds a key-value pair to `features`.
    ///
    /// To override the contents of this collection use [`set_features`](Self::set_features).
    ///
    /// Its scores on the characteristics in `features`, instead of `quality`. Required when `quality` is absent.
    pub fn features(mut self, k: impl ::std::convert::Into<::std::string::String>, v: f64) -> Self {
        let mut hash_map = self.features.unwrap_or_default();
        hash_map.insert(k.into(), v);
        self.features = ::std::option::Option::Some(hash_map);
        self
    }
    /// Its scores on the characteristics in `features`, instead of `quality`. Required when `quality` is absent.
    pub fn set_features(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, f64>>) -> Self {
        self.features = input;
        self
    }
    /// Its scores on the characteristics in `features`, instead of `quality`. Required when `quality` is absent.
    pub fn get_features(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, f64>> {
        &self.features
    }
    /// Consumes the builder and constructs a [`Comparable`](crate::types::Comparable).
    /// This method will fail if any of the following fields are not set:
    /// - [`url`](crate::types::builders::ComparableBuilder::url)
    /// - [`mechanism`](crate::types::builders::ComparableBuilder::mechanism)
    pub fn build(self) -> ::std::result::Result<crate::types::Comparable, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Comparable {
            name: self.name,
            url: self.url.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "url",
                    "url was not specified but it is required when building Comparable",
                )
            })?,
            mechanism: self.mechanism.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "mechanism",
                    "mechanism was not specified but it is required when building Comparable",
                )
            })?,
            price: self.price,
            cap: self.cap,
            included_units: self.included_units,
            overage_rate: self.overage_rate,
            quality: self.quality,
            features: self.features,
        })
    }
}
impl ::std::fmt::Debug for ComparableBuilder {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("ComparableBuilder");
        formatter.field("name", &"*** Sensitive Data Redacted ***");
        formatter.field("url", &"*** Sensitive Data Redacted ***");
        formatter.field("mechanism", &"*** Sensitive Data Redacted ***");
        formatter.field("price", &"*** Sensitive Data Redacted ***");
        formatter.field("cap", &"*** Sensitive Data Redacted ***");
        formatter.field("included_units", &"*** Sensitive Data Redacted ***");
        formatter.field("overage_rate", &"*** Sensitive Data Redacted ***");
        formatter.field("quality", &"*** Sensitive Data Redacted ***");
        formatter.field("features", &"*** Sensitive Data Redacted ***");
        formatter.finish()
    }
}