{-# 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.SESV2.PutAccountSendingAttributes
-- 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)
--
-- Enable or disable the ability of your account to send email.
module Amazonka.SESV2.PutAccountSendingAttributes
  ( -- * Creating a Request
    PutAccountSendingAttributes (..),
    newPutAccountSendingAttributes,

    -- * Request Lenses
    putAccountSendingAttributes_sendingEnabled,

    -- * Destructuring the Response
    PutAccountSendingAttributesResponse (..),
    newPutAccountSendingAttributesResponse,

    -- * Response Lenses
    putAccountSendingAttributesResponse_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.SESV2.Types

-- | A request to change the ability of your account to send email.
--
-- /See:/ 'newPutAccountSendingAttributes' smart constructor.
data PutAccountSendingAttributes = PutAccountSendingAttributes'
  { -- | Enables or disables your account\'s ability to send email. Set to @true@
    -- to enable email sending, or set to @false@ to disable email sending.
    --
    -- If Amazon Web Services paused your account\'s ability to send email, you
    -- can\'t use this operation to resume your account\'s ability to send
    -- email.
    PutAccountSendingAttributes -> Maybe Bool
sendingEnabled :: Prelude.Maybe Prelude.Bool
  }
  deriving (PutAccountSendingAttributes -> PutAccountSendingAttributes -> Bool
(PutAccountSendingAttributes
 -> PutAccountSendingAttributes -> Bool)
-> (PutAccountSendingAttributes
    -> PutAccountSendingAttributes -> Bool)
-> Eq PutAccountSendingAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutAccountSendingAttributes -> PutAccountSendingAttributes -> Bool
$c/= :: PutAccountSendingAttributes -> PutAccountSendingAttributes -> Bool
== :: PutAccountSendingAttributes -> PutAccountSendingAttributes -> Bool
$c== :: PutAccountSendingAttributes -> PutAccountSendingAttributes -> Bool
Prelude.Eq, ReadPrec [PutAccountSendingAttributes]
ReadPrec PutAccountSendingAttributes
Int -> ReadS PutAccountSendingAttributes
ReadS [PutAccountSendingAttributes]
(Int -> ReadS PutAccountSendingAttributes)
-> ReadS [PutAccountSendingAttributes]
-> ReadPrec PutAccountSendingAttributes
-> ReadPrec [PutAccountSendingAttributes]
-> Read PutAccountSendingAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutAccountSendingAttributes]
$creadListPrec :: ReadPrec [PutAccountSendingAttributes]
readPrec :: ReadPrec PutAccountSendingAttributes
$creadPrec :: ReadPrec PutAccountSendingAttributes
readList :: ReadS [PutAccountSendingAttributes]
$creadList :: ReadS [PutAccountSendingAttributes]
readsPrec :: Int -> ReadS PutAccountSendingAttributes
$creadsPrec :: Int -> ReadS PutAccountSendingAttributes
Prelude.Read, Int -> PutAccountSendingAttributes -> ShowS
[PutAccountSendingAttributes] -> ShowS
PutAccountSendingAttributes -> String
(Int -> PutAccountSendingAttributes -> ShowS)
-> (PutAccountSendingAttributes -> String)
-> ([PutAccountSendingAttributes] -> ShowS)
-> Show PutAccountSendingAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutAccountSendingAttributes] -> ShowS
$cshowList :: [PutAccountSendingAttributes] -> ShowS
show :: PutAccountSendingAttributes -> String
$cshow :: PutAccountSendingAttributes -> String
showsPrec :: Int -> PutAccountSendingAttributes -> ShowS
$cshowsPrec :: Int -> PutAccountSendingAttributes -> ShowS
Prelude.Show, (forall x.
 PutAccountSendingAttributes -> Rep PutAccountSendingAttributes x)
-> (forall x.
    Rep PutAccountSendingAttributes x -> PutAccountSendingAttributes)
-> Generic PutAccountSendingAttributes
forall x.
Rep PutAccountSendingAttributes x -> PutAccountSendingAttributes
forall x.
PutAccountSendingAttributes -> Rep PutAccountSendingAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutAccountSendingAttributes x -> PutAccountSendingAttributes
$cfrom :: forall x.
PutAccountSendingAttributes -> Rep PutAccountSendingAttributes x
Prelude.Generic)

-- |
-- Create a value of 'PutAccountSendingAttributes' 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:
--
-- 'sendingEnabled', 'putAccountSendingAttributes_sendingEnabled' - Enables or disables your account\'s ability to send email. Set to @true@
-- to enable email sending, or set to @false@ to disable email sending.
--
-- If Amazon Web Services paused your account\'s ability to send email, you
-- can\'t use this operation to resume your account\'s ability to send
-- email.
newPutAccountSendingAttributes ::
  PutAccountSendingAttributes
newPutAccountSendingAttributes :: PutAccountSendingAttributes
newPutAccountSendingAttributes =
  PutAccountSendingAttributes' :: Maybe Bool -> PutAccountSendingAttributes
PutAccountSendingAttributes'
    { $sel:sendingEnabled:PutAccountSendingAttributes' :: Maybe Bool
sendingEnabled =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | Enables or disables your account\'s ability to send email. Set to @true@
-- to enable email sending, or set to @false@ to disable email sending.
--
-- If Amazon Web Services paused your account\'s ability to send email, you
-- can\'t use this operation to resume your account\'s ability to send
-- email.
putAccountSendingAttributes_sendingEnabled :: Lens.Lens' PutAccountSendingAttributes (Prelude.Maybe Prelude.Bool)
putAccountSendingAttributes_sendingEnabled :: (Maybe Bool -> f (Maybe Bool))
-> PutAccountSendingAttributes -> f PutAccountSendingAttributes
putAccountSendingAttributes_sendingEnabled = (PutAccountSendingAttributes -> Maybe Bool)
-> (PutAccountSendingAttributes
    -> Maybe Bool -> PutAccountSendingAttributes)
-> Lens
     PutAccountSendingAttributes
     PutAccountSendingAttributes
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAccountSendingAttributes' {Maybe Bool
sendingEnabled :: Maybe Bool
$sel:sendingEnabled:PutAccountSendingAttributes' :: PutAccountSendingAttributes -> Maybe Bool
sendingEnabled} -> Maybe Bool
sendingEnabled) (\s :: PutAccountSendingAttributes
s@PutAccountSendingAttributes' {} Maybe Bool
a -> PutAccountSendingAttributes
s {$sel:sendingEnabled:PutAccountSendingAttributes' :: Maybe Bool
sendingEnabled = Maybe Bool
a} :: PutAccountSendingAttributes)

instance Core.AWSRequest PutAccountSendingAttributes where
  type
    AWSResponse PutAccountSendingAttributes =
      PutAccountSendingAttributesResponse
  request :: PutAccountSendingAttributes -> Request PutAccountSendingAttributes
request = Service
-> PutAccountSendingAttributes
-> Request PutAccountSendingAttributes
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy PutAccountSendingAttributes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutAccountSendingAttributes)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse PutAccountSendingAttributes))
-> Logger
-> Service
-> Proxy PutAccountSendingAttributes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutAccountSendingAttributes)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> PutAccountSendingAttributesResponse
PutAccountSendingAttributesResponse'
            (Int -> PutAccountSendingAttributesResponse)
-> Either String Int
-> Either String PutAccountSendingAttributesResponse
forall (f :: * -> *) a b. Functor 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 PutAccountSendingAttributes

instance Prelude.NFData PutAccountSendingAttributes

instance Core.ToHeaders PutAccountSendingAttributes where
  toHeaders :: PutAccountSendingAttributes -> ResponseHeaders
toHeaders =
    ResponseHeaders -> PutAccountSendingAttributes -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON PutAccountSendingAttributes where
  toJSON :: PutAccountSendingAttributes -> Value
toJSON PutAccountSendingAttributes' {Maybe Bool
sendingEnabled :: Maybe Bool
$sel:sendingEnabled:PutAccountSendingAttributes' :: PutAccountSendingAttributes -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SendingEnabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
sendingEnabled
          ]
      )

instance Core.ToPath PutAccountSendingAttributes where
  toPath :: PutAccountSendingAttributes -> ByteString
toPath = ByteString -> PutAccountSendingAttributes -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v2/email/account/sending"

instance Core.ToQuery PutAccountSendingAttributes where
  toQuery :: PutAccountSendingAttributes -> QueryString
toQuery = QueryString -> PutAccountSendingAttributes -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | An HTTP 200 response if the request succeeds, or an error message if the
-- request fails.
--
-- /See:/ 'newPutAccountSendingAttributesResponse' smart constructor.
data PutAccountSendingAttributesResponse = PutAccountSendingAttributesResponse'
  { -- | The response's http status code.
    PutAccountSendingAttributesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (PutAccountSendingAttributesResponse
-> PutAccountSendingAttributesResponse -> Bool
(PutAccountSendingAttributesResponse
 -> PutAccountSendingAttributesResponse -> Bool)
-> (PutAccountSendingAttributesResponse
    -> PutAccountSendingAttributesResponse -> Bool)
-> Eq PutAccountSendingAttributesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutAccountSendingAttributesResponse
-> PutAccountSendingAttributesResponse -> Bool
$c/= :: PutAccountSendingAttributesResponse
-> PutAccountSendingAttributesResponse -> Bool
== :: PutAccountSendingAttributesResponse
-> PutAccountSendingAttributesResponse -> Bool
$c== :: PutAccountSendingAttributesResponse
-> PutAccountSendingAttributesResponse -> Bool
Prelude.Eq, ReadPrec [PutAccountSendingAttributesResponse]
ReadPrec PutAccountSendingAttributesResponse
Int -> ReadS PutAccountSendingAttributesResponse
ReadS [PutAccountSendingAttributesResponse]
(Int -> ReadS PutAccountSendingAttributesResponse)
-> ReadS [PutAccountSendingAttributesResponse]
-> ReadPrec PutAccountSendingAttributesResponse
-> ReadPrec [PutAccountSendingAttributesResponse]
-> Read PutAccountSendingAttributesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutAccountSendingAttributesResponse]
$creadListPrec :: ReadPrec [PutAccountSendingAttributesResponse]
readPrec :: ReadPrec PutAccountSendingAttributesResponse
$creadPrec :: ReadPrec PutAccountSendingAttributesResponse
readList :: ReadS [PutAccountSendingAttributesResponse]
$creadList :: ReadS [PutAccountSendingAttributesResponse]
readsPrec :: Int -> ReadS PutAccountSendingAttributesResponse
$creadsPrec :: Int -> ReadS PutAccountSendingAttributesResponse
Prelude.Read, Int -> PutAccountSendingAttributesResponse -> ShowS
[PutAccountSendingAttributesResponse] -> ShowS
PutAccountSendingAttributesResponse -> String
(Int -> PutAccountSendingAttributesResponse -> ShowS)
-> (PutAccountSendingAttributesResponse -> String)
-> ([PutAccountSendingAttributesResponse] -> ShowS)
-> Show PutAccountSendingAttributesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutAccountSendingAttributesResponse] -> ShowS
$cshowList :: [PutAccountSendingAttributesResponse] -> ShowS
show :: PutAccountSendingAttributesResponse -> String
$cshow :: PutAccountSendingAttributesResponse -> String
showsPrec :: Int -> PutAccountSendingAttributesResponse -> ShowS
$cshowsPrec :: Int -> PutAccountSendingAttributesResponse -> ShowS
Prelude.Show, (forall x.
 PutAccountSendingAttributesResponse
 -> Rep PutAccountSendingAttributesResponse x)
-> (forall x.
    Rep PutAccountSendingAttributesResponse x
    -> PutAccountSendingAttributesResponse)
-> Generic PutAccountSendingAttributesResponse
forall x.
Rep PutAccountSendingAttributesResponse x
-> PutAccountSendingAttributesResponse
forall x.
PutAccountSendingAttributesResponse
-> Rep PutAccountSendingAttributesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutAccountSendingAttributesResponse x
-> PutAccountSendingAttributesResponse
$cfrom :: forall x.
PutAccountSendingAttributesResponse
-> Rep PutAccountSendingAttributesResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutAccountSendingAttributesResponse' 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:
--
-- 'httpStatus', 'putAccountSendingAttributesResponse_httpStatus' - The response's http status code.
newPutAccountSendingAttributesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PutAccountSendingAttributesResponse
newPutAccountSendingAttributesResponse :: Int -> PutAccountSendingAttributesResponse
newPutAccountSendingAttributesResponse Int
pHttpStatus_ =
  PutAccountSendingAttributesResponse' :: Int -> PutAccountSendingAttributesResponse
PutAccountSendingAttributesResponse'
    { $sel:httpStatus:PutAccountSendingAttributesResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance
  Prelude.NFData
    PutAccountSendingAttributesResponse