{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.IdentityDkimAttributes
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SES.Types.IdentityDkimAttributes 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 Amazonka.SES.Types.VerificationStatus

-- | Represents the DKIM attributes of a verified email address or a domain.
--
-- /See:/ 'newIdentityDkimAttributes' smart constructor.
data IdentityDkimAttributes = IdentityDkimAttributes'
  { -- | A set of character strings that represent the domain\'s identity. Using
    -- these tokens, you need to create DNS CNAME records that point to DKIM
    -- public keys that are hosted by Amazon SES. Amazon Web Services
    -- eventually detects that you\'ve updated your DNS records. This detection
    -- process might take up to 72 hours. After successful detection, Amazon
    -- SES is able to DKIM-sign email originating from that domain. (This only
    -- applies to domain identities, not email address identities.)
    --
    -- For more information about creating DNS records using DKIM tokens, see
    -- the
    -- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/easy-dkim.html Amazon SES Developer Guide>.
    IdentityDkimAttributes -> Maybe [Text]
dkimTokens :: Prelude.Maybe [Prelude.Text],
    -- | Is true if DKIM signing is enabled for email sent from the identity.
    -- It\'s false otherwise. The default value is true.
    IdentityDkimAttributes -> Bool
dkimEnabled :: Prelude.Bool,
    -- | Describes whether Amazon SES has successfully verified the DKIM DNS
    -- records (tokens) published in the domain name\'s DNS. (This only applies
    -- to domain identities, not email address identities.)
    IdentityDkimAttributes -> VerificationStatus
dkimVerificationStatus :: VerificationStatus
  }
  deriving (IdentityDkimAttributes -> IdentityDkimAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IdentityDkimAttributes -> IdentityDkimAttributes -> Bool
$c/= :: IdentityDkimAttributes -> IdentityDkimAttributes -> Bool
== :: IdentityDkimAttributes -> IdentityDkimAttributes -> Bool
$c== :: IdentityDkimAttributes -> IdentityDkimAttributes -> Bool
Prelude.Eq, ReadPrec [IdentityDkimAttributes]
ReadPrec IdentityDkimAttributes
Int -> ReadS IdentityDkimAttributes
ReadS [IdentityDkimAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IdentityDkimAttributes]
$creadListPrec :: ReadPrec [IdentityDkimAttributes]
readPrec :: ReadPrec IdentityDkimAttributes
$creadPrec :: ReadPrec IdentityDkimAttributes
readList :: ReadS [IdentityDkimAttributes]
$creadList :: ReadS [IdentityDkimAttributes]
readsPrec :: Int -> ReadS IdentityDkimAttributes
$creadsPrec :: Int -> ReadS IdentityDkimAttributes
Prelude.Read, Int -> IdentityDkimAttributes -> ShowS
[IdentityDkimAttributes] -> ShowS
IdentityDkimAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IdentityDkimAttributes] -> ShowS
$cshowList :: [IdentityDkimAttributes] -> ShowS
show :: IdentityDkimAttributes -> String
$cshow :: IdentityDkimAttributes -> String
showsPrec :: Int -> IdentityDkimAttributes -> ShowS
$cshowsPrec :: Int -> IdentityDkimAttributes -> ShowS
Prelude.Show, forall x. Rep IdentityDkimAttributes x -> IdentityDkimAttributes
forall x. IdentityDkimAttributes -> Rep IdentityDkimAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IdentityDkimAttributes x -> IdentityDkimAttributes
$cfrom :: forall x. IdentityDkimAttributes -> Rep IdentityDkimAttributes x
Prelude.Generic)

-- |
-- Create a value of 'IdentityDkimAttributes' 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:
--
-- 'dkimTokens', 'identityDkimAttributes_dkimTokens' - A set of character strings that represent the domain\'s identity. Using
-- these tokens, you need to create DNS CNAME records that point to DKIM
-- public keys that are hosted by Amazon SES. Amazon Web Services
-- eventually detects that you\'ve updated your DNS records. This detection
-- process might take up to 72 hours. After successful detection, Amazon
-- SES is able to DKIM-sign email originating from that domain. (This only
-- applies to domain identities, not email address identities.)
--
-- For more information about creating DNS records using DKIM tokens, see
-- the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/easy-dkim.html Amazon SES Developer Guide>.
--
-- 'dkimEnabled', 'identityDkimAttributes_dkimEnabled' - Is true if DKIM signing is enabled for email sent from the identity.
-- It\'s false otherwise. The default value is true.
--
-- 'dkimVerificationStatus', 'identityDkimAttributes_dkimVerificationStatus' - Describes whether Amazon SES has successfully verified the DKIM DNS
-- records (tokens) published in the domain name\'s DNS. (This only applies
-- to domain identities, not email address identities.)
newIdentityDkimAttributes ::
  -- | 'dkimEnabled'
  Prelude.Bool ->
  -- | 'dkimVerificationStatus'
  VerificationStatus ->
  IdentityDkimAttributes
newIdentityDkimAttributes :: Bool -> VerificationStatus -> IdentityDkimAttributes
newIdentityDkimAttributes
  Bool
pDkimEnabled_
  VerificationStatus
pDkimVerificationStatus_ =
    IdentityDkimAttributes'
      { $sel:dkimTokens:IdentityDkimAttributes' :: Maybe [Text]
dkimTokens =
          forall a. Maybe a
Prelude.Nothing,
        $sel:dkimEnabled:IdentityDkimAttributes' :: Bool
dkimEnabled = Bool
pDkimEnabled_,
        $sel:dkimVerificationStatus:IdentityDkimAttributes' :: VerificationStatus
dkimVerificationStatus = VerificationStatus
pDkimVerificationStatus_
      }

-- | A set of character strings that represent the domain\'s identity. Using
-- these tokens, you need to create DNS CNAME records that point to DKIM
-- public keys that are hosted by Amazon SES. Amazon Web Services
-- eventually detects that you\'ve updated your DNS records. This detection
-- process might take up to 72 hours. After successful detection, Amazon
-- SES is able to DKIM-sign email originating from that domain. (This only
-- applies to domain identities, not email address identities.)
--
-- For more information about creating DNS records using DKIM tokens, see
-- the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/easy-dkim.html Amazon SES Developer Guide>.
identityDkimAttributes_dkimTokens :: Lens.Lens' IdentityDkimAttributes (Prelude.Maybe [Prelude.Text])
identityDkimAttributes_dkimTokens :: Lens' IdentityDkimAttributes (Maybe [Text])
identityDkimAttributes_dkimTokens = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityDkimAttributes' {Maybe [Text]
dkimTokens :: Maybe [Text]
$sel:dkimTokens:IdentityDkimAttributes' :: IdentityDkimAttributes -> Maybe [Text]
dkimTokens} -> Maybe [Text]
dkimTokens) (\s :: IdentityDkimAttributes
s@IdentityDkimAttributes' {} Maybe [Text]
a -> IdentityDkimAttributes
s {$sel:dkimTokens:IdentityDkimAttributes' :: Maybe [Text]
dkimTokens = Maybe [Text]
a} :: IdentityDkimAttributes) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Is true if DKIM signing is enabled for email sent from the identity.
-- It\'s false otherwise. The default value is true.
identityDkimAttributes_dkimEnabled :: Lens.Lens' IdentityDkimAttributes Prelude.Bool
identityDkimAttributes_dkimEnabled :: Lens' IdentityDkimAttributes Bool
identityDkimAttributes_dkimEnabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityDkimAttributes' {Bool
dkimEnabled :: Bool
$sel:dkimEnabled:IdentityDkimAttributes' :: IdentityDkimAttributes -> Bool
dkimEnabled} -> Bool
dkimEnabled) (\s :: IdentityDkimAttributes
s@IdentityDkimAttributes' {} Bool
a -> IdentityDkimAttributes
s {$sel:dkimEnabled:IdentityDkimAttributes' :: Bool
dkimEnabled = Bool
a} :: IdentityDkimAttributes)

-- | Describes whether Amazon SES has successfully verified the DKIM DNS
-- records (tokens) published in the domain name\'s DNS. (This only applies
-- to domain identities, not email address identities.)
identityDkimAttributes_dkimVerificationStatus :: Lens.Lens' IdentityDkimAttributes VerificationStatus
identityDkimAttributes_dkimVerificationStatus :: Lens' IdentityDkimAttributes VerificationStatus
identityDkimAttributes_dkimVerificationStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityDkimAttributes' {VerificationStatus
dkimVerificationStatus :: VerificationStatus
$sel:dkimVerificationStatus:IdentityDkimAttributes' :: IdentityDkimAttributes -> VerificationStatus
dkimVerificationStatus} -> VerificationStatus
dkimVerificationStatus) (\s :: IdentityDkimAttributes
s@IdentityDkimAttributes' {} VerificationStatus
a -> IdentityDkimAttributes
s {$sel:dkimVerificationStatus:IdentityDkimAttributes' :: VerificationStatus
dkimVerificationStatus = VerificationStatus
a} :: IdentityDkimAttributes)

instance Data.FromXML IdentityDkimAttributes where
  parseXML :: [Node] -> Either String IdentityDkimAttributes
parseXML [Node]
x =
    Maybe [Text]
-> Bool -> VerificationStatus -> IdentityDkimAttributes
IdentityDkimAttributes'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x
                      forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"DkimTokens"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
                  )
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"DkimEnabled")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"DkimVerificationStatus")

instance Prelude.Hashable IdentityDkimAttributes where
  hashWithSalt :: Int -> IdentityDkimAttributes -> Int
hashWithSalt Int
_salt IdentityDkimAttributes' {Bool
Maybe [Text]
VerificationStatus
dkimVerificationStatus :: VerificationStatus
dkimEnabled :: Bool
dkimTokens :: Maybe [Text]
$sel:dkimVerificationStatus:IdentityDkimAttributes' :: IdentityDkimAttributes -> VerificationStatus
$sel:dkimEnabled:IdentityDkimAttributes' :: IdentityDkimAttributes -> Bool
$sel:dkimTokens:IdentityDkimAttributes' :: IdentityDkimAttributes -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
dkimTokens
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
dkimEnabled
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` VerificationStatus
dkimVerificationStatus

instance Prelude.NFData IdentityDkimAttributes where
  rnf :: IdentityDkimAttributes -> ()
rnf IdentityDkimAttributes' {Bool
Maybe [Text]
VerificationStatus
dkimVerificationStatus :: VerificationStatus
dkimEnabled :: Bool
dkimTokens :: Maybe [Text]
$sel:dkimVerificationStatus:IdentityDkimAttributes' :: IdentityDkimAttributes -> VerificationStatus
$sel:dkimEnabled:IdentityDkimAttributes' :: IdentityDkimAttributes -> Bool
$sel:dkimTokens:IdentityDkimAttributes' :: IdentityDkimAttributes -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
dkimTokens
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
dkimEnabled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf VerificationStatus
dkimVerificationStatus