{-# 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.SetIdentityDkimEnabled
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Enables or disables Easy DKIM signing of email sent from an identity. If
-- Easy DKIM signing is enabled for a domain, then Amazon SES uses DKIM to
-- sign all email that it sends from addresses on that domain. If Easy DKIM
-- signing is enabled for an email address, then Amazon SES uses DKIM to
-- sign all email it sends from that address.
--
-- For email addresses (for example, @user\@example.com@), you can only
-- enable DKIM signing if the corresponding domain (in this case,
-- @example.com@) has been set up to use Easy DKIM.
--
-- You can enable DKIM signing for an identity at any time after you start
-- the verification process for the identity, even if the verification
-- process isn\'t complete.
--
-- You can execute this operation no more than once per second.
--
-- For more information about Easy DKIM signing, go to the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/easy-dkim.html Amazon SES Developer Guide>.
module Amazonka.SES.SetIdentityDkimEnabled
  ( -- * Creating a Request
    SetIdentityDkimEnabled (..),
    newSetIdentityDkimEnabled,

    -- * Request Lenses
    setIdentityDkimEnabled_identity,
    setIdentityDkimEnabled_dkimEnabled,

    -- * Destructuring the Response
    SetIdentityDkimEnabledResponse (..),
    newSetIdentityDkimEnabledResponse,

    -- * Response Lenses
    setIdentityDkimEnabledResponse_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

-- | Represents a request to enable or disable Amazon SES Easy DKIM signing
-- for an identity. For more information about setting up Easy DKIM, see
-- the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/easy-dkim.html Amazon SES Developer Guide>.
--
-- /See:/ 'newSetIdentityDkimEnabled' smart constructor.
data SetIdentityDkimEnabled = SetIdentityDkimEnabled'
  { -- | The identity for which DKIM signing should be enabled or disabled.
    SetIdentityDkimEnabled -> Text
identity :: Prelude.Text,
    -- | Sets whether DKIM signing is enabled for an identity. Set to @true@ to
    -- enable DKIM signing for this identity; @false@ to disable it.
    SetIdentityDkimEnabled -> Bool
dkimEnabled :: Prelude.Bool
  }
  deriving (SetIdentityDkimEnabled -> SetIdentityDkimEnabled -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetIdentityDkimEnabled -> SetIdentityDkimEnabled -> Bool
$c/= :: SetIdentityDkimEnabled -> SetIdentityDkimEnabled -> Bool
== :: SetIdentityDkimEnabled -> SetIdentityDkimEnabled -> Bool
$c== :: SetIdentityDkimEnabled -> SetIdentityDkimEnabled -> Bool
Prelude.Eq, ReadPrec [SetIdentityDkimEnabled]
ReadPrec SetIdentityDkimEnabled
Int -> ReadS SetIdentityDkimEnabled
ReadS [SetIdentityDkimEnabled]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetIdentityDkimEnabled]
$creadListPrec :: ReadPrec [SetIdentityDkimEnabled]
readPrec :: ReadPrec SetIdentityDkimEnabled
$creadPrec :: ReadPrec SetIdentityDkimEnabled
readList :: ReadS [SetIdentityDkimEnabled]
$creadList :: ReadS [SetIdentityDkimEnabled]
readsPrec :: Int -> ReadS SetIdentityDkimEnabled
$creadsPrec :: Int -> ReadS SetIdentityDkimEnabled
Prelude.Read, Int -> SetIdentityDkimEnabled -> ShowS
[SetIdentityDkimEnabled] -> ShowS
SetIdentityDkimEnabled -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetIdentityDkimEnabled] -> ShowS
$cshowList :: [SetIdentityDkimEnabled] -> ShowS
show :: SetIdentityDkimEnabled -> String
$cshow :: SetIdentityDkimEnabled -> String
showsPrec :: Int -> SetIdentityDkimEnabled -> ShowS
$cshowsPrec :: Int -> SetIdentityDkimEnabled -> ShowS
Prelude.Show, forall x. Rep SetIdentityDkimEnabled x -> SetIdentityDkimEnabled
forall x. SetIdentityDkimEnabled -> Rep SetIdentityDkimEnabled x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SetIdentityDkimEnabled x -> SetIdentityDkimEnabled
$cfrom :: forall x. SetIdentityDkimEnabled -> Rep SetIdentityDkimEnabled x
Prelude.Generic)

-- |
-- Create a value of 'SetIdentityDkimEnabled' 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:
--
-- 'identity', 'setIdentityDkimEnabled_identity' - The identity for which DKIM signing should be enabled or disabled.
--
-- 'dkimEnabled', 'setIdentityDkimEnabled_dkimEnabled' - Sets whether DKIM signing is enabled for an identity. Set to @true@ to
-- enable DKIM signing for this identity; @false@ to disable it.
newSetIdentityDkimEnabled ::
  -- | 'identity'
  Prelude.Text ->
  -- | 'dkimEnabled'
  Prelude.Bool ->
  SetIdentityDkimEnabled
newSetIdentityDkimEnabled :: Text -> Bool -> SetIdentityDkimEnabled
newSetIdentityDkimEnabled Text
pIdentity_ Bool
pDkimEnabled_ =
  SetIdentityDkimEnabled'
    { $sel:identity:SetIdentityDkimEnabled' :: Text
identity = Text
pIdentity_,
      $sel:dkimEnabled:SetIdentityDkimEnabled' :: Bool
dkimEnabled = Bool
pDkimEnabled_
    }

-- | The identity for which DKIM signing should be enabled or disabled.
setIdentityDkimEnabled_identity :: Lens.Lens' SetIdentityDkimEnabled Prelude.Text
setIdentityDkimEnabled_identity :: Lens' SetIdentityDkimEnabled Text
setIdentityDkimEnabled_identity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetIdentityDkimEnabled' {Text
identity :: Text
$sel:identity:SetIdentityDkimEnabled' :: SetIdentityDkimEnabled -> Text
identity} -> Text
identity) (\s :: SetIdentityDkimEnabled
s@SetIdentityDkimEnabled' {} Text
a -> SetIdentityDkimEnabled
s {$sel:identity:SetIdentityDkimEnabled' :: Text
identity = Text
a} :: SetIdentityDkimEnabled)

-- | Sets whether DKIM signing is enabled for an identity. Set to @true@ to
-- enable DKIM signing for this identity; @false@ to disable it.
setIdentityDkimEnabled_dkimEnabled :: Lens.Lens' SetIdentityDkimEnabled Prelude.Bool
setIdentityDkimEnabled_dkimEnabled :: Lens' SetIdentityDkimEnabled Bool
setIdentityDkimEnabled_dkimEnabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetIdentityDkimEnabled' {Bool
dkimEnabled :: Bool
$sel:dkimEnabled:SetIdentityDkimEnabled' :: SetIdentityDkimEnabled -> Bool
dkimEnabled} -> Bool
dkimEnabled) (\s :: SetIdentityDkimEnabled
s@SetIdentityDkimEnabled' {} Bool
a -> SetIdentityDkimEnabled
s {$sel:dkimEnabled:SetIdentityDkimEnabled' :: Bool
dkimEnabled = Bool
a} :: SetIdentityDkimEnabled)

instance Core.AWSRequest SetIdentityDkimEnabled where
  type
    AWSResponse SetIdentityDkimEnabled =
      SetIdentityDkimEnabledResponse
  request :: (Service -> Service)
-> SetIdentityDkimEnabled -> Request SetIdentityDkimEnabled
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 SetIdentityDkimEnabled
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse SetIdentityDkimEnabled)))
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
"SetIdentityDkimEnabledResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> SetIdentityDkimEnabledResponse
SetIdentityDkimEnabledResponse'
            forall (f :: * -> *) a b. Functor 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 SetIdentityDkimEnabled where
  hashWithSalt :: Int -> SetIdentityDkimEnabled -> Int
hashWithSalt Int
_salt SetIdentityDkimEnabled' {Bool
Text
dkimEnabled :: Bool
identity :: Text
$sel:dkimEnabled:SetIdentityDkimEnabled' :: SetIdentityDkimEnabled -> Bool
$sel:identity:SetIdentityDkimEnabled' :: SetIdentityDkimEnabled -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
identity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
dkimEnabled

instance Prelude.NFData SetIdentityDkimEnabled where
  rnf :: SetIdentityDkimEnabled -> ()
rnf SetIdentityDkimEnabled' {Bool
Text
dkimEnabled :: Bool
identity :: Text
$sel:dkimEnabled:SetIdentityDkimEnabled' :: SetIdentityDkimEnabled -> Bool
$sel:identity:SetIdentityDkimEnabled' :: SetIdentityDkimEnabled -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
identity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
dkimEnabled

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

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

instance Data.ToQuery SetIdentityDkimEnabled where
  toQuery :: SetIdentityDkimEnabled -> QueryString
toQuery SetIdentityDkimEnabled' {Bool
Text
dkimEnabled :: Bool
identity :: Text
$sel:dkimEnabled:SetIdentityDkimEnabled' :: SetIdentityDkimEnabled -> Bool
$sel:identity:SetIdentityDkimEnabled' :: SetIdentityDkimEnabled -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"SetIdentityDkimEnabled" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"Identity" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
identity,
        ByteString
"DkimEnabled" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Bool
dkimEnabled
      ]

-- | An empty element returned on a successful request.
--
-- /See:/ 'newSetIdentityDkimEnabledResponse' smart constructor.
data SetIdentityDkimEnabledResponse = SetIdentityDkimEnabledResponse'
  { -- | The response's http status code.
    SetIdentityDkimEnabledResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (SetIdentityDkimEnabledResponse
-> SetIdentityDkimEnabledResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetIdentityDkimEnabledResponse
-> SetIdentityDkimEnabledResponse -> Bool
$c/= :: SetIdentityDkimEnabledResponse
-> SetIdentityDkimEnabledResponse -> Bool
== :: SetIdentityDkimEnabledResponse
-> SetIdentityDkimEnabledResponse -> Bool
$c== :: SetIdentityDkimEnabledResponse
-> SetIdentityDkimEnabledResponse -> Bool
Prelude.Eq, ReadPrec [SetIdentityDkimEnabledResponse]
ReadPrec SetIdentityDkimEnabledResponse
Int -> ReadS SetIdentityDkimEnabledResponse
ReadS [SetIdentityDkimEnabledResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetIdentityDkimEnabledResponse]
$creadListPrec :: ReadPrec [SetIdentityDkimEnabledResponse]
readPrec :: ReadPrec SetIdentityDkimEnabledResponse
$creadPrec :: ReadPrec SetIdentityDkimEnabledResponse
readList :: ReadS [SetIdentityDkimEnabledResponse]
$creadList :: ReadS [SetIdentityDkimEnabledResponse]
readsPrec :: Int -> ReadS SetIdentityDkimEnabledResponse
$creadsPrec :: Int -> ReadS SetIdentityDkimEnabledResponse
Prelude.Read, Int -> SetIdentityDkimEnabledResponse -> ShowS
[SetIdentityDkimEnabledResponse] -> ShowS
SetIdentityDkimEnabledResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetIdentityDkimEnabledResponse] -> ShowS
$cshowList :: [SetIdentityDkimEnabledResponse] -> ShowS
show :: SetIdentityDkimEnabledResponse -> String
$cshow :: SetIdentityDkimEnabledResponse -> String
showsPrec :: Int -> SetIdentityDkimEnabledResponse -> ShowS
$cshowsPrec :: Int -> SetIdentityDkimEnabledResponse -> ShowS
Prelude.Show, forall x.
Rep SetIdentityDkimEnabledResponse x
-> SetIdentityDkimEnabledResponse
forall x.
SetIdentityDkimEnabledResponse
-> Rep SetIdentityDkimEnabledResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SetIdentityDkimEnabledResponse x
-> SetIdentityDkimEnabledResponse
$cfrom :: forall x.
SetIdentityDkimEnabledResponse
-> Rep SetIdentityDkimEnabledResponse x
Prelude.Generic)

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

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

instance
  Prelude.NFData
    SetIdentityDkimEnabledResponse
  where
  rnf :: SetIdentityDkimEnabledResponse -> ()
rnf SetIdentityDkimEnabledResponse' {Int
httpStatus :: Int
$sel:httpStatus:SetIdentityDkimEnabledResponse' :: SetIdentityDkimEnabledResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus