{-# 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.CertificateManager.Types.DomainValidationOption
-- 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.CertificateManager.Types.DomainValidationOption where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the domain names that you want ACM to use to
-- send you emails that enable you to validate domain ownership.
--
-- /See:/ 'newDomainValidationOption' smart constructor.
data DomainValidationOption = DomainValidationOption'
  { -- | A fully qualified domain name (FQDN) in the certificate request.
    DomainValidationOption -> Text
domainName :: Prelude.Text,
    -- | The domain name that you want ACM to use to send you validation emails.
    -- This domain name is the suffix of the email addresses that you want ACM
    -- to use. This must be the same as the @DomainName@ value or a superdomain
    -- of the @DomainName@ value. For example, if you request a certificate for
    -- @testing.example.com@, you can specify @example.com@ for this value. In
    -- that case, ACM sends domain validation emails to the following five
    -- addresses:
    --
    -- -   admin\@example.com
    --
    -- -   administrator\@example.com
    --
    -- -   hostmaster\@example.com
    --
    -- -   postmaster\@example.com
    --
    -- -   webmaster\@example.com
    DomainValidationOption -> Text
validationDomain :: Prelude.Text
  }
  deriving (DomainValidationOption -> DomainValidationOption -> Bool
(DomainValidationOption -> DomainValidationOption -> Bool)
-> (DomainValidationOption -> DomainValidationOption -> Bool)
-> Eq DomainValidationOption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DomainValidationOption -> DomainValidationOption -> Bool
$c/= :: DomainValidationOption -> DomainValidationOption -> Bool
== :: DomainValidationOption -> DomainValidationOption -> Bool
$c== :: DomainValidationOption -> DomainValidationOption -> Bool
Prelude.Eq, ReadPrec [DomainValidationOption]
ReadPrec DomainValidationOption
Int -> ReadS DomainValidationOption
ReadS [DomainValidationOption]
(Int -> ReadS DomainValidationOption)
-> ReadS [DomainValidationOption]
-> ReadPrec DomainValidationOption
-> ReadPrec [DomainValidationOption]
-> Read DomainValidationOption
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DomainValidationOption]
$creadListPrec :: ReadPrec [DomainValidationOption]
readPrec :: ReadPrec DomainValidationOption
$creadPrec :: ReadPrec DomainValidationOption
readList :: ReadS [DomainValidationOption]
$creadList :: ReadS [DomainValidationOption]
readsPrec :: Int -> ReadS DomainValidationOption
$creadsPrec :: Int -> ReadS DomainValidationOption
Prelude.Read, Int -> DomainValidationOption -> ShowS
[DomainValidationOption] -> ShowS
DomainValidationOption -> String
(Int -> DomainValidationOption -> ShowS)
-> (DomainValidationOption -> String)
-> ([DomainValidationOption] -> ShowS)
-> Show DomainValidationOption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DomainValidationOption] -> ShowS
$cshowList :: [DomainValidationOption] -> ShowS
show :: DomainValidationOption -> String
$cshow :: DomainValidationOption -> String
showsPrec :: Int -> DomainValidationOption -> ShowS
$cshowsPrec :: Int -> DomainValidationOption -> ShowS
Prelude.Show, (forall x. DomainValidationOption -> Rep DomainValidationOption x)
-> (forall x.
    Rep DomainValidationOption x -> DomainValidationOption)
-> Generic DomainValidationOption
forall x. Rep DomainValidationOption x -> DomainValidationOption
forall x. DomainValidationOption -> Rep DomainValidationOption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DomainValidationOption x -> DomainValidationOption
$cfrom :: forall x. DomainValidationOption -> Rep DomainValidationOption x
Prelude.Generic)

-- |
-- Create a value of 'DomainValidationOption' 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:
--
-- 'domainName', 'domainValidationOption_domainName' - A fully qualified domain name (FQDN) in the certificate request.
--
-- 'validationDomain', 'domainValidationOption_validationDomain' - The domain name that you want ACM to use to send you validation emails.
-- This domain name is the suffix of the email addresses that you want ACM
-- to use. This must be the same as the @DomainName@ value or a superdomain
-- of the @DomainName@ value. For example, if you request a certificate for
-- @testing.example.com@, you can specify @example.com@ for this value. In
-- that case, ACM sends domain validation emails to the following five
-- addresses:
--
-- -   admin\@example.com
--
-- -   administrator\@example.com
--
-- -   hostmaster\@example.com
--
-- -   postmaster\@example.com
--
-- -   webmaster\@example.com
newDomainValidationOption ::
  -- | 'domainName'
  Prelude.Text ->
  -- | 'validationDomain'
  Prelude.Text ->
  DomainValidationOption
newDomainValidationOption :: Text -> Text -> DomainValidationOption
newDomainValidationOption
  Text
pDomainName_
  Text
pValidationDomain_ =
    DomainValidationOption' :: Text -> Text -> DomainValidationOption
DomainValidationOption'
      { $sel:domainName:DomainValidationOption' :: Text
domainName = Text
pDomainName_,
        $sel:validationDomain:DomainValidationOption' :: Text
validationDomain = Text
pValidationDomain_
      }

-- | A fully qualified domain name (FQDN) in the certificate request.
domainValidationOption_domainName :: Lens.Lens' DomainValidationOption Prelude.Text
domainValidationOption_domainName :: (Text -> f Text)
-> DomainValidationOption -> f DomainValidationOption
domainValidationOption_domainName = (DomainValidationOption -> Text)
-> (DomainValidationOption -> Text -> DomainValidationOption)
-> Lens DomainValidationOption DomainValidationOption Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainValidationOption' {Text
domainName :: Text
$sel:domainName:DomainValidationOption' :: DomainValidationOption -> Text
domainName} -> Text
domainName) (\s :: DomainValidationOption
s@DomainValidationOption' {} Text
a -> DomainValidationOption
s {$sel:domainName:DomainValidationOption' :: Text
domainName = Text
a} :: DomainValidationOption)

-- | The domain name that you want ACM to use to send you validation emails.
-- This domain name is the suffix of the email addresses that you want ACM
-- to use. This must be the same as the @DomainName@ value or a superdomain
-- of the @DomainName@ value. For example, if you request a certificate for
-- @testing.example.com@, you can specify @example.com@ for this value. In
-- that case, ACM sends domain validation emails to the following five
-- addresses:
--
-- -   admin\@example.com
--
-- -   administrator\@example.com
--
-- -   hostmaster\@example.com
--
-- -   postmaster\@example.com
--
-- -   webmaster\@example.com
domainValidationOption_validationDomain :: Lens.Lens' DomainValidationOption Prelude.Text
domainValidationOption_validationDomain :: (Text -> f Text)
-> DomainValidationOption -> f DomainValidationOption
domainValidationOption_validationDomain = (DomainValidationOption -> Text)
-> (DomainValidationOption -> Text -> DomainValidationOption)
-> Lens DomainValidationOption DomainValidationOption Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainValidationOption' {Text
validationDomain :: Text
$sel:validationDomain:DomainValidationOption' :: DomainValidationOption -> Text
validationDomain} -> Text
validationDomain) (\s :: DomainValidationOption
s@DomainValidationOption' {} Text
a -> DomainValidationOption
s {$sel:validationDomain:DomainValidationOption' :: Text
validationDomain = Text
a} :: DomainValidationOption)

instance Prelude.Hashable DomainValidationOption

instance Prelude.NFData DomainValidationOption

instance Core.ToJSON DomainValidationOption where
  toJSON :: DomainValidationOption -> Value
toJSON DomainValidationOption' {Text
validationDomain :: Text
domainName :: Text
$sel:validationDomain:DomainValidationOption' :: DomainValidationOption -> Text
$sel:domainName:DomainValidationOption' :: DomainValidationOption -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DomainName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
domainName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ValidationDomain" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
validationDomain)
          ]
      )