{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.CreateDomainName
-- 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)
--
-- Creates a domain name.
module Amazonka.ApiGatewayV2.CreateDomainName
  ( -- * Creating a Request
    CreateDomainName (..),
    newCreateDomainName,

    -- * Request Lenses
    createDomainName_domainNameConfigurations,
    createDomainName_mutualTlsAuthentication,
    createDomainName_tags,
    createDomainName_domainName,

    -- * Destructuring the Response
    CreateDomainNameResponse (..),
    newCreateDomainNameResponse,

    -- * Response Lenses
    createDomainNameResponse_domainNameConfigurations,
    createDomainNameResponse_domainName,
    createDomainNameResponse_mutualTlsAuthentication,
    createDomainNameResponse_apiMappingSelectionExpression,
    createDomainNameResponse_tags,
    createDomainNameResponse_httpStatus,
  )
where

import Amazonka.ApiGatewayV2.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

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

-- |
-- Create a value of 'CreateDomainName' 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:
--
-- 'domainNameConfigurations', 'createDomainName_domainNameConfigurations' - The domain name configurations.
--
-- 'mutualTlsAuthentication', 'createDomainName_mutualTlsAuthentication' - The mutual TLS authentication configuration for a custom domain name.
--
-- 'tags', 'createDomainName_tags' - The collection of tags associated with a domain name.
--
-- 'domainName', 'createDomainName_domainName' - The domain name.
newCreateDomainName ::
  -- | 'domainName'
  Prelude.Text ->
  CreateDomainName
newCreateDomainName :: Text -> CreateDomainName
newCreateDomainName Text
pDomainName_ =
  CreateDomainName' :: Maybe [DomainNameConfiguration]
-> Maybe MutualTlsAuthenticationInput
-> Maybe (HashMap Text Text)
-> Text
-> CreateDomainName
CreateDomainName'
    { $sel:domainNameConfigurations:CreateDomainName' :: Maybe [DomainNameConfiguration]
domainNameConfigurations =
        Maybe [DomainNameConfiguration]
forall a. Maybe a
Prelude.Nothing,
      $sel:mutualTlsAuthentication:CreateDomainName' :: Maybe MutualTlsAuthenticationInput
mutualTlsAuthentication = Maybe MutualTlsAuthenticationInput
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateDomainName' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:domainName:CreateDomainName' :: Text
domainName = Text
pDomainName_
    }

-- | The domain name configurations.
createDomainName_domainNameConfigurations :: Lens.Lens' CreateDomainName (Prelude.Maybe [DomainNameConfiguration])
createDomainName_domainNameConfigurations :: (Maybe [DomainNameConfiguration]
 -> f (Maybe [DomainNameConfiguration]))
-> CreateDomainName -> f CreateDomainName
createDomainName_domainNameConfigurations = (CreateDomainName -> Maybe [DomainNameConfiguration])
-> (CreateDomainName
    -> Maybe [DomainNameConfiguration] -> CreateDomainName)
-> Lens
     CreateDomainName
     CreateDomainName
     (Maybe [DomainNameConfiguration])
     (Maybe [DomainNameConfiguration])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainName' {Maybe [DomainNameConfiguration]
domainNameConfigurations :: Maybe [DomainNameConfiguration]
$sel:domainNameConfigurations:CreateDomainName' :: CreateDomainName -> Maybe [DomainNameConfiguration]
domainNameConfigurations} -> Maybe [DomainNameConfiguration]
domainNameConfigurations) (\s :: CreateDomainName
s@CreateDomainName' {} Maybe [DomainNameConfiguration]
a -> CreateDomainName
s {$sel:domainNameConfigurations:CreateDomainName' :: Maybe [DomainNameConfiguration]
domainNameConfigurations = Maybe [DomainNameConfiguration]
a} :: CreateDomainName) ((Maybe [DomainNameConfiguration]
  -> f (Maybe [DomainNameConfiguration]))
 -> CreateDomainName -> f CreateDomainName)
-> ((Maybe [DomainNameConfiguration]
     -> f (Maybe [DomainNameConfiguration]))
    -> Maybe [DomainNameConfiguration]
    -> f (Maybe [DomainNameConfiguration]))
-> (Maybe [DomainNameConfiguration]
    -> f (Maybe [DomainNameConfiguration]))
-> CreateDomainName
-> f CreateDomainName
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DomainNameConfiguration]
  [DomainNameConfiguration]
  [DomainNameConfiguration]
  [DomainNameConfiguration]
-> Iso
     (Maybe [DomainNameConfiguration])
     (Maybe [DomainNameConfiguration])
     (Maybe [DomainNameConfiguration])
     (Maybe [DomainNameConfiguration])
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 AnIso
  [DomainNameConfiguration]
  [DomainNameConfiguration]
  [DomainNameConfiguration]
  [DomainNameConfiguration]
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.
createDomainName_mutualTlsAuthentication :: Lens.Lens' CreateDomainName (Prelude.Maybe MutualTlsAuthenticationInput)
createDomainName_mutualTlsAuthentication :: (Maybe MutualTlsAuthenticationInput
 -> f (Maybe MutualTlsAuthenticationInput))
-> CreateDomainName -> f CreateDomainName
createDomainName_mutualTlsAuthentication = (CreateDomainName -> Maybe MutualTlsAuthenticationInput)
-> (CreateDomainName
    -> Maybe MutualTlsAuthenticationInput -> CreateDomainName)
-> Lens
     CreateDomainName
     CreateDomainName
     (Maybe MutualTlsAuthenticationInput)
     (Maybe MutualTlsAuthenticationInput)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainName' {Maybe MutualTlsAuthenticationInput
mutualTlsAuthentication :: Maybe MutualTlsAuthenticationInput
$sel:mutualTlsAuthentication:CreateDomainName' :: CreateDomainName -> Maybe MutualTlsAuthenticationInput
mutualTlsAuthentication} -> Maybe MutualTlsAuthenticationInput
mutualTlsAuthentication) (\s :: CreateDomainName
s@CreateDomainName' {} Maybe MutualTlsAuthenticationInput
a -> CreateDomainName
s {$sel:mutualTlsAuthentication:CreateDomainName' :: Maybe MutualTlsAuthenticationInput
mutualTlsAuthentication = Maybe MutualTlsAuthenticationInput
a} :: CreateDomainName)

-- | The collection of tags associated with a domain name.
createDomainName_tags :: Lens.Lens' CreateDomainName (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createDomainName_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateDomainName -> f CreateDomainName
createDomainName_tags = (CreateDomainName -> Maybe (HashMap Text Text))
-> (CreateDomainName
    -> Maybe (HashMap Text Text) -> CreateDomainName)
-> Lens
     CreateDomainName
     CreateDomainName
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainName' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateDomainName' :: CreateDomainName -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateDomainName
s@CreateDomainName' {} Maybe (HashMap Text Text)
a -> CreateDomainName
s {$sel:tags:CreateDomainName' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateDomainName) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateDomainName -> f CreateDomainName)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateDomainName
-> f CreateDomainName
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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 AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The domain name.
createDomainName_domainName :: Lens.Lens' CreateDomainName Prelude.Text
createDomainName_domainName :: (Text -> f Text) -> CreateDomainName -> f CreateDomainName
createDomainName_domainName = (CreateDomainName -> Text)
-> (CreateDomainName -> Text -> CreateDomainName)
-> Lens CreateDomainName CreateDomainName Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainName' {Text
domainName :: Text
$sel:domainName:CreateDomainName' :: CreateDomainName -> Text
domainName} -> Text
domainName) (\s :: CreateDomainName
s@CreateDomainName' {} Text
a -> CreateDomainName
s {$sel:domainName:CreateDomainName' :: Text
domainName = Text
a} :: CreateDomainName)

instance Core.AWSRequest CreateDomainName where
  type
    AWSResponse CreateDomainName =
      CreateDomainNameResponse
  request :: CreateDomainName -> Request CreateDomainName
request = Service -> CreateDomainName -> Request CreateDomainName
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateDomainName
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateDomainName)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateDomainName))
-> Logger
-> Service
-> Proxy CreateDomainName
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateDomainName)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [DomainNameConfiguration]
-> Maybe Text
-> Maybe MutualTlsAuthentication
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Int
-> CreateDomainNameResponse
CreateDomainNameResponse'
            (Maybe [DomainNameConfiguration]
 -> Maybe Text
 -> Maybe MutualTlsAuthentication
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> Int
 -> CreateDomainNameResponse)
-> Either String (Maybe [DomainNameConfiguration])
-> Either
     String
     (Maybe Text
      -> Maybe MutualTlsAuthentication
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Int
      -> CreateDomainNameResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [DomainNameConfiguration]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"domainNameConfigurations"
                            Either String (Maybe (Maybe [DomainNameConfiguration]))
-> Maybe [DomainNameConfiguration]
-> Either String (Maybe [DomainNameConfiguration])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [DomainNameConfiguration]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either
  String
  (Maybe Text
   -> Maybe MutualTlsAuthentication
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Int
   -> CreateDomainNameResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe MutualTlsAuthentication
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Int
      -> CreateDomainNameResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"domainName")
            Either
  String
  (Maybe MutualTlsAuthentication
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Int
   -> CreateDomainNameResponse)
-> Either String (Maybe MutualTlsAuthentication)
-> Either
     String
     (Maybe Text
      -> Maybe (HashMap Text Text) -> Int -> CreateDomainNameResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe MutualTlsAuthentication)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"mutualTlsAuthentication")
            Either
  String
  (Maybe Text
   -> Maybe (HashMap Text Text) -> Int -> CreateDomainNameResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe (HashMap Text Text) -> Int -> CreateDomainNameResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"apiMappingSelectionExpression")
            Either
  String
  (Maybe (HashMap Text Text) -> Int -> CreateDomainNameResponse)
-> Either String (Maybe (HashMap Text Text))
-> Either String (Int -> CreateDomainNameResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"tags" Either String (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text)
-> Either String (Maybe (HashMap Text Text))
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> CreateDomainNameResponse)
-> Either String Int -> Either String CreateDomainNameResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateDomainName

instance Prelude.NFData CreateDomainName

instance Core.ToHeaders CreateDomainName where
  toHeaders :: CreateDomainName -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateDomainName -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateDomainName where
  toJSON :: CreateDomainName -> Value
toJSON CreateDomainName' {Maybe [DomainNameConfiguration]
Maybe (HashMap Text Text)
Maybe MutualTlsAuthenticationInput
Text
domainName :: Text
tags :: Maybe (HashMap Text Text)
mutualTlsAuthentication :: Maybe MutualTlsAuthenticationInput
domainNameConfigurations :: Maybe [DomainNameConfiguration]
$sel:domainName:CreateDomainName' :: CreateDomainName -> Text
$sel:tags:CreateDomainName' :: CreateDomainName -> Maybe (HashMap Text Text)
$sel:mutualTlsAuthentication:CreateDomainName' :: CreateDomainName -> Maybe MutualTlsAuthenticationInput
$sel:domainNameConfigurations:CreateDomainName' :: CreateDomainName -> Maybe [DomainNameConfiguration]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"domainNameConfigurations" Text -> [DomainNameConfiguration] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([DomainNameConfiguration] -> Pair)
-> Maybe [DomainNameConfiguration] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [DomainNameConfiguration]
domainNameConfigurations,
            (Text
"mutualTlsAuthentication" Text -> MutualTlsAuthenticationInput -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (MutualTlsAuthenticationInput -> Pair)
-> Maybe MutualTlsAuthenticationInput -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MutualTlsAuthenticationInput
mutualTlsAuthentication,
            (Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            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)
          ]
      )

instance Core.ToPath CreateDomainName where
  toPath :: CreateDomainName -> ByteString
toPath = ByteString -> CreateDomainName -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v2/domainnames"

instance Core.ToQuery CreateDomainName where
  toQuery :: CreateDomainName -> QueryString
toQuery = QueryString -> CreateDomainName -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

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

-- |
-- Create a value of 'CreateDomainNameResponse' 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:
--
-- 'domainNameConfigurations', 'createDomainNameResponse_domainNameConfigurations' - The domain name configurations.
--
-- 'domainName', 'createDomainNameResponse_domainName' - The name of the DomainName resource.
--
-- 'mutualTlsAuthentication', 'createDomainNameResponse_mutualTlsAuthentication' - The mutual TLS authentication configuration for a custom domain name.
--
-- 'apiMappingSelectionExpression', 'createDomainNameResponse_apiMappingSelectionExpression' - The API mapping selection expression.
--
-- 'tags', 'createDomainNameResponse_tags' - The collection of tags associated with a domain name.
--
-- 'httpStatus', 'createDomainNameResponse_httpStatus' - The response's http status code.
newCreateDomainNameResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateDomainNameResponse
newCreateDomainNameResponse :: Int -> CreateDomainNameResponse
newCreateDomainNameResponse Int
pHttpStatus_ =
  CreateDomainNameResponse' :: Maybe [DomainNameConfiguration]
-> Maybe Text
-> Maybe MutualTlsAuthentication
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Int
-> CreateDomainNameResponse
CreateDomainNameResponse'
    { $sel:domainNameConfigurations:CreateDomainNameResponse' :: Maybe [DomainNameConfiguration]
domainNameConfigurations =
        Maybe [DomainNameConfiguration]
forall a. Maybe a
Prelude.Nothing,
      $sel:domainName:CreateDomainNameResponse' :: Maybe Text
domainName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:mutualTlsAuthentication:CreateDomainNameResponse' :: Maybe MutualTlsAuthentication
mutualTlsAuthentication = Maybe MutualTlsAuthentication
forall a. Maybe a
Prelude.Nothing,
      $sel:apiMappingSelectionExpression:CreateDomainNameResponse' :: Maybe Text
apiMappingSelectionExpression = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateDomainNameResponse' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateDomainNameResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The domain name configurations.
createDomainNameResponse_domainNameConfigurations :: Lens.Lens' CreateDomainNameResponse (Prelude.Maybe [DomainNameConfiguration])
createDomainNameResponse_domainNameConfigurations :: (Maybe [DomainNameConfiguration]
 -> f (Maybe [DomainNameConfiguration]))
-> CreateDomainNameResponse -> f CreateDomainNameResponse
createDomainNameResponse_domainNameConfigurations = (CreateDomainNameResponse -> Maybe [DomainNameConfiguration])
-> (CreateDomainNameResponse
    -> Maybe [DomainNameConfiguration] -> CreateDomainNameResponse)
-> Lens
     CreateDomainNameResponse
     CreateDomainNameResponse
     (Maybe [DomainNameConfiguration])
     (Maybe [DomainNameConfiguration])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainNameResponse' {Maybe [DomainNameConfiguration]
domainNameConfigurations :: Maybe [DomainNameConfiguration]
$sel:domainNameConfigurations:CreateDomainNameResponse' :: CreateDomainNameResponse -> Maybe [DomainNameConfiguration]
domainNameConfigurations} -> Maybe [DomainNameConfiguration]
domainNameConfigurations) (\s :: CreateDomainNameResponse
s@CreateDomainNameResponse' {} Maybe [DomainNameConfiguration]
a -> CreateDomainNameResponse
s {$sel:domainNameConfigurations:CreateDomainNameResponse' :: Maybe [DomainNameConfiguration]
domainNameConfigurations = Maybe [DomainNameConfiguration]
a} :: CreateDomainNameResponse) ((Maybe [DomainNameConfiguration]
  -> f (Maybe [DomainNameConfiguration]))
 -> CreateDomainNameResponse -> f CreateDomainNameResponse)
-> ((Maybe [DomainNameConfiguration]
     -> f (Maybe [DomainNameConfiguration]))
    -> Maybe [DomainNameConfiguration]
    -> f (Maybe [DomainNameConfiguration]))
-> (Maybe [DomainNameConfiguration]
    -> f (Maybe [DomainNameConfiguration]))
-> CreateDomainNameResponse
-> f CreateDomainNameResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DomainNameConfiguration]
  [DomainNameConfiguration]
  [DomainNameConfiguration]
  [DomainNameConfiguration]
-> Iso
     (Maybe [DomainNameConfiguration])
     (Maybe [DomainNameConfiguration])
     (Maybe [DomainNameConfiguration])
     (Maybe [DomainNameConfiguration])
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 AnIso
  [DomainNameConfiguration]
  [DomainNameConfiguration]
  [DomainNameConfiguration]
  [DomainNameConfiguration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

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

-- | The collection of tags associated with a domain name.
createDomainNameResponse_tags :: Lens.Lens' CreateDomainNameResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createDomainNameResponse_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateDomainNameResponse -> f CreateDomainNameResponse
createDomainNameResponse_tags = (CreateDomainNameResponse -> Maybe (HashMap Text Text))
-> (CreateDomainNameResponse
    -> Maybe (HashMap Text Text) -> CreateDomainNameResponse)
-> Lens
     CreateDomainNameResponse
     CreateDomainNameResponse
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainNameResponse' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateDomainNameResponse' :: CreateDomainNameResponse -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateDomainNameResponse
s@CreateDomainNameResponse' {} Maybe (HashMap Text Text)
a -> CreateDomainNameResponse
s {$sel:tags:CreateDomainNameResponse' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateDomainNameResponse) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateDomainNameResponse -> f CreateDomainNameResponse)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateDomainNameResponse
-> f CreateDomainNameResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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 AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
createDomainNameResponse_httpStatus :: Lens.Lens' CreateDomainNameResponse Prelude.Int
createDomainNameResponse_httpStatus :: (Int -> f Int)
-> CreateDomainNameResponse -> f CreateDomainNameResponse
createDomainNameResponse_httpStatus = (CreateDomainNameResponse -> Int)
-> (CreateDomainNameResponse -> Int -> CreateDomainNameResponse)
-> Lens CreateDomainNameResponse CreateDomainNameResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainNameResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDomainNameResponse' :: CreateDomainNameResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateDomainNameResponse
s@CreateDomainNameResponse' {} Int
a -> CreateDomainNameResponse
s {$sel:httpStatus:CreateDomainNameResponse' :: Int
httpStatus = Int
a} :: CreateDomainNameResponse)

instance Prelude.NFData CreateDomainNameResponse