{-# 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.GetMethodResponse
(
GetMethodResponse (..),
newGetMethodResponse,
getMethodResponse_restApiId,
getMethodResponse_resourceId,
getMethodResponse_httpMethod,
getMethodResponse_statusCode,
MethodResponse (..),
newMethodResponse,
methodResponse_responseModels,
methodResponse_statusCode,
methodResponse_responseParameters,
)
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 GetMethodResponse = GetMethodResponse'
{
GetMethodResponse -> Text
restApiId :: Prelude.Text,
GetMethodResponse -> Text
resourceId :: Prelude.Text,
GetMethodResponse -> Text
httpMethod :: Prelude.Text,
GetMethodResponse -> Text
statusCode :: Prelude.Text
}
deriving (GetMethodResponse -> GetMethodResponse -> Bool
(GetMethodResponse -> GetMethodResponse -> Bool)
-> (GetMethodResponse -> GetMethodResponse -> Bool)
-> Eq GetMethodResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMethodResponse -> GetMethodResponse -> Bool
$c/= :: GetMethodResponse -> GetMethodResponse -> Bool
== :: GetMethodResponse -> GetMethodResponse -> Bool
$c== :: GetMethodResponse -> GetMethodResponse -> Bool
Prelude.Eq, ReadPrec [GetMethodResponse]
ReadPrec GetMethodResponse
Int -> ReadS GetMethodResponse
ReadS [GetMethodResponse]
(Int -> ReadS GetMethodResponse)
-> ReadS [GetMethodResponse]
-> ReadPrec GetMethodResponse
-> ReadPrec [GetMethodResponse]
-> Read GetMethodResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMethodResponse]
$creadListPrec :: ReadPrec [GetMethodResponse]
readPrec :: ReadPrec GetMethodResponse
$creadPrec :: ReadPrec GetMethodResponse
readList :: ReadS [GetMethodResponse]
$creadList :: ReadS [GetMethodResponse]
readsPrec :: Int -> ReadS GetMethodResponse
$creadsPrec :: Int -> ReadS GetMethodResponse
Prelude.Read, Int -> GetMethodResponse -> ShowS
[GetMethodResponse] -> ShowS
GetMethodResponse -> String
(Int -> GetMethodResponse -> ShowS)
-> (GetMethodResponse -> String)
-> ([GetMethodResponse] -> ShowS)
-> Show GetMethodResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMethodResponse] -> ShowS
$cshowList :: [GetMethodResponse] -> ShowS
show :: GetMethodResponse -> String
$cshow :: GetMethodResponse -> String
showsPrec :: Int -> GetMethodResponse -> ShowS
$cshowsPrec :: Int -> GetMethodResponse -> ShowS
Prelude.Show, (forall x. GetMethodResponse -> Rep GetMethodResponse x)
-> (forall x. Rep GetMethodResponse x -> GetMethodResponse)
-> Generic GetMethodResponse
forall x. Rep GetMethodResponse x -> GetMethodResponse
forall x. GetMethodResponse -> Rep GetMethodResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMethodResponse x -> GetMethodResponse
$cfrom :: forall x. GetMethodResponse -> Rep GetMethodResponse x
Prelude.Generic)
newGetMethodResponse ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
GetMethodResponse
newGetMethodResponse :: Text -> Text -> Text -> Text -> GetMethodResponse
newGetMethodResponse
Text
pRestApiId_
Text
pResourceId_
Text
pHttpMethod_
Text
pStatusCode_ =
GetMethodResponse' :: Text -> Text -> Text -> Text -> GetMethodResponse
GetMethodResponse'
{ $sel:restApiId:GetMethodResponse' :: Text
restApiId = Text
pRestApiId_,
$sel:resourceId:GetMethodResponse' :: Text
resourceId = Text
pResourceId_,
$sel:httpMethod:GetMethodResponse' :: Text
httpMethod = Text
pHttpMethod_,
$sel:statusCode:GetMethodResponse' :: Text
statusCode = Text
pStatusCode_
}
getMethodResponse_restApiId :: Lens.Lens' GetMethodResponse Prelude.Text
getMethodResponse_restApiId :: (Text -> f Text) -> GetMethodResponse -> f GetMethodResponse
getMethodResponse_restApiId = (GetMethodResponse -> Text)
-> (GetMethodResponse -> Text -> GetMethodResponse)
-> Lens GetMethodResponse GetMethodResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMethodResponse' {Text
restApiId :: Text
$sel:restApiId:GetMethodResponse' :: GetMethodResponse -> Text
restApiId} -> Text
restApiId) (\s :: GetMethodResponse
s@GetMethodResponse' {} Text
a -> GetMethodResponse
s {$sel:restApiId:GetMethodResponse' :: Text
restApiId = Text
a} :: GetMethodResponse)
getMethodResponse_resourceId :: Lens.Lens' GetMethodResponse Prelude.Text
getMethodResponse_resourceId :: (Text -> f Text) -> GetMethodResponse -> f GetMethodResponse
getMethodResponse_resourceId = (GetMethodResponse -> Text)
-> (GetMethodResponse -> Text -> GetMethodResponse)
-> Lens GetMethodResponse GetMethodResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMethodResponse' {Text
resourceId :: Text
$sel:resourceId:GetMethodResponse' :: GetMethodResponse -> Text
resourceId} -> Text
resourceId) (\s :: GetMethodResponse
s@GetMethodResponse' {} Text
a -> GetMethodResponse
s {$sel:resourceId:GetMethodResponse' :: Text
resourceId = Text
a} :: GetMethodResponse)
getMethodResponse_httpMethod :: Lens.Lens' GetMethodResponse Prelude.Text
getMethodResponse_httpMethod :: (Text -> f Text) -> GetMethodResponse -> f GetMethodResponse
getMethodResponse_httpMethod = (GetMethodResponse -> Text)
-> (GetMethodResponse -> Text -> GetMethodResponse)
-> Lens GetMethodResponse GetMethodResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMethodResponse' {Text
httpMethod :: Text
$sel:httpMethod:GetMethodResponse' :: GetMethodResponse -> Text
httpMethod} -> Text
httpMethod) (\s :: GetMethodResponse
s@GetMethodResponse' {} Text
a -> GetMethodResponse
s {$sel:httpMethod:GetMethodResponse' :: Text
httpMethod = Text
a} :: GetMethodResponse)
getMethodResponse_statusCode :: Lens.Lens' GetMethodResponse Prelude.Text
getMethodResponse_statusCode :: (Text -> f Text) -> GetMethodResponse -> f GetMethodResponse
getMethodResponse_statusCode = (GetMethodResponse -> Text)
-> (GetMethodResponse -> Text -> GetMethodResponse)
-> Lens GetMethodResponse GetMethodResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMethodResponse' {Text
statusCode :: Text
$sel:statusCode:GetMethodResponse' :: GetMethodResponse -> Text
statusCode} -> Text
statusCode) (\s :: GetMethodResponse
s@GetMethodResponse' {} Text
a -> GetMethodResponse
s {$sel:statusCode:GetMethodResponse' :: Text
statusCode = Text
a} :: GetMethodResponse)
instance Core.AWSRequest GetMethodResponse where
type AWSResponse GetMethodResponse = MethodResponse
request :: GetMethodResponse -> Request GetMethodResponse
request = Service -> GetMethodResponse -> Request GetMethodResponse
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetMethodResponse
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetMethodResponse)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetMethodResponse))
-> Logger
-> Service
-> Proxy GetMethodResponse
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetMethodResponse)))
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 MethodResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable GetMethodResponse
instance Prelude.NFData GetMethodResponse
instance Core.ToHeaders GetMethodResponse where
toHeaders :: GetMethodResponse -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetMethodResponse -> 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 GetMethodResponse where
toPath :: GetMethodResponse -> ByteString
toPath GetMethodResponse' {Text
statusCode :: Text
httpMethod :: Text
resourceId :: Text
restApiId :: Text
$sel:statusCode:GetMethodResponse' :: GetMethodResponse -> Text
$sel:httpMethod:GetMethodResponse' :: GetMethodResponse -> Text
$sel:resourceId:GetMethodResponse' :: GetMethodResponse -> Text
$sel:restApiId:GetMethodResponse' :: GetMethodResponse -> 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
"/resources/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
resourceId,
ByteString
"/methods/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
httpMethod,
ByteString
"/responses/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
statusCode
]
instance Core.ToQuery GetMethodResponse where
toQuery :: GetMethodResponse -> QueryString
toQuery = QueryString -> GetMethodResponse -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty