{-# 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.APIGateway.GetDomainName
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Represents a domain name that is contained in a simpler, more intuitive
-- URL that can be called.
module Amazonka.APIGateway.GetDomainName
  ( -- * Creating a Request
    GetDomainName (..),
    newGetDomainName,

    -- * Request Lenses
    getDomainName_domainName,

    -- * Destructuring the Response
    DomainName (..),
    newDomainName,

    -- * Response Lenses
    domainName_certificateArn,
    domainName_certificateName,
    domainName_certificateUploadDate,
    domainName_distributionDomainName,
    domainName_distributionHostedZoneId,
    domainName_domainName,
    domainName_domainNameStatus,
    domainName_domainNameStatusMessage,
    domainName_endpointConfiguration,
    domainName_mutualTlsAuthentication,
    domainName_ownershipVerificationCertificateArn,
    domainName_regionalCertificateArn,
    domainName_regionalCertificateName,
    domainName_regionalDomainName,
    domainName_regionalHostedZoneId,
    domainName_securityPolicy,
    domainName_tags,
  )
where

import Amazonka.APIGateway.Types
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
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Request to get the name of a DomainName resource.
--
-- /See:/ 'newGetDomainName' smart constructor.
data GetDomainName = GetDomainName'
  { -- | The name of the DomainName resource.
    GetDomainName -> Text
domainName :: Prelude.Text
  }
  deriving (GetDomainName -> GetDomainName -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDomainName -> GetDomainName -> Bool
$c/= :: GetDomainName -> GetDomainName -> Bool
== :: GetDomainName -> GetDomainName -> Bool
$c== :: GetDomainName -> GetDomainName -> Bool
Prelude.Eq, ReadPrec [GetDomainName]
ReadPrec GetDomainName
Int -> ReadS GetDomainName
ReadS [GetDomainName]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDomainName]
$creadListPrec :: ReadPrec [GetDomainName]
readPrec :: ReadPrec GetDomainName
$creadPrec :: ReadPrec GetDomainName
readList :: ReadS [GetDomainName]
$creadList :: ReadS [GetDomainName]
readsPrec :: Int -> ReadS GetDomainName
$creadsPrec :: Int -> ReadS GetDomainName
Prelude.Read, Int -> GetDomainName -> ShowS
[GetDomainName] -> ShowS
GetDomainName -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDomainName] -> ShowS
$cshowList :: [GetDomainName] -> ShowS
show :: GetDomainName -> String
$cshow :: GetDomainName -> String
showsPrec :: Int -> GetDomainName -> ShowS
$cshowsPrec :: Int -> GetDomainName -> ShowS
Prelude.Show, forall x. Rep GetDomainName x -> GetDomainName
forall x. GetDomainName -> Rep GetDomainName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDomainName x -> GetDomainName
$cfrom :: forall x. GetDomainName -> Rep GetDomainName x
Prelude.Generic)

-- |
-- Create a value of 'GetDomainName' 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', 'getDomainName_domainName' - The name of the DomainName resource.
newGetDomainName ::
  -- | 'domainName'
  Prelude.Text ->
  GetDomainName
newGetDomainName :: Text -> GetDomainName
newGetDomainName Text
pDomainName_ =
  GetDomainName' {$sel:domainName:GetDomainName' :: Text
domainName = Text
pDomainName_}

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

instance Core.AWSRequest GetDomainName where
  type AWSResponse GetDomainName = DomainName
  request :: (Service -> Service) -> GetDomainName -> Request GetDomainName
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetDomainName
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDomainName)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      (\Int
s ResponseHeaders
h Object
x -> forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)

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

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

instance Data.ToHeaders GetDomainName where
  toHeaders :: GetDomainName -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Accept"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"application/json" :: Prelude.ByteString)
          ]
      )

instance Data.ToPath GetDomainName where
  toPath :: GetDomainName -> ByteString
toPath GetDomainName' {Text
domainName :: Text
$sel:domainName:GetDomainName' :: GetDomainName -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/domainnames/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
domainName]

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