{-# 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.GetAccountSendingEnabled
-- 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)
--
-- Returns the email sending status of the Amazon SES account for the
-- current region.
--
-- You can execute this operation no more than once per second.
module Amazonka.SES.GetAccountSendingEnabled
  ( -- * Creating a Request
    GetAccountSendingEnabled (..),
    newGetAccountSendingEnabled,

    -- * Destructuring the Response
    GetAccountSendingEnabledResponse (..),
    newGetAccountSendingEnabledResponse,

    -- * Response Lenses
    getAccountSendingEnabledResponse_enabled,
    getAccountSendingEnabledResponse_httpStatus,
  )
where

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

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

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

instance Core.AWSRequest GetAccountSendingEnabled where
  type
    AWSResponse GetAccountSendingEnabled =
      GetAccountSendingEnabledResponse
  request :: GetAccountSendingEnabled -> Request GetAccountSendingEnabled
request = Service
-> GetAccountSendingEnabled -> Request GetAccountSendingEnabled
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy GetAccountSendingEnabled
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetAccountSendingEnabled)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse GetAccountSendingEnabled))
-> Logger
-> Service
-> Proxy GetAccountSendingEnabled
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetAccountSendingEnabled)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"GetAccountSendingEnabledResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Bool -> Int -> GetAccountSendingEnabledResponse
GetAccountSendingEnabledResponse'
            (Maybe Bool -> Int -> GetAccountSendingEnabledResponse)
-> Either String (Maybe Bool)
-> Either String (Int -> GetAccountSendingEnabledResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Enabled")
            Either String (Int -> GetAccountSendingEnabledResponse)
-> Either String Int
-> Either String GetAccountSendingEnabledResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
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 GetAccountSendingEnabled

instance Prelude.NFData GetAccountSendingEnabled

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

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

instance Core.ToQuery GetAccountSendingEnabled where
  toQuery :: GetAccountSendingEnabled -> QueryString
toQuery =
    QueryString -> GetAccountSendingEnabled -> 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
Core.=: (ByteString
"GetAccountSendingEnabled" :: Prelude.ByteString),
            ByteString
"Version"
              ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString)
          ]
      )

-- | Represents a request to return the email sending status for your Amazon
-- SES account in the current AWS Region.
--
-- /See:/ 'newGetAccountSendingEnabledResponse' smart constructor.
data GetAccountSendingEnabledResponse = GetAccountSendingEnabledResponse'
  { -- | Describes whether email sending is enabled or disabled for your Amazon
    -- SES account in the current AWS Region.
    GetAccountSendingEnabledResponse -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | The response's http status code.
    GetAccountSendingEnabledResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetAccountSendingEnabledResponse
-> GetAccountSendingEnabledResponse -> Bool
(GetAccountSendingEnabledResponse
 -> GetAccountSendingEnabledResponse -> Bool)
-> (GetAccountSendingEnabledResponse
    -> GetAccountSendingEnabledResponse -> Bool)
-> Eq GetAccountSendingEnabledResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAccountSendingEnabledResponse
-> GetAccountSendingEnabledResponse -> Bool
$c/= :: GetAccountSendingEnabledResponse
-> GetAccountSendingEnabledResponse -> Bool
== :: GetAccountSendingEnabledResponse
-> GetAccountSendingEnabledResponse -> Bool
$c== :: GetAccountSendingEnabledResponse
-> GetAccountSendingEnabledResponse -> Bool
Prelude.Eq, ReadPrec [GetAccountSendingEnabledResponse]
ReadPrec GetAccountSendingEnabledResponse
Int -> ReadS GetAccountSendingEnabledResponse
ReadS [GetAccountSendingEnabledResponse]
(Int -> ReadS GetAccountSendingEnabledResponse)
-> ReadS [GetAccountSendingEnabledResponse]
-> ReadPrec GetAccountSendingEnabledResponse
-> ReadPrec [GetAccountSendingEnabledResponse]
-> Read GetAccountSendingEnabledResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAccountSendingEnabledResponse]
$creadListPrec :: ReadPrec [GetAccountSendingEnabledResponse]
readPrec :: ReadPrec GetAccountSendingEnabledResponse
$creadPrec :: ReadPrec GetAccountSendingEnabledResponse
readList :: ReadS [GetAccountSendingEnabledResponse]
$creadList :: ReadS [GetAccountSendingEnabledResponse]
readsPrec :: Int -> ReadS GetAccountSendingEnabledResponse
$creadsPrec :: Int -> ReadS GetAccountSendingEnabledResponse
Prelude.Read, Int -> GetAccountSendingEnabledResponse -> ShowS
[GetAccountSendingEnabledResponse] -> ShowS
GetAccountSendingEnabledResponse -> String
(Int -> GetAccountSendingEnabledResponse -> ShowS)
-> (GetAccountSendingEnabledResponse -> String)
-> ([GetAccountSendingEnabledResponse] -> ShowS)
-> Show GetAccountSendingEnabledResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAccountSendingEnabledResponse] -> ShowS
$cshowList :: [GetAccountSendingEnabledResponse] -> ShowS
show :: GetAccountSendingEnabledResponse -> String
$cshow :: GetAccountSendingEnabledResponse -> String
showsPrec :: Int -> GetAccountSendingEnabledResponse -> ShowS
$cshowsPrec :: Int -> GetAccountSendingEnabledResponse -> ShowS
Prelude.Show, (forall x.
 GetAccountSendingEnabledResponse
 -> Rep GetAccountSendingEnabledResponse x)
-> (forall x.
    Rep GetAccountSendingEnabledResponse x
    -> GetAccountSendingEnabledResponse)
-> Generic GetAccountSendingEnabledResponse
forall x.
Rep GetAccountSendingEnabledResponse x
-> GetAccountSendingEnabledResponse
forall x.
GetAccountSendingEnabledResponse
-> Rep GetAccountSendingEnabledResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetAccountSendingEnabledResponse x
-> GetAccountSendingEnabledResponse
$cfrom :: forall x.
GetAccountSendingEnabledResponse
-> Rep GetAccountSendingEnabledResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetAccountSendingEnabledResponse' 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:
--
-- 'enabled', 'getAccountSendingEnabledResponse_enabled' - Describes whether email sending is enabled or disabled for your Amazon
-- SES account in the current AWS Region.
--
-- 'httpStatus', 'getAccountSendingEnabledResponse_httpStatus' - The response's http status code.
newGetAccountSendingEnabledResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetAccountSendingEnabledResponse
newGetAccountSendingEnabledResponse :: Int -> GetAccountSendingEnabledResponse
newGetAccountSendingEnabledResponse Int
pHttpStatus_ =
  GetAccountSendingEnabledResponse' :: Maybe Bool -> Int -> GetAccountSendingEnabledResponse
GetAccountSendingEnabledResponse'
    { $sel:enabled:GetAccountSendingEnabledResponse' :: Maybe Bool
enabled =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetAccountSendingEnabledResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Describes whether email sending is enabled or disabled for your Amazon
-- SES account in the current AWS Region.
getAccountSendingEnabledResponse_enabled :: Lens.Lens' GetAccountSendingEnabledResponse (Prelude.Maybe Prelude.Bool)
getAccountSendingEnabledResponse_enabled :: (Maybe Bool -> f (Maybe Bool))
-> GetAccountSendingEnabledResponse
-> f GetAccountSendingEnabledResponse
getAccountSendingEnabledResponse_enabled = (GetAccountSendingEnabledResponse -> Maybe Bool)
-> (GetAccountSendingEnabledResponse
    -> Maybe Bool -> GetAccountSendingEnabledResponse)
-> Lens
     GetAccountSendingEnabledResponse
     GetAccountSendingEnabledResponse
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAccountSendingEnabledResponse' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:GetAccountSendingEnabledResponse' :: GetAccountSendingEnabledResponse -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: GetAccountSendingEnabledResponse
s@GetAccountSendingEnabledResponse' {} Maybe Bool
a -> GetAccountSendingEnabledResponse
s {$sel:enabled:GetAccountSendingEnabledResponse' :: Maybe Bool
enabled = Maybe Bool
a} :: GetAccountSendingEnabledResponse)

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

instance
  Prelude.NFData
    GetAccountSendingEnabledResponse