{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CognitoIdentityProvider.Types.CustomDomainConfigType 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

-- | 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
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]
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
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. 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'
    { $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 :: Lens' CustomDomainConfigType Text
customDomainConfigType_certificateArn = 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 Data.FromJSON CustomDomainConfigType where
  parseJSON :: Value -> Parser CustomDomainConfigType
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CustomDomainConfigType"
      ( \Object
x ->
          Text -> CustomDomainConfigType
CustomDomainConfigType'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"CertificateArn")
      )

instance Prelude.Hashable CustomDomainConfigType where
  hashWithSalt :: Int -> CustomDomainConfigType -> Int
hashWithSalt Int
_salt CustomDomainConfigType' {Text
certificateArn :: Text
$sel:certificateArn:CustomDomainConfigType' :: CustomDomainConfigType -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
certificateArn

instance Prelude.NFData CustomDomainConfigType where
  rnf :: CustomDomainConfigType -> ()
rnf CustomDomainConfigType' {Text
certificateArn :: Text
$sel:certificateArn:CustomDomainConfigType' :: CustomDomainConfigType -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
certificateArn

instance Data.ToJSON CustomDomainConfigType where
  toJSON :: CustomDomainConfigType -> Value
toJSON CustomDomainConfigType' {Text
certificateArn :: Text
$sel:certificateArn:CustomDomainConfigType' :: CustomDomainConfigType -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"CertificateArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
certificateArn)
          ]
      )