{-# 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-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)
--
-- 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.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

-- | 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
(SetIdentityDkimEnabled -> SetIdentityDkimEnabled -> Bool)
-> (SetIdentityDkimEnabled -> SetIdentityDkimEnabled -> Bool)
-> Eq SetIdentityDkimEnabled
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]
(Int -> ReadS SetIdentityDkimEnabled)
-> ReadS [SetIdentityDkimEnabled]
-> ReadPrec SetIdentityDkimEnabled
-> ReadPrec [SetIdentityDkimEnabled]
-> Read 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
(Int -> SetIdentityDkimEnabled -> ShowS)
-> (SetIdentityDkimEnabled -> String)
-> ([SetIdentityDkimEnabled] -> ShowS)
-> Show SetIdentityDkimEnabled
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. SetIdentityDkimEnabled -> Rep SetIdentityDkimEnabled x)
-> (forall x.
    Rep SetIdentityDkimEnabled x -> SetIdentityDkimEnabled)
-> Generic SetIdentityDkimEnabled
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' :: Text -> Bool -> SetIdentityDkimEnabled
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 :: (Text -> f Text)
-> SetIdentityDkimEnabled -> f SetIdentityDkimEnabled
setIdentityDkimEnabled_identity = (SetIdentityDkimEnabled -> Text)
-> (SetIdentityDkimEnabled -> Text -> SetIdentityDkimEnabled)
-> Lens SetIdentityDkimEnabled SetIdentityDkimEnabled Text Text
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 :: (Bool -> f Bool)
-> SetIdentityDkimEnabled -> f SetIdentityDkimEnabled
setIdentityDkimEnabled_dkimEnabled = (SetIdentityDkimEnabled -> Bool)
-> (SetIdentityDkimEnabled -> Bool -> SetIdentityDkimEnabled)
-> Lens SetIdentityDkimEnabled SetIdentityDkimEnabled Bool Bool
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 :: SetIdentityDkimEnabled -> Request SetIdentityDkimEnabled
request = Service -> SetIdentityDkimEnabled -> Request SetIdentityDkimEnabled
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy SetIdentityDkimEnabled
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse SetIdentityDkimEnabled)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse SetIdentityDkimEnabled))
-> Logger
-> Service
-> Proxy SetIdentityDkimEnabled
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse SetIdentityDkimEnabled)))
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
"SetIdentityDkimEnabledResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> SetIdentityDkimEnabledResponse
SetIdentityDkimEnabledResponse'
            (Int -> SetIdentityDkimEnabledResponse)
-> Either String Int
-> Either String SetIdentityDkimEnabledResponse
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 SetIdentityDkimEnabled

instance Prelude.NFData SetIdentityDkimEnabled

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

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

instance Core.ToQuery SetIdentityDkimEnabled where
  toQuery :: SetIdentityDkimEnabled -> QueryString
toQuery SetIdentityDkimEnabled' {Bool
Text
dkimEnabled :: Bool
identity :: Text
$sel:dkimEnabled:SetIdentityDkimEnabled' :: SetIdentityDkimEnabled -> Bool
$sel:identity:SetIdentityDkimEnabled' :: SetIdentityDkimEnabled -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"SetIdentityDkimEnabled" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"Identity" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
identity,
        ByteString
"DkimEnabled" ByteString -> Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: 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
(SetIdentityDkimEnabledResponse
 -> SetIdentityDkimEnabledResponse -> Bool)
-> (SetIdentityDkimEnabledResponse
    -> SetIdentityDkimEnabledResponse -> Bool)
-> Eq SetIdentityDkimEnabledResponse
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]
(Int -> ReadS SetIdentityDkimEnabledResponse)
-> ReadS [SetIdentityDkimEnabledResponse]
-> ReadPrec SetIdentityDkimEnabledResponse
-> ReadPrec [SetIdentityDkimEnabledResponse]
-> Read 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
(Int -> SetIdentityDkimEnabledResponse -> ShowS)
-> (SetIdentityDkimEnabledResponse -> String)
-> ([SetIdentityDkimEnabledResponse] -> ShowS)
-> Show SetIdentityDkimEnabledResponse
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.
 SetIdentityDkimEnabledResponse
 -> Rep SetIdentityDkimEnabledResponse x)
-> (forall x.
    Rep SetIdentityDkimEnabledResponse x
    -> SetIdentityDkimEnabledResponse)
-> Generic SetIdentityDkimEnabledResponse
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' :: Int -> SetIdentityDkimEnabledResponse
SetIdentityDkimEnabledResponse'
    { $sel:httpStatus:SetIdentityDkimEnabledResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
setIdentityDkimEnabledResponse_httpStatus :: Lens.Lens' SetIdentityDkimEnabledResponse Prelude.Int
setIdentityDkimEnabledResponse_httpStatus :: (Int -> f Int)
-> SetIdentityDkimEnabledResponse
-> f SetIdentityDkimEnabledResponse
setIdentityDkimEnabledResponse_httpStatus = (SetIdentityDkimEnabledResponse -> Int)
-> (SetIdentityDkimEnabledResponse
    -> Int -> SetIdentityDkimEnabledResponse)
-> Lens
     SetIdentityDkimEnabledResponse
     SetIdentityDkimEnabledResponse
     Int
     Int
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