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

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

-- |
-- Module      : Amazonka.SES.GetSendQuota
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Provides the sending limits for the Amazon SES account.
--
-- You can execute this operation no more than once per second.
module Amazonka.SES.GetSendQuota
  ( -- * Creating a Request
    GetSendQuota (..),
    newGetSendQuota,

    -- * Destructuring the Response
    GetSendQuotaResponse (..),
    newGetSendQuotaResponse,

    -- * Response Lenses
    getSendQuotaResponse_max24HourSend,
    getSendQuotaResponse_maxSendRate,
    getSendQuotaResponse_sentLast24Hours,
    getSendQuotaResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SES.Types

-- | /See:/ 'newGetSendQuota' smart constructor.
data GetSendQuota = GetSendQuota'
  {
  }
  deriving (GetSendQuota -> GetSendQuota -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSendQuota -> GetSendQuota -> Bool
$c/= :: GetSendQuota -> GetSendQuota -> Bool
== :: GetSendQuota -> GetSendQuota -> Bool
$c== :: GetSendQuota -> GetSendQuota -> Bool
Prelude.Eq, ReadPrec [GetSendQuota]
ReadPrec GetSendQuota
Int -> ReadS GetSendQuota
ReadS [GetSendQuota]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSendQuota]
$creadListPrec :: ReadPrec [GetSendQuota]
readPrec :: ReadPrec GetSendQuota
$creadPrec :: ReadPrec GetSendQuota
readList :: ReadS [GetSendQuota]
$creadList :: ReadS [GetSendQuota]
readsPrec :: Int -> ReadS GetSendQuota
$creadsPrec :: Int -> ReadS GetSendQuota
Prelude.Read, Int -> GetSendQuota -> ShowS
[GetSendQuota] -> ShowS
GetSendQuota -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSendQuota] -> ShowS
$cshowList :: [GetSendQuota] -> ShowS
show :: GetSendQuota -> String
$cshow :: GetSendQuota -> String
showsPrec :: Int -> GetSendQuota -> ShowS
$cshowsPrec :: Int -> GetSendQuota -> ShowS
Prelude.Show, forall x. Rep GetSendQuota x -> GetSendQuota
forall x. GetSendQuota -> Rep GetSendQuota x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSendQuota x -> GetSendQuota
$cfrom :: forall x. GetSendQuota -> Rep GetSendQuota x
Prelude.Generic)

-- |
-- Create a value of 'GetSendQuota' 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.
newGetSendQuota ::
  GetSendQuota
newGetSendQuota :: GetSendQuota
newGetSendQuota = GetSendQuota
GetSendQuota'

instance Core.AWSRequest GetSendQuota where
  type AWSResponse GetSendQuota = GetSendQuotaResponse
  request :: (Service -> Service) -> GetSendQuota -> Request GetSendQuota
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetSendQuota
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetSendQuota)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"GetSendQuotaResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Double
-> Maybe Double -> Maybe Double -> Int -> GetSendQuotaResponse
GetSendQuotaResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Max24HourSend")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"MaxSendRate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"SentLast24Hours")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetSendQuota where
  hashWithSalt :: Int -> GetSendQuota -> Int
hashWithSalt Int
_salt GetSendQuota
_ =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ()

instance Prelude.NFData GetSendQuota where
  rnf :: GetSendQuota -> ()
rnf GetSendQuota
_ = ()

instance Data.ToHeaders GetSendQuota where
  toHeaders :: GetSendQuota -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath GetSendQuota where
  toPath :: GetSendQuota -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery GetSendQuota where
  toQuery :: GetSendQuota -> QueryString
toQuery =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ ByteString
"Action"
              forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"GetSendQuota" :: Prelude.ByteString),
            ByteString
"Version"
              forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-12-01" :: Prelude.ByteString)
          ]
      )

-- | Represents your Amazon SES daily sending quota, maximum send rate, and
-- the number of emails you have sent in the last 24 hours.
--
-- /See:/ 'newGetSendQuotaResponse' smart constructor.
data GetSendQuotaResponse = GetSendQuotaResponse'
  { -- | The maximum number of emails the user is allowed to send in a 24-hour
    -- interval. A value of -1 signifies an unlimited quota.
    GetSendQuotaResponse -> Maybe Double
max24HourSend :: Prelude.Maybe Prelude.Double,
    -- | The maximum number of emails that Amazon SES can accept from the user\'s
    -- account per second.
    --
    -- The rate at which Amazon SES accepts the user\'s messages might be less
    -- than the maximum send rate.
    GetSendQuotaResponse -> Maybe Double
maxSendRate :: Prelude.Maybe Prelude.Double,
    -- | The number of emails sent during the previous 24 hours.
    GetSendQuotaResponse -> Maybe Double
sentLast24Hours :: Prelude.Maybe Prelude.Double,
    -- | The response's http status code.
    GetSendQuotaResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetSendQuotaResponse -> GetSendQuotaResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSendQuotaResponse -> GetSendQuotaResponse -> Bool
$c/= :: GetSendQuotaResponse -> GetSendQuotaResponse -> Bool
== :: GetSendQuotaResponse -> GetSendQuotaResponse -> Bool
$c== :: GetSendQuotaResponse -> GetSendQuotaResponse -> Bool
Prelude.Eq, ReadPrec [GetSendQuotaResponse]
ReadPrec GetSendQuotaResponse
Int -> ReadS GetSendQuotaResponse
ReadS [GetSendQuotaResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSendQuotaResponse]
$creadListPrec :: ReadPrec [GetSendQuotaResponse]
readPrec :: ReadPrec GetSendQuotaResponse
$creadPrec :: ReadPrec GetSendQuotaResponse
readList :: ReadS [GetSendQuotaResponse]
$creadList :: ReadS [GetSendQuotaResponse]
readsPrec :: Int -> ReadS GetSendQuotaResponse
$creadsPrec :: Int -> ReadS GetSendQuotaResponse
Prelude.Read, Int -> GetSendQuotaResponse -> ShowS
[GetSendQuotaResponse] -> ShowS
GetSendQuotaResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSendQuotaResponse] -> ShowS
$cshowList :: [GetSendQuotaResponse] -> ShowS
show :: GetSendQuotaResponse -> String
$cshow :: GetSendQuotaResponse -> String
showsPrec :: Int -> GetSendQuotaResponse -> ShowS
$cshowsPrec :: Int -> GetSendQuotaResponse -> ShowS
Prelude.Show, forall x. Rep GetSendQuotaResponse x -> GetSendQuotaResponse
forall x. GetSendQuotaResponse -> Rep GetSendQuotaResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSendQuotaResponse x -> GetSendQuotaResponse
$cfrom :: forall x. GetSendQuotaResponse -> Rep GetSendQuotaResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetSendQuotaResponse' 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:
--
-- 'max24HourSend', 'getSendQuotaResponse_max24HourSend' - The maximum number of emails the user is allowed to send in a 24-hour
-- interval. A value of -1 signifies an unlimited quota.
--
-- 'maxSendRate', 'getSendQuotaResponse_maxSendRate' - The maximum number of emails that Amazon SES can accept from the user\'s
-- account per second.
--
-- The rate at which Amazon SES accepts the user\'s messages might be less
-- than the maximum send rate.
--
-- 'sentLast24Hours', 'getSendQuotaResponse_sentLast24Hours' - The number of emails sent during the previous 24 hours.
--
-- 'httpStatus', 'getSendQuotaResponse_httpStatus' - The response's http status code.
newGetSendQuotaResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetSendQuotaResponse
newGetSendQuotaResponse :: Int -> GetSendQuotaResponse
newGetSendQuotaResponse Int
pHttpStatus_ =
  GetSendQuotaResponse'
    { $sel:max24HourSend:GetSendQuotaResponse' :: Maybe Double
max24HourSend =
        forall a. Maybe a
Prelude.Nothing,
      $sel:maxSendRate:GetSendQuotaResponse' :: Maybe Double
maxSendRate = forall a. Maybe a
Prelude.Nothing,
      $sel:sentLast24Hours:GetSendQuotaResponse' :: Maybe Double
sentLast24Hours = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetSendQuotaResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The maximum number of emails the user is allowed to send in a 24-hour
-- interval. A value of -1 signifies an unlimited quota.
getSendQuotaResponse_max24HourSend :: Lens.Lens' GetSendQuotaResponse (Prelude.Maybe Prelude.Double)
getSendQuotaResponse_max24HourSend :: Lens' GetSendQuotaResponse (Maybe Double)
getSendQuotaResponse_max24HourSend = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSendQuotaResponse' {Maybe Double
max24HourSend :: Maybe Double
$sel:max24HourSend:GetSendQuotaResponse' :: GetSendQuotaResponse -> Maybe Double
max24HourSend} -> Maybe Double
max24HourSend) (\s :: GetSendQuotaResponse
s@GetSendQuotaResponse' {} Maybe Double
a -> GetSendQuotaResponse
s {$sel:max24HourSend:GetSendQuotaResponse' :: Maybe Double
max24HourSend = Maybe Double
a} :: GetSendQuotaResponse)

-- | The maximum number of emails that Amazon SES can accept from the user\'s
-- account per second.
--
-- The rate at which Amazon SES accepts the user\'s messages might be less
-- than the maximum send rate.
getSendQuotaResponse_maxSendRate :: Lens.Lens' GetSendQuotaResponse (Prelude.Maybe Prelude.Double)
getSendQuotaResponse_maxSendRate :: Lens' GetSendQuotaResponse (Maybe Double)
getSendQuotaResponse_maxSendRate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSendQuotaResponse' {Maybe Double
maxSendRate :: Maybe Double
$sel:maxSendRate:GetSendQuotaResponse' :: GetSendQuotaResponse -> Maybe Double
maxSendRate} -> Maybe Double
maxSendRate) (\s :: GetSendQuotaResponse
s@GetSendQuotaResponse' {} Maybe Double
a -> GetSendQuotaResponse
s {$sel:maxSendRate:GetSendQuotaResponse' :: Maybe Double
maxSendRate = Maybe Double
a} :: GetSendQuotaResponse)

-- | The number of emails sent during the previous 24 hours.
getSendQuotaResponse_sentLast24Hours :: Lens.Lens' GetSendQuotaResponse (Prelude.Maybe Prelude.Double)
getSendQuotaResponse_sentLast24Hours :: Lens' GetSendQuotaResponse (Maybe Double)
getSendQuotaResponse_sentLast24Hours = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSendQuotaResponse' {Maybe Double
sentLast24Hours :: Maybe Double
$sel:sentLast24Hours:GetSendQuotaResponse' :: GetSendQuotaResponse -> Maybe Double
sentLast24Hours} -> Maybe Double
sentLast24Hours) (\s :: GetSendQuotaResponse
s@GetSendQuotaResponse' {} Maybe Double
a -> GetSendQuotaResponse
s {$sel:sentLast24Hours:GetSendQuotaResponse' :: Maybe Double
sentLast24Hours = Maybe Double
a} :: GetSendQuotaResponse)

-- | The response's http status code.
getSendQuotaResponse_httpStatus :: Lens.Lens' GetSendQuotaResponse Prelude.Int
getSendQuotaResponse_httpStatus :: Lens' GetSendQuotaResponse Int
getSendQuotaResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSendQuotaResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetSendQuotaResponse' :: GetSendQuotaResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetSendQuotaResponse
s@GetSendQuotaResponse' {} Int
a -> GetSendQuotaResponse
s {$sel:httpStatus:GetSendQuotaResponse' :: Int
httpStatus = Int
a} :: GetSendQuotaResponse)

instance Prelude.NFData GetSendQuotaResponse where
  rnf :: GetSendQuotaResponse -> ()
rnf GetSendQuotaResponse' {Int
Maybe Double
httpStatus :: Int
sentLast24Hours :: Maybe Double
maxSendRate :: Maybe Double
max24HourSend :: Maybe Double
$sel:httpStatus:GetSendQuotaResponse' :: GetSendQuotaResponse -> Int
$sel:sentLast24Hours:GetSendQuotaResponse' :: GetSendQuotaResponse -> Maybe Double
$sel:maxSendRate:GetSendQuotaResponse' :: GetSendQuotaResponse -> Maybe Double
$sel:max24HourSend:GetSendQuotaResponse' :: GetSendQuotaResponse -> Maybe Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
max24HourSend
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
maxSendRate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
sentLast24Hours
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus