{-# 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.GetStage
(
GetStage (..),
newGetStage,
getStage_restApiId,
getStage_stageName,
Stage (..),
newStage,
stage_deploymentId,
stage_variables,
stage_accessLogSettings,
stage_documentationVersion,
stage_clientCertificateId,
stage_tracingEnabled,
stage_createdDate,
stage_cacheClusterStatus,
stage_methodSettings,
stage_lastUpdatedDate,
stage_cacheClusterSize,
stage_webAclArn,
stage_canarySettings,
stage_cacheClusterEnabled,
stage_stageName,
stage_description,
stage_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 GetStage = GetStage'
{
GetStage -> Text
restApiId :: Prelude.Text,
GetStage -> Text
stageName :: Prelude.Text
}
deriving (GetStage -> GetStage -> Bool
(GetStage -> GetStage -> Bool)
-> (GetStage -> GetStage -> Bool) -> Eq GetStage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStage -> GetStage -> Bool
$c/= :: GetStage -> GetStage -> Bool
== :: GetStage -> GetStage -> Bool
$c== :: GetStage -> GetStage -> Bool
Prelude.Eq, ReadPrec [GetStage]
ReadPrec GetStage
Int -> ReadS GetStage
ReadS [GetStage]
(Int -> ReadS GetStage)
-> ReadS [GetStage]
-> ReadPrec GetStage
-> ReadPrec [GetStage]
-> Read GetStage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStage]
$creadListPrec :: ReadPrec [GetStage]
readPrec :: ReadPrec GetStage
$creadPrec :: ReadPrec GetStage
readList :: ReadS [GetStage]
$creadList :: ReadS [GetStage]
readsPrec :: Int -> ReadS GetStage
$creadsPrec :: Int -> ReadS GetStage
Prelude.Read, Int -> GetStage -> ShowS
[GetStage] -> ShowS
GetStage -> String
(Int -> GetStage -> ShowS)
-> (GetStage -> String) -> ([GetStage] -> ShowS) -> Show GetStage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStage] -> ShowS
$cshowList :: [GetStage] -> ShowS
show :: GetStage -> String
$cshow :: GetStage -> String
showsPrec :: Int -> GetStage -> ShowS
$cshowsPrec :: Int -> GetStage -> ShowS
Prelude.Show, (forall x. GetStage -> Rep GetStage x)
-> (forall x. Rep GetStage x -> GetStage) -> Generic GetStage
forall x. Rep GetStage x -> GetStage
forall x. GetStage -> Rep GetStage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetStage x -> GetStage
$cfrom :: forall x. GetStage -> Rep GetStage x
Prelude.Generic)
newGetStage ::
Prelude.Text ->
Prelude.Text ->
GetStage
newGetStage :: Text -> Text -> GetStage
newGetStage Text
pRestApiId_ Text
pStageName_ =
GetStage' :: Text -> Text -> GetStage
GetStage'
{ $sel:restApiId:GetStage' :: Text
restApiId = Text
pRestApiId_,
$sel:stageName:GetStage' :: Text
stageName = Text
pStageName_
}
getStage_restApiId :: Lens.Lens' GetStage Prelude.Text
getStage_restApiId :: (Text -> f Text) -> GetStage -> f GetStage
getStage_restApiId = (GetStage -> Text)
-> (GetStage -> Text -> GetStage)
-> Lens GetStage GetStage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStage' {Text
restApiId :: Text
$sel:restApiId:GetStage' :: GetStage -> Text
restApiId} -> Text
restApiId) (\s :: GetStage
s@GetStage' {} Text
a -> GetStage
s {$sel:restApiId:GetStage' :: Text
restApiId = Text
a} :: GetStage)
getStage_stageName :: Lens.Lens' GetStage Prelude.Text
getStage_stageName :: (Text -> f Text) -> GetStage -> f GetStage
getStage_stageName = (GetStage -> Text)
-> (GetStage -> Text -> GetStage)
-> Lens GetStage GetStage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStage' {Text
stageName :: Text
$sel:stageName:GetStage' :: GetStage -> Text
stageName} -> Text
stageName) (\s :: GetStage
s@GetStage' {} Text
a -> GetStage
s {$sel:stageName:GetStage' :: Text
stageName = Text
a} :: GetStage)
instance Core.AWSRequest GetStage where
type AWSResponse GetStage = Stage
request :: GetStage -> Request GetStage
request = Service -> GetStage -> Request GetStage
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetStage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetStage)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetStage))
-> Logger
-> Service
-> Proxy GetStage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetStage)))
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 Stage
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable GetStage
instance Prelude.NFData GetStage
instance Core.ToHeaders GetStage where
toHeaders :: GetStage -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetStage -> 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 GetStage where
toPath :: GetStage -> ByteString
toPath GetStage' {Text
stageName :: Text
restApiId :: Text
$sel:stageName:GetStage' :: GetStage -> Text
$sel:restApiId:GetStage' :: GetStage -> 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,
ByteString
"/stages/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
stageName
]
instance Core.ToQuery GetStage where
toQuery :: GetStage -> QueryString
toQuery = QueryString -> GetStage -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty