{-# 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.CognitoIdentityProvider.Types.CustomDomainConfigType
-- 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.CognitoIdentityProvider.Types.CustomDomainConfigType where

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

-- | The configuration for a custom domain that hosts the sign-up and sign-in
-- webpages for your application.
--
-- /See:/ 'newCustomDomainConfigType' smart constructor.
data CustomDomainConfigType = CustomDomainConfigType'
  { -- | The Amazon Resource Name (ARN) of an Certificate Manager SSL
    -- certificate. You use this certificate for the subdomain of your custom
    -- domain.
    CustomDomainConfigType -> Text
certificateArn :: Prelude.Text
  }
  deriving (CustomDomainConfigType -> CustomDomainConfigType -> Bool
(CustomDomainConfigType -> CustomDomainConfigType -> Bool)
-> (CustomDomainConfigType -> CustomDomainConfigType -> Bool)
-> Eq CustomDomainConfigType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomDomainConfigType -> CustomDomainConfigType -> Bool
$c/= :: CustomDomainConfigType -> CustomDomainConfigType -> Bool
== :: CustomDomainConfigType -> CustomDomainConfigType -> Bool
$c== :: CustomDomainConfigType -> CustomDomainConfigType -> Bool
Prelude.Eq, ReadPrec [CustomDomainConfigType]
ReadPrec CustomDomainConfigType
Int -> ReadS CustomDomainConfigType
ReadS [CustomDomainConfigType]
(Int -> ReadS CustomDomainConfigType)
-> ReadS [CustomDomainConfigType]
-> ReadPrec CustomDomainConfigType
-> ReadPrec [CustomDomainConfigType]
-> Read CustomDomainConfigType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomDomainConfigType]
$creadListPrec :: ReadPrec [CustomDomainConfigType]
readPrec :: ReadPrec CustomDomainConfigType
$creadPrec :: ReadPrec CustomDomainConfigType
readList :: ReadS [CustomDomainConfigType]
$creadList :: ReadS [CustomDomainConfigType]
readsPrec :: Int -> ReadS CustomDomainConfigType
$creadsPrec :: Int -> ReadS CustomDomainConfigType
Prelude.Read, Int -> CustomDomainConfigType -> ShowS
[CustomDomainConfigType] -> ShowS
CustomDomainConfigType -> String
(Int -> CustomDomainConfigType -> ShowS)
-> (CustomDomainConfigType -> String)
-> ([CustomDomainConfigType] -> ShowS)
-> Show CustomDomainConfigType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomDomainConfigType] -> ShowS
$cshowList :: [CustomDomainConfigType] -> ShowS
show :: CustomDomainConfigType -> String
$cshow :: CustomDomainConfigType -> String
showsPrec :: Int -> CustomDomainConfigType -> ShowS
$cshowsPrec :: Int -> CustomDomainConfigType -> ShowS
Prelude.Show, (forall x. CustomDomainConfigType -> Rep CustomDomainConfigType x)
-> (forall x.
    Rep CustomDomainConfigType x -> CustomDomainConfigType)
-> Generic CustomDomainConfigType
forall x. Rep CustomDomainConfigType x -> CustomDomainConfigType
forall x. CustomDomainConfigType -> Rep CustomDomainConfigType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CustomDomainConfigType x -> CustomDomainConfigType
$cfrom :: forall x. CustomDomainConfigType -> Rep CustomDomainConfigType x
Prelude.Generic)

-- |
-- Create a value of 'CustomDomainConfigType' 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:
--
-- 'certificateArn', 'customDomainConfigType_certificateArn' - The Amazon Resource Name (ARN) of an Certificate Manager SSL
-- certificate. You use this certificate for the subdomain of your custom
-- domain.
newCustomDomainConfigType ::
  -- | 'certificateArn'
  Prelude.Text ->
  CustomDomainConfigType
newCustomDomainConfigType :: Text -> CustomDomainConfigType
newCustomDomainConfigType Text
pCertificateArn_ =
  CustomDomainConfigType' :: Text -> CustomDomainConfigType
CustomDomainConfigType'
    { $sel:certificateArn:CustomDomainConfigType' :: Text
certificateArn =
        Text
pCertificateArn_
    }

-- | The Amazon Resource Name (ARN) of an Certificate Manager SSL
-- certificate. You use this certificate for the subdomain of your custom
-- domain.
customDomainConfigType_certificateArn :: Lens.Lens' CustomDomainConfigType Prelude.Text
customDomainConfigType_certificateArn :: (Text -> f Text)
-> CustomDomainConfigType -> f CustomDomainConfigType
customDomainConfigType_certificateArn = (CustomDomainConfigType -> Text)
-> (CustomDomainConfigType -> Text -> CustomDomainConfigType)
-> Lens CustomDomainConfigType CustomDomainConfigType Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomDomainConfigType' {Text
certificateArn :: Text
$sel:certificateArn:CustomDomainConfigType' :: CustomDomainConfigType -> Text
certificateArn} -> Text
certificateArn) (\s :: CustomDomainConfigType
s@CustomDomainConfigType' {} Text
a -> CustomDomainConfigType
s {$sel:certificateArn:CustomDomainConfigType' :: Text
certificateArn = Text
a} :: CustomDomainConfigType)

instance Core.FromJSON CustomDomainConfigType where
  parseJSON :: Value -> Parser CustomDomainConfigType
parseJSON =
    String
-> (Object -> Parser CustomDomainConfigType)
-> Value
-> Parser CustomDomainConfigType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CustomDomainConfigType"
      ( \Object
x ->
          Text -> CustomDomainConfigType
CustomDomainConfigType'
            (Text -> CustomDomainConfigType)
-> Parser Text -> Parser CustomDomainConfigType
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"CertificateArn")
      )

instance Prelude.Hashable CustomDomainConfigType

instance Prelude.NFData CustomDomainConfigType

instance Core.ToJSON CustomDomainConfigType where
  toJSON :: CustomDomainConfigType -> Value
toJSON CustomDomainConfigType' {Text
certificateArn :: Text
$sel:certificateArn:CustomDomainConfigType' :: CustomDomainConfigType -> 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
"CertificateArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
certificateArn)
          ]
      )