{-# 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.ApiGatewayV2.Types.DomainName
-- 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.ApiGatewayV2.Types.DomainName where

import Amazonka.ApiGatewayV2.Types.DomainNameConfiguration
import Amazonka.ApiGatewayV2.Types.MutualTlsAuthentication
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

-- | Represents a domain name.
--
-- /See:/ 'newDomainName' smart constructor.
data DomainName = DomainName'
  { -- | The API mapping selection expression.
    DomainName -> Maybe Text
apiMappingSelectionExpression :: Prelude.Maybe Prelude.Text,
    -- | The domain name configurations.
    DomainName -> Maybe [DomainNameConfiguration]
domainNameConfigurations :: Prelude.Maybe [DomainNameConfiguration],
    -- | The mutual TLS authentication configuration for a custom domain name.
    DomainName -> Maybe MutualTlsAuthentication
mutualTlsAuthentication :: Prelude.Maybe MutualTlsAuthentication,
    -- | The collection of tags associated with a domain name.
    DomainName -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name of the DomainName resource.
    DomainName -> Text
domainName :: Prelude.Text
  }
  deriving (DomainName -> DomainName -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DomainName -> DomainName -> Bool
$c/= :: DomainName -> DomainName -> Bool
== :: DomainName -> DomainName -> Bool
$c== :: DomainName -> DomainName -> Bool
Prelude.Eq, ReadPrec [DomainName]
ReadPrec DomainName
Int -> ReadS DomainName
ReadS [DomainName]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DomainName]
$creadListPrec :: ReadPrec [DomainName]
readPrec :: ReadPrec DomainName
$creadPrec :: ReadPrec DomainName
readList :: ReadS [DomainName]
$creadList :: ReadS [DomainName]
readsPrec :: Int -> ReadS DomainName
$creadsPrec :: Int -> ReadS DomainName
Prelude.Read, Int -> DomainName -> ShowS
[DomainName] -> ShowS
DomainName -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DomainName] -> ShowS
$cshowList :: [DomainName] -> ShowS
show :: DomainName -> String
$cshow :: DomainName -> String
showsPrec :: Int -> DomainName -> ShowS
$cshowsPrec :: Int -> DomainName -> ShowS
Prelude.Show, forall x. Rep DomainName x -> DomainName
forall x. DomainName -> Rep DomainName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DomainName x -> DomainName
$cfrom :: forall x. DomainName -> Rep DomainName x
Prelude.Generic)

-- |
-- Create a value of 'DomainName' 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:
--
-- 'apiMappingSelectionExpression', 'domainName_apiMappingSelectionExpression' - The API mapping selection expression.
--
-- 'domainNameConfigurations', 'domainName_domainNameConfigurations' - The domain name configurations.
--
-- 'mutualTlsAuthentication', 'domainName_mutualTlsAuthentication' - The mutual TLS authentication configuration for a custom domain name.
--
-- 'tags', 'domainName_tags' - The collection of tags associated with a domain name.
--
-- 'domainName', 'domainName_domainName' - The name of the DomainName resource.
newDomainName ::
  -- | 'domainName'
  Prelude.Text ->
  DomainName
newDomainName :: Text -> DomainName
newDomainName Text
pDomainName_ =
  DomainName'
    { $sel:apiMappingSelectionExpression:DomainName' :: Maybe Text
apiMappingSelectionExpression =
        forall a. Maybe a
Prelude.Nothing,
      $sel:domainNameConfigurations:DomainName' :: Maybe [DomainNameConfiguration]
domainNameConfigurations = forall a. Maybe a
Prelude.Nothing,
      $sel:mutualTlsAuthentication:DomainName' :: Maybe MutualTlsAuthentication
mutualTlsAuthentication = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:DomainName' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:domainName:DomainName' :: Text
domainName = Text
pDomainName_
    }

-- | The API mapping selection expression.
domainName_apiMappingSelectionExpression :: Lens.Lens' DomainName (Prelude.Maybe Prelude.Text)
domainName_apiMappingSelectionExpression :: Lens' DomainName (Maybe Text)
domainName_apiMappingSelectionExpression = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainName' {Maybe Text
apiMappingSelectionExpression :: Maybe Text
$sel:apiMappingSelectionExpression:DomainName' :: DomainName -> Maybe Text
apiMappingSelectionExpression} -> Maybe Text
apiMappingSelectionExpression) (\s :: DomainName
s@DomainName' {} Maybe Text
a -> DomainName
s {$sel:apiMappingSelectionExpression:DomainName' :: Maybe Text
apiMappingSelectionExpression = Maybe Text
a} :: DomainName)

-- | The domain name configurations.
domainName_domainNameConfigurations :: Lens.Lens' DomainName (Prelude.Maybe [DomainNameConfiguration])
domainName_domainNameConfigurations :: Lens' DomainName (Maybe [DomainNameConfiguration])
domainName_domainNameConfigurations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainName' {Maybe [DomainNameConfiguration]
domainNameConfigurations :: Maybe [DomainNameConfiguration]
$sel:domainNameConfigurations:DomainName' :: DomainName -> Maybe [DomainNameConfiguration]
domainNameConfigurations} -> Maybe [DomainNameConfiguration]
domainNameConfigurations) (\s :: DomainName
s@DomainName' {} Maybe [DomainNameConfiguration]
a -> DomainName
s {$sel:domainNameConfigurations:DomainName' :: Maybe [DomainNameConfiguration]
domainNameConfigurations = Maybe [DomainNameConfiguration]
a} :: DomainName) 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

-- | The mutual TLS authentication configuration for a custom domain name.
domainName_mutualTlsAuthentication :: Lens.Lens' DomainName (Prelude.Maybe MutualTlsAuthentication)
domainName_mutualTlsAuthentication :: Lens' DomainName (Maybe MutualTlsAuthentication)
domainName_mutualTlsAuthentication = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainName' {Maybe MutualTlsAuthentication
mutualTlsAuthentication :: Maybe MutualTlsAuthentication
$sel:mutualTlsAuthentication:DomainName' :: DomainName -> Maybe MutualTlsAuthentication
mutualTlsAuthentication} -> Maybe MutualTlsAuthentication
mutualTlsAuthentication) (\s :: DomainName
s@DomainName' {} Maybe MutualTlsAuthentication
a -> DomainName
s {$sel:mutualTlsAuthentication:DomainName' :: Maybe MutualTlsAuthentication
mutualTlsAuthentication = Maybe MutualTlsAuthentication
a} :: DomainName)

-- | The collection of tags associated with a domain name.
domainName_tags :: Lens.Lens' DomainName (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
domainName_tags :: Lens' DomainName (Maybe (HashMap Text Text))
domainName_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainName' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:DomainName' :: DomainName -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: DomainName
s@DomainName' {} Maybe (HashMap Text Text)
a -> DomainName
s {$sel:tags:DomainName' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: DomainName) 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

-- | The name of the DomainName resource.
domainName_domainName :: Lens.Lens' DomainName Prelude.Text
domainName_domainName :: Lens' DomainName Text
domainName_domainName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainName' {Text
domainName :: Text
$sel:domainName:DomainName' :: DomainName -> Text
domainName} -> Text
domainName) (\s :: DomainName
s@DomainName' {} Text
a -> DomainName
s {$sel:domainName:DomainName' :: Text
domainName = Text
a} :: DomainName)

instance Data.FromJSON DomainName where
  parseJSON :: Value -> Parser DomainName
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DomainName"
      ( \Object
x ->
          Maybe Text
-> Maybe [DomainNameConfiguration]
-> Maybe MutualTlsAuthentication
-> Maybe (HashMap Text Text)
-> Text
-> DomainName
DomainName'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"apiMappingSelectionExpression")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"domainNameConfigurations"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"mutualTlsAuthentication")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"domainName")
      )

instance Prelude.Hashable DomainName where
  hashWithSalt :: Int -> DomainName -> Int
hashWithSalt Int
_salt DomainName' {Maybe [DomainNameConfiguration]
Maybe Text
Maybe (HashMap Text Text)
Maybe MutualTlsAuthentication
Text
domainName :: Text
tags :: Maybe (HashMap Text Text)
mutualTlsAuthentication :: Maybe MutualTlsAuthentication
domainNameConfigurations :: Maybe [DomainNameConfiguration]
apiMappingSelectionExpression :: Maybe Text
$sel:domainName:DomainName' :: DomainName -> Text
$sel:tags:DomainName' :: DomainName -> Maybe (HashMap Text Text)
$sel:mutualTlsAuthentication:DomainName' :: DomainName -> Maybe MutualTlsAuthentication
$sel:domainNameConfigurations:DomainName' :: DomainName -> Maybe [DomainNameConfiguration]
$sel:apiMappingSelectionExpression:DomainName' :: DomainName -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
apiMappingSelectionExpression
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DomainNameConfiguration]
domainNameConfigurations
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MutualTlsAuthentication
mutualTlsAuthentication
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
domainName

instance Prelude.NFData DomainName where
  rnf :: DomainName -> ()
rnf DomainName' {Maybe [DomainNameConfiguration]
Maybe Text
Maybe (HashMap Text Text)
Maybe MutualTlsAuthentication
Text
domainName :: Text
tags :: Maybe (HashMap Text Text)
mutualTlsAuthentication :: Maybe MutualTlsAuthentication
domainNameConfigurations :: Maybe [DomainNameConfiguration]
apiMappingSelectionExpression :: Maybe Text
$sel:domainName:DomainName' :: DomainName -> Text
$sel:tags:DomainName' :: DomainName -> Maybe (HashMap Text Text)
$sel:mutualTlsAuthentication:DomainName' :: DomainName -> Maybe MutualTlsAuthentication
$sel:domainNameConfigurations:DomainName' :: DomainName -> Maybe [DomainNameConfiguration]
$sel:apiMappingSelectionExpression:DomainName' :: DomainName -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
apiMappingSelectionExpression
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [DomainNameConfiguration]
domainNameConfigurations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MutualTlsAuthentication
mutualTlsAuthentication
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
domainName