{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.PinpointEmail.Types.SendQuota
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.PinpointEmail.Types.SendQuota where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object that contains information about the per-day and per-second
-- sending limits for your Amazon Pinpoint account in the current AWS
-- Region.
--
-- /See:/ 'newSendQuota' smart constructor.
data SendQuota = SendQuota'
  { -- | The maximum number of emails that you can send per second in the current
    -- AWS Region. This value is also called your /maximum sending rate/ or
    -- your /maximum TPS (transactions per second) rate/.
    SendQuota -> Maybe Double
maxSendRate :: Prelude.Maybe Prelude.Double,
    -- | The number of emails sent from your Amazon Pinpoint account in the
    -- current AWS Region over the past 24 hours.
    SendQuota -> Maybe Double
sentLast24Hours :: Prelude.Maybe Prelude.Double,
    -- | The maximum number of emails that you can send in the current AWS Region
    -- over a 24-hour period. This value is also called your /sending quota/.
    SendQuota -> Maybe Double
max24HourSend :: Prelude.Maybe Prelude.Double
  }
  deriving (SendQuota -> SendQuota -> Bool
(SendQuota -> SendQuota -> Bool)
-> (SendQuota -> SendQuota -> Bool) -> Eq SendQuota
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendQuota -> SendQuota -> Bool
$c/= :: SendQuota -> SendQuota -> Bool
== :: SendQuota -> SendQuota -> Bool
$c== :: SendQuota -> SendQuota -> Bool
Prelude.Eq, ReadPrec [SendQuota]
ReadPrec SendQuota
Int -> ReadS SendQuota
ReadS [SendQuota]
(Int -> ReadS SendQuota)
-> ReadS [SendQuota]
-> ReadPrec SendQuota
-> ReadPrec [SendQuota]
-> Read SendQuota
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendQuota]
$creadListPrec :: ReadPrec [SendQuota]
readPrec :: ReadPrec SendQuota
$creadPrec :: ReadPrec SendQuota
readList :: ReadS [SendQuota]
$creadList :: ReadS [SendQuota]
readsPrec :: Int -> ReadS SendQuota
$creadsPrec :: Int -> ReadS SendQuota
Prelude.Read, Int -> SendQuota -> ShowS
[SendQuota] -> ShowS
SendQuota -> String
(Int -> SendQuota -> ShowS)
-> (SendQuota -> String)
-> ([SendQuota] -> ShowS)
-> Show SendQuota
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendQuota] -> ShowS
$cshowList :: [SendQuota] -> ShowS
show :: SendQuota -> String
$cshow :: SendQuota -> String
showsPrec :: Int -> SendQuota -> ShowS
$cshowsPrec :: Int -> SendQuota -> ShowS
Prelude.Show, (forall x. SendQuota -> Rep SendQuota x)
-> (forall x. Rep SendQuota x -> SendQuota) -> Generic SendQuota
forall x. Rep SendQuota x -> SendQuota
forall x. SendQuota -> Rep SendQuota x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendQuota x -> SendQuota
$cfrom :: forall x. SendQuota -> Rep SendQuota x
Prelude.Generic)

-- |
-- Create a value of 'SendQuota' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'maxSendRate', 'sendQuota_maxSendRate' - The maximum number of emails that you can send per second in the current
-- AWS Region. This value is also called your /maximum sending rate/ or
-- your /maximum TPS (transactions per second) rate/.
--
-- 'sentLast24Hours', 'sendQuota_sentLast24Hours' - The number of emails sent from your Amazon Pinpoint account in the
-- current AWS Region over the past 24 hours.
--
-- 'max24HourSend', 'sendQuota_max24HourSend' - The maximum number of emails that you can send in the current AWS Region
-- over a 24-hour period. This value is also called your /sending quota/.
newSendQuota ::
  SendQuota
newSendQuota :: SendQuota
newSendQuota =
  SendQuota' :: Maybe Double -> Maybe Double -> Maybe Double -> SendQuota
SendQuota'
    { $sel:maxSendRate:SendQuota' :: Maybe Double
maxSendRate = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:sentLast24Hours:SendQuota' :: Maybe Double
sentLast24Hours = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:max24HourSend:SendQuota' :: Maybe Double
max24HourSend = Maybe Double
forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum number of emails that you can send per second in the current
-- AWS Region. This value is also called your /maximum sending rate/ or
-- your /maximum TPS (transactions per second) rate/.
sendQuota_maxSendRate :: Lens.Lens' SendQuota (Prelude.Maybe Prelude.Double)
sendQuota_maxSendRate :: (Maybe Double -> f (Maybe Double)) -> SendQuota -> f SendQuota
sendQuota_maxSendRate = (SendQuota -> Maybe Double)
-> (SendQuota -> Maybe Double -> SendQuota)
-> Lens SendQuota SendQuota (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendQuota' {Maybe Double
maxSendRate :: Maybe Double
$sel:maxSendRate:SendQuota' :: SendQuota -> Maybe Double
maxSendRate} -> Maybe Double
maxSendRate) (\s :: SendQuota
s@SendQuota' {} Maybe Double
a -> SendQuota
s {$sel:maxSendRate:SendQuota' :: Maybe Double
maxSendRate = Maybe Double
a} :: SendQuota)

-- | The number of emails sent from your Amazon Pinpoint account in the
-- current AWS Region over the past 24 hours.
sendQuota_sentLast24Hours :: Lens.Lens' SendQuota (Prelude.Maybe Prelude.Double)
sendQuota_sentLast24Hours :: (Maybe Double -> f (Maybe Double)) -> SendQuota -> f SendQuota
sendQuota_sentLast24Hours = (SendQuota -> Maybe Double)
-> (SendQuota -> Maybe Double -> SendQuota)
-> Lens SendQuota SendQuota (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendQuota' {Maybe Double
sentLast24Hours :: Maybe Double
$sel:sentLast24Hours:SendQuota' :: SendQuota -> Maybe Double
sentLast24Hours} -> Maybe Double
sentLast24Hours) (\s :: SendQuota
s@SendQuota' {} Maybe Double
a -> SendQuota
s {$sel:sentLast24Hours:SendQuota' :: Maybe Double
sentLast24Hours = Maybe Double
a} :: SendQuota)

-- | The maximum number of emails that you can send in the current AWS Region
-- over a 24-hour period. This value is also called your /sending quota/.
sendQuota_max24HourSend :: Lens.Lens' SendQuota (Prelude.Maybe Prelude.Double)
sendQuota_max24HourSend :: (Maybe Double -> f (Maybe Double)) -> SendQuota -> f SendQuota
sendQuota_max24HourSend = (SendQuota -> Maybe Double)
-> (SendQuota -> Maybe Double -> SendQuota)
-> Lens SendQuota SendQuota (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendQuota' {Maybe Double
max24HourSend :: Maybe Double
$sel:max24HourSend:SendQuota' :: SendQuota -> Maybe Double
max24HourSend} -> Maybe Double
max24HourSend) (\s :: SendQuota
s@SendQuota' {} Maybe Double
a -> SendQuota
s {$sel:max24HourSend:SendQuota' :: Maybe Double
max24HourSend = Maybe Double
a} :: SendQuota)

instance Core.FromJSON SendQuota where
  parseJSON :: Value -> Parser SendQuota
parseJSON =
    String -> (Object -> Parser SendQuota) -> Value -> Parser SendQuota
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SendQuota"
      ( \Object
x ->
          Maybe Double -> Maybe Double -> Maybe Double -> SendQuota
SendQuota'
            (Maybe Double -> Maybe Double -> Maybe Double -> SendQuota)
-> Parser (Maybe Double)
-> Parser (Maybe Double -> Maybe Double -> SendQuota)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MaxSendRate")
            Parser (Maybe Double -> Maybe Double -> SendQuota)
-> Parser (Maybe Double) -> Parser (Maybe Double -> SendQuota)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SentLast24Hours")
            Parser (Maybe Double -> SendQuota)
-> Parser (Maybe Double) -> Parser SendQuota
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Max24HourSend")
      )

instance Prelude.Hashable SendQuota

instance Prelude.NFData SendQuota