{-# 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-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)
--
-- 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_regionalHostedZoneId,
    domainName_certificateName,
    domainName_ownershipVerificationCertificateArn,
    domainName_regionalCertificateArn,
    domainName_certificateArn,
    domainName_distributionHostedZoneId,
    domainName_securityPolicy,
    domainName_domainName,
    domainName_mutualTlsAuthentication,
    domainName_regionalCertificateName,
    domainName_regionalDomainName,
    domainName_certificateUploadDate,
    domainName_distributionDomainName,
    domainName_domainNameStatusMessage,
    domainName_endpointConfiguration,
    domainName_domainNameStatus,
    domainName_tags,
  )
where

import Amazonka.APIGateway.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

-- | Request to get the name of a DomainName resource.
--
-- /See:/ 'newGetDomainName' smart constructor.
data GetDomainName = GetDomainName'
  { -- | [Required] The name of the DomainName resource.
    GetDomainName -> Text
domainName :: Prelude.Text
  }
  deriving (GetDomainName -> GetDomainName -> Bool
(GetDomainName -> GetDomainName -> Bool)
-> (GetDomainName -> GetDomainName -> Bool) -> Eq GetDomainName
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]
(Int -> ReadS GetDomainName)
-> ReadS [GetDomainName]
-> ReadPrec GetDomainName
-> ReadPrec [GetDomainName]
-> Read 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
(Int -> GetDomainName -> ShowS)
-> (GetDomainName -> String)
-> ([GetDomainName] -> ShowS)
-> Show GetDomainName
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. GetDomainName -> Rep GetDomainName x)
-> (forall x. Rep GetDomainName x -> GetDomainName)
-> Generic GetDomainName
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' - [Required] The name of the DomainName resource.
newGetDomainName ::
  -- | 'domainName'
  Prelude.Text ->
  GetDomainName
newGetDomainName :: Text -> GetDomainName
newGetDomainName Text
pDomainName_ =
  GetDomainName' :: Text -> GetDomainName
GetDomainName' {$sel:domainName:GetDomainName' :: Text
domainName = Text
pDomainName_}

-- | [Required] The name of the DomainName resource.
getDomainName_domainName :: Lens.Lens' GetDomainName Prelude.Text
getDomainName_domainName :: (Text -> f Text) -> GetDomainName -> f GetDomainName
getDomainName_domainName = (GetDomainName -> Text)
-> (GetDomainName -> Text -> GetDomainName)
-> Lens GetDomainName GetDomainName Text Text
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 :: GetDomainName -> Request GetDomainName
request = Service -> GetDomainName -> Request GetDomainName
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetDomainName
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDomainName)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetDomainName))
-> Logger
-> Service
-> Proxy GetDomainName
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDomainName)))
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 -> Object -> Either String DomainName
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)

instance Prelude.Hashable GetDomainName

instance Prelude.NFData GetDomainName

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

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

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