{-# 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.IdentityVerificationAttributes
-- 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)
module Amazonka.SES.Types.IdentityVerificationAttributes where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SES.Types.VerificationStatus

-- | Represents the verification attributes of a single identity.
--
-- /See:/ 'newIdentityVerificationAttributes' smart constructor.
data IdentityVerificationAttributes = IdentityVerificationAttributes'
  { -- | The verification token for a domain identity. Null for email address
    -- identities.
    IdentityVerificationAttributes -> Maybe Text
verificationToken :: Prelude.Maybe Prelude.Text,
    -- | The verification status of the identity: \"Pending\", \"Success\",
    -- \"Failed\", or \"TemporaryFailure\".
    IdentityVerificationAttributes -> VerificationStatus
verificationStatus :: VerificationStatus
  }
  deriving (IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
(IdentityVerificationAttributes
 -> IdentityVerificationAttributes -> Bool)
-> (IdentityVerificationAttributes
    -> IdentityVerificationAttributes -> Bool)
-> Eq IdentityVerificationAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
$c/= :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
== :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
$c== :: IdentityVerificationAttributes
-> IdentityVerificationAttributes -> Bool
Prelude.Eq, ReadPrec [IdentityVerificationAttributes]
ReadPrec IdentityVerificationAttributes
Int -> ReadS IdentityVerificationAttributes
ReadS [IdentityVerificationAttributes]
(Int -> ReadS IdentityVerificationAttributes)
-> ReadS [IdentityVerificationAttributes]
-> ReadPrec IdentityVerificationAttributes
-> ReadPrec [IdentityVerificationAttributes]
-> Read IdentityVerificationAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IdentityVerificationAttributes]
$creadListPrec :: ReadPrec [IdentityVerificationAttributes]
readPrec :: ReadPrec IdentityVerificationAttributes
$creadPrec :: ReadPrec IdentityVerificationAttributes
readList :: ReadS [IdentityVerificationAttributes]
$creadList :: ReadS [IdentityVerificationAttributes]
readsPrec :: Int -> ReadS IdentityVerificationAttributes
$creadsPrec :: Int -> ReadS IdentityVerificationAttributes
Prelude.Read, Int -> IdentityVerificationAttributes -> ShowS
[IdentityVerificationAttributes] -> ShowS
IdentityVerificationAttributes -> String
(Int -> IdentityVerificationAttributes -> ShowS)
-> (IdentityVerificationAttributes -> String)
-> ([IdentityVerificationAttributes] -> ShowS)
-> Show IdentityVerificationAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IdentityVerificationAttributes] -> ShowS
$cshowList :: [IdentityVerificationAttributes] -> ShowS
show :: IdentityVerificationAttributes -> String
$cshow :: IdentityVerificationAttributes -> String
showsPrec :: Int -> IdentityVerificationAttributes -> ShowS
$cshowsPrec :: Int -> IdentityVerificationAttributes -> ShowS
Prelude.Show, (forall x.
 IdentityVerificationAttributes
 -> Rep IdentityVerificationAttributes x)
-> (forall x.
    Rep IdentityVerificationAttributes x
    -> IdentityVerificationAttributes)
-> Generic IdentityVerificationAttributes
forall x.
Rep IdentityVerificationAttributes x
-> IdentityVerificationAttributes
forall x.
IdentityVerificationAttributes
-> Rep IdentityVerificationAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep IdentityVerificationAttributes x
-> IdentityVerificationAttributes
$cfrom :: forall x.
IdentityVerificationAttributes
-> Rep IdentityVerificationAttributes x
Prelude.Generic)

-- |
-- Create a value of 'IdentityVerificationAttributes' 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:
--
-- 'verificationToken', 'identityVerificationAttributes_verificationToken' - The verification token for a domain identity. Null for email address
-- identities.
--
-- 'verificationStatus', 'identityVerificationAttributes_verificationStatus' - The verification status of the identity: \"Pending\", \"Success\",
-- \"Failed\", or \"TemporaryFailure\".
newIdentityVerificationAttributes ::
  -- | 'verificationStatus'
  VerificationStatus ->
  IdentityVerificationAttributes
newIdentityVerificationAttributes :: VerificationStatus -> IdentityVerificationAttributes
newIdentityVerificationAttributes
  VerificationStatus
pVerificationStatus_ =
    IdentityVerificationAttributes' :: Maybe Text -> VerificationStatus -> IdentityVerificationAttributes
IdentityVerificationAttributes'
      { $sel:verificationToken:IdentityVerificationAttributes' :: Maybe Text
verificationToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:verificationStatus:IdentityVerificationAttributes' :: VerificationStatus
verificationStatus = VerificationStatus
pVerificationStatus_
      }

-- | The verification token for a domain identity. Null for email address
-- identities.
identityVerificationAttributes_verificationToken :: Lens.Lens' IdentityVerificationAttributes (Prelude.Maybe Prelude.Text)
identityVerificationAttributes_verificationToken :: (Maybe Text -> f (Maybe Text))
-> IdentityVerificationAttributes
-> f IdentityVerificationAttributes
identityVerificationAttributes_verificationToken = (IdentityVerificationAttributes -> Maybe Text)
-> (IdentityVerificationAttributes
    -> Maybe Text -> IdentityVerificationAttributes)
-> Lens
     IdentityVerificationAttributes
     IdentityVerificationAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityVerificationAttributes' {Maybe Text
verificationToken :: Maybe Text
$sel:verificationToken:IdentityVerificationAttributes' :: IdentityVerificationAttributes -> Maybe Text
verificationToken} -> Maybe Text
verificationToken) (\s :: IdentityVerificationAttributes
s@IdentityVerificationAttributes' {} Maybe Text
a -> IdentityVerificationAttributes
s {$sel:verificationToken:IdentityVerificationAttributes' :: Maybe Text
verificationToken = Maybe Text
a} :: IdentityVerificationAttributes)

-- | The verification status of the identity: \"Pending\", \"Success\",
-- \"Failed\", or \"TemporaryFailure\".
identityVerificationAttributes_verificationStatus :: Lens.Lens' IdentityVerificationAttributes VerificationStatus
identityVerificationAttributes_verificationStatus :: (VerificationStatus -> f VerificationStatus)
-> IdentityVerificationAttributes
-> f IdentityVerificationAttributes
identityVerificationAttributes_verificationStatus = (IdentityVerificationAttributes -> VerificationStatus)
-> (IdentityVerificationAttributes
    -> VerificationStatus -> IdentityVerificationAttributes)
-> Lens
     IdentityVerificationAttributes
     IdentityVerificationAttributes
     VerificationStatus
     VerificationStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityVerificationAttributes' {VerificationStatus
verificationStatus :: VerificationStatus
$sel:verificationStatus:IdentityVerificationAttributes' :: IdentityVerificationAttributes -> VerificationStatus
verificationStatus} -> VerificationStatus
verificationStatus) (\s :: IdentityVerificationAttributes
s@IdentityVerificationAttributes' {} VerificationStatus
a -> IdentityVerificationAttributes
s {$sel:verificationStatus:IdentityVerificationAttributes' :: VerificationStatus
verificationStatus = VerificationStatus
a} :: IdentityVerificationAttributes)

instance Core.FromXML IdentityVerificationAttributes where
  parseXML :: [Node] -> Either String IdentityVerificationAttributes
parseXML [Node]
x =
    Maybe Text -> VerificationStatus -> IdentityVerificationAttributes
IdentityVerificationAttributes'
      (Maybe Text
 -> VerificationStatus -> IdentityVerificationAttributes)
-> Either String (Maybe Text)
-> Either
     String (VerificationStatus -> IdentityVerificationAttributes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"VerificationToken")
      Either
  String (VerificationStatus -> IdentityVerificationAttributes)
-> Either String VerificationStatus
-> Either String IdentityVerificationAttributes
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String VerificationStatus
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"VerificationStatus")

instance
  Prelude.Hashable
    IdentityVerificationAttributes

instance
  Prelude.NFData
    IdentityVerificationAttributes