{-# 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
(GetSendQuota -> GetSendQuota -> Bool)
-> (GetSendQuota -> GetSendQuota -> Bool) -> Eq GetSendQuota
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetSendQuota -> GetSendQuota -> Bool
== :: GetSendQuota -> GetSendQuota -> Bool
$c/= :: GetSendQuota -> GetSendQuota -> Bool
/= :: GetSendQuota -> GetSendQuota -> Bool
Prelude.Eq, ReadPrec [GetSendQuota]
ReadPrec GetSendQuota
Int -> ReadS GetSendQuota
ReadS [GetSendQuota]
(Int -> ReadS GetSendQuota)
-> ReadS [GetSendQuota]
-> ReadPrec GetSendQuota
-> ReadPrec [GetSendQuota]
-> Read GetSendQuota
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS GetSendQuota
readsPrec :: Int -> ReadS GetSendQuota
$creadList :: ReadS [GetSendQuota]
readList :: ReadS [GetSendQuota]
$creadPrec :: ReadPrec GetSendQuota
readPrec :: ReadPrec GetSendQuota
$creadListPrec :: ReadPrec [GetSendQuota]
readListPrec :: ReadPrec [GetSendQuota]
Prelude.Read, Int -> GetSendQuota -> ShowS
[GetSendQuota] -> ShowS
GetSendQuota -> String
(Int -> GetSendQuota -> ShowS)
-> (GetSendQuota -> String)
-> ([GetSendQuota] -> ShowS)
-> Show GetSendQuota
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetSendQuota -> ShowS
showsPrec :: Int -> GetSendQuota -> ShowS
$cshow :: GetSendQuota -> String
show :: GetSendQuota -> String
$cshowList :: [GetSendQuota] -> ShowS
showList :: [GetSendQuota] -> ShowS
Prelude.Show, (forall x. GetSendQuota -> Rep GetSendQuota x)
-> (forall x. Rep GetSendQuota x -> GetSendQuota)
-> Generic GetSendQuota
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
$cfrom :: forall x. GetSendQuota -> Rep GetSendQuota x
from :: forall x. GetSendQuota -> Rep GetSendQuota x
$cto :: forall x. Rep GetSendQuota x -> GetSendQuota
to :: forall x. Rep GetSendQuota x -> GetSendQuota
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 =
    Service -> GetSendQuota -> Request GetSendQuota
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 =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse GetSendQuota))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetSendQuota
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetSendQuota)))
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'
            (Maybe Double
 -> Maybe Double -> Maybe Double -> Int -> GetSendQuotaResponse)
-> Either String (Maybe Double)
-> Either
     String
     (Maybe Double -> Maybe Double -> Int -> GetSendQuotaResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Double)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Max24HourSend")
            Either
  String
  (Maybe Double -> Maybe Double -> Int -> GetSendQuotaResponse)
-> Either String (Maybe Double)
-> Either String (Maybe Double -> Int -> GetSendQuotaResponse)
forall a b.
Either String (a -> b) -> Either String a -> Either String b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Double)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"MaxSendRate")
            Either String (Maybe Double -> Int -> GetSendQuotaResponse)
-> Either String (Maybe Double)
-> Either String (Int -> GetSendQuotaResponse)
forall a b.
Either String (a -> b) -> Either String a -> Either String b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Double)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"SentLast24Hours")
            Either String (Int -> GetSendQuotaResponse)
-> Either String Int -> Either String GetSendQuotaResponse
forall a b.
Either String (a -> b) -> Either String a -> Either String b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall a. a -> Either String a
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
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 Int -> () -> Int
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 = ResponseHeaders -> GetSendQuota -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToQuery GetSendQuota where
  toQuery :: GetSendQuota -> QueryString
toQuery =
    QueryString -> GetSendQuota -> QueryString
forall a b. a -> b -> a
Prelude.const
      ( [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ ByteString
"Action"
              ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"GetSendQuota" :: Prelude.ByteString),
            ByteString
"Version"
              ByteString -> ByteString -> QueryString
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
(GetSendQuotaResponse -> GetSendQuotaResponse -> Bool)
-> (GetSendQuotaResponse -> GetSendQuotaResponse -> Bool)
-> Eq GetSendQuotaResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetSendQuotaResponse -> GetSendQuotaResponse -> Bool
== :: GetSendQuotaResponse -> GetSendQuotaResponse -> Bool
$c/= :: GetSendQuotaResponse -> GetSendQuotaResponse -> Bool
/= :: GetSendQuotaResponse -> GetSendQuotaResponse -> Bool
Prelude.Eq, ReadPrec [GetSendQuotaResponse]
ReadPrec GetSendQuotaResponse
Int -> ReadS GetSendQuotaResponse
ReadS [GetSendQuotaResponse]
(Int -> ReadS GetSendQuotaResponse)
-> ReadS [GetSendQuotaResponse]
-> ReadPrec GetSendQuotaResponse
-> ReadPrec [GetSendQuotaResponse]
-> Read GetSendQuotaResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS GetSendQuotaResponse
readsPrec :: Int -> ReadS GetSendQuotaResponse
$creadList :: ReadS [GetSendQuotaResponse]
readList :: ReadS [GetSendQuotaResponse]
$creadPrec :: ReadPrec GetSendQuotaResponse
readPrec :: ReadPrec GetSendQuotaResponse
$creadListPrec :: ReadPrec [GetSendQuotaResponse]
readListPrec :: ReadPrec [GetSendQuotaResponse]
Prelude.Read, Int -> GetSendQuotaResponse -> ShowS
[GetSendQuotaResponse] -> ShowS
GetSendQuotaResponse -> String
(Int -> GetSendQuotaResponse -> ShowS)
-> (GetSendQuotaResponse -> String)
-> ([GetSendQuotaResponse] -> ShowS)
-> Show GetSendQuotaResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetSendQuotaResponse -> ShowS
showsPrec :: Int -> GetSendQuotaResponse -> ShowS
$cshow :: GetSendQuotaResponse -> String
show :: GetSendQuotaResponse -> String
$cshowList :: [GetSendQuotaResponse] -> ShowS
showList :: [GetSendQuotaResponse] -> ShowS
Prelude.Show, (forall x. GetSendQuotaResponse -> Rep GetSendQuotaResponse x)
-> (forall x. Rep GetSendQuotaResponse x -> GetSendQuotaResponse)
-> Generic GetSendQuotaResponse
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
$cfrom :: forall x. GetSendQuotaResponse -> Rep GetSendQuotaResponse x
from :: forall x. GetSendQuotaResponse -> Rep GetSendQuotaResponse x
$cto :: forall x. Rep GetSendQuotaResponse x -> GetSendQuotaResponse
to :: forall x. Rep GetSendQuotaResponse x -> GetSendQuotaResponse
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 =
        Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:maxSendRate:GetSendQuotaResponse' :: Maybe Double
maxSendRate = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:sentLast24Hours:GetSendQuotaResponse' :: Maybe Double
sentLast24Hours = Maybe Double
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 = (GetSendQuotaResponse -> Maybe Double)
-> (GetSendQuotaResponse -> Maybe Double -> GetSendQuotaResponse)
-> Lens' GetSendQuotaResponse (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSendQuotaResponse' {Maybe Double
$sel:max24HourSend:GetSendQuotaResponse' :: GetSendQuotaResponse -> Maybe Double
max24HourSend :: Maybe Double
max24HourSend} -> Maybe Double
max24HourSend) (\s :: GetSendQuotaResponse
s@GetSendQuotaResponse' {} Maybe Double
a -> GetSendQuotaResponse
s {max24HourSend = 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 = (GetSendQuotaResponse -> Maybe Double)
-> (GetSendQuotaResponse -> Maybe Double -> GetSendQuotaResponse)
-> Lens' GetSendQuotaResponse (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSendQuotaResponse' {Maybe Double
$sel:maxSendRate:GetSendQuotaResponse' :: GetSendQuotaResponse -> Maybe Double
maxSendRate :: Maybe Double
maxSendRate} -> Maybe Double
maxSendRate) (\s :: GetSendQuotaResponse
s@GetSendQuotaResponse' {} Maybe Double
a -> GetSendQuotaResponse
s {maxSendRate = 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 = (GetSendQuotaResponse -> Maybe Double)
-> (GetSendQuotaResponse -> Maybe Double -> GetSendQuotaResponse)
-> Lens' GetSendQuotaResponse (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSendQuotaResponse' {Maybe Double
$sel:sentLast24Hours:GetSendQuotaResponse' :: GetSendQuotaResponse -> Maybe Double
sentLast24Hours :: Maybe Double
sentLast24Hours} -> Maybe Double
sentLast24Hours) (\s :: GetSendQuotaResponse
s@GetSendQuotaResponse' {} Maybe Double
a -> GetSendQuotaResponse
s {sentLast24Hours = a} :: GetSendQuotaResponse)

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

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