{-# 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 #-}
module Amazonka.APIGateway.GetRestApi
(
GetRestApi (..),
newGetRestApi,
getRestApi_restApiId,
RestApi (..),
newRestApi,
restApi_minimumCompressionSize,
restApi_disableExecuteApiEndpoint,
restApi_binaryMediaTypes,
restApi_warnings,
restApi_createdDate,
restApi_name,
restApi_version,
restApi_apiKeySource,
restApi_id,
restApi_policy,
restApi_endpointConfiguration,
restApi_description,
restApi_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
data GetRestApi = GetRestApi'
{
GetRestApi -> Text
restApiId :: Prelude.Text
}
deriving (GetRestApi -> GetRestApi -> Bool
(GetRestApi -> GetRestApi -> Bool)
-> (GetRestApi -> GetRestApi -> Bool) -> Eq GetRestApi
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRestApi -> GetRestApi -> Bool
$c/= :: GetRestApi -> GetRestApi -> Bool
== :: GetRestApi -> GetRestApi -> Bool
$c== :: GetRestApi -> GetRestApi -> Bool
Prelude.Eq, ReadPrec [GetRestApi]
ReadPrec GetRestApi
Int -> ReadS GetRestApi
ReadS [GetRestApi]
(Int -> ReadS GetRestApi)
-> ReadS [GetRestApi]
-> ReadPrec GetRestApi
-> ReadPrec [GetRestApi]
-> Read GetRestApi
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRestApi]
$creadListPrec :: ReadPrec [GetRestApi]
readPrec :: ReadPrec GetRestApi
$creadPrec :: ReadPrec GetRestApi
readList :: ReadS [GetRestApi]
$creadList :: ReadS [GetRestApi]
readsPrec :: Int -> ReadS GetRestApi
$creadsPrec :: Int -> ReadS GetRestApi
Prelude.Read, Int -> GetRestApi -> ShowS
[GetRestApi] -> ShowS
GetRestApi -> String
(Int -> GetRestApi -> ShowS)
-> (GetRestApi -> String)
-> ([GetRestApi] -> ShowS)
-> Show GetRestApi
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRestApi] -> ShowS
$cshowList :: [GetRestApi] -> ShowS
show :: GetRestApi -> String
$cshow :: GetRestApi -> String
showsPrec :: Int -> GetRestApi -> ShowS
$cshowsPrec :: Int -> GetRestApi -> ShowS
Prelude.Show, (forall x. GetRestApi -> Rep GetRestApi x)
-> (forall x. Rep GetRestApi x -> GetRestApi) -> Generic GetRestApi
forall x. Rep GetRestApi x -> GetRestApi
forall x. GetRestApi -> Rep GetRestApi x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRestApi x -> GetRestApi
$cfrom :: forall x. GetRestApi -> Rep GetRestApi x
Prelude.Generic)
newGetRestApi ::
Prelude.Text ->
GetRestApi
newGetRestApi :: Text -> GetRestApi
newGetRestApi Text
pRestApiId_ =
GetRestApi' :: Text -> GetRestApi
GetRestApi' {$sel:restApiId:GetRestApi' :: Text
restApiId = Text
pRestApiId_}
getRestApi_restApiId :: Lens.Lens' GetRestApi Prelude.Text
getRestApi_restApiId :: (Text -> f Text) -> GetRestApi -> f GetRestApi
getRestApi_restApiId = (GetRestApi -> Text)
-> (GetRestApi -> Text -> GetRestApi)
-> Lens GetRestApi GetRestApi Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRestApi' {Text
restApiId :: Text
$sel:restApiId:GetRestApi' :: GetRestApi -> Text
restApiId} -> Text
restApiId) (\s :: GetRestApi
s@GetRestApi' {} Text
a -> GetRestApi
s {$sel:restApiId:GetRestApi' :: Text
restApiId = Text
a} :: GetRestApi)
instance Core.AWSRequest GetRestApi where
type AWSResponse GetRestApi = RestApi
request :: GetRestApi -> Request GetRestApi
request = Service -> GetRestApi -> Request GetRestApi
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetRestApi
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRestApi)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetRestApi))
-> Logger
-> Service
-> Proxy GetRestApi
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRestApi)))
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 RestApi
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable GetRestApi
instance Prelude.NFData GetRestApi
instance Core.ToHeaders GetRestApi where
toHeaders :: GetRestApi -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetRestApi -> 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 GetRestApi where
toPath :: GetRestApi -> ByteString
toPath GetRestApi' {Text
restApiId :: Text
$sel:restApiId:GetRestApi' :: GetRestApi -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/restapis/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
restApiId]
instance Core.ToQuery GetRestApi where
toQuery :: GetRestApi -> QueryString
toQuery = QueryString -> GetRestApi -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty