aws-sdk-wafv2 1.130.0

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

/// <p>The price per request for a payment network, specifying the amount and cryptocurrency.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Price {
    /// <p>The price per request as a decimal string in the specified currency. Minimum: 0.001. Maximum: 999999999.999. Supports up to 3 decimal places.</p>
    pub amount: ::std::string::String,
    /// <p>The cryptocurrency for payment. Currently only <code>USDC</code> is supported.</p>
    pub currency: crate::types::CryptoCurrency,
}
impl Price {
    /// <p>The price per request as a decimal string in the specified currency. Minimum: 0.001. Maximum: 999999999.999. Supports up to 3 decimal places.</p>
    pub fn amount(&self) -> &str {
        use std::ops::Deref;
        self.amount.deref()
    }
    /// <p>The cryptocurrency for payment. Currently only <code>USDC</code> is supported.</p>
    pub fn currency(&self) -> &crate::types::CryptoCurrency {
        &self.currency
    }
}
impl Price {
    /// Creates a new builder-style object to manufacture [`Price`](crate::types::Price).
    pub fn builder() -> crate::types::builders::PriceBuilder {
        crate::types::builders::PriceBuilder::default()
    }
}

/// A builder for [`Price`](crate::types::Price).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct PriceBuilder {
    pub(crate) amount: ::std::option::Option<::std::string::String>,
    pub(crate) currency: ::std::option::Option<crate::types::CryptoCurrency>,
}
impl PriceBuilder {
    /// <p>The price per request as a decimal string in the specified currency. Minimum: 0.001. Maximum: 999999999.999. Supports up to 3 decimal places.</p>
    /// This field is required.
    pub fn amount(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.amount = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The price per request as a decimal string in the specified currency. Minimum: 0.001. Maximum: 999999999.999. Supports up to 3 decimal places.</p>
    pub fn set_amount(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.amount = input;
        self
    }
    /// <p>The price per request as a decimal string in the specified currency. Minimum: 0.001. Maximum: 999999999.999. Supports up to 3 decimal places.</p>
    pub fn get_amount(&self) -> &::std::option::Option<::std::string::String> {
        &self.amount
    }
    /// <p>The cryptocurrency for payment. Currently only <code>USDC</code> is supported.</p>
    /// This field is required.
    pub fn currency(mut self, input: crate::types::CryptoCurrency) -> Self {
        self.currency = ::std::option::Option::Some(input);
        self
    }
    /// <p>The cryptocurrency for payment. Currently only <code>USDC</code> is supported.</p>
    pub fn set_currency(mut self, input: ::std::option::Option<crate::types::CryptoCurrency>) -> Self {
        self.currency = input;
        self
    }
    /// <p>The cryptocurrency for payment. Currently only <code>USDC</code> is supported.</p>
    pub fn get_currency(&self) -> &::std::option::Option<crate::types::CryptoCurrency> {
        &self.currency
    }
    /// Consumes the builder and constructs a [`Price`](crate::types::Price).
    /// This method will fail if any of the following fields are not set:
    /// - [`amount`](crate::types::builders::PriceBuilder::amount)
    /// - [`currency`](crate::types::builders::PriceBuilder::currency)
    pub fn build(self) -> ::std::result::Result<crate::types::Price, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Price {
            amount: self.amount.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "amount",
                    "amount was not specified but it is required when building Price",
                )
            })?,
            currency: self.currency.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "currency",
                    "currency was not specified but it is required when building Price",
                )
            })?,
        })
    }
}