{-# 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_responseParameters,
methodResponse_statusCode,
)
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
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
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]
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
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. 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'
{ $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 :: Lens' GetMethodResponse Text
getMethodResponse_restApiId = 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 :: Lens' GetMethodResponse Text
getMethodResponse_resourceId = 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 :: Lens' GetMethodResponse Text
getMethodResponse_httpMethod = 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 :: Lens' GetMethodResponse Text
getMethodResponse_statusCode = 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 :: (Service -> Service)
-> GetMethodResponse -> Request GetMethodResponse
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 GetMethodResponse
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetMethodResponse)))
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 GetMethodResponse where
hashWithSalt :: Int -> GetMethodResponse -> Int
hashWithSalt Int
_salt 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
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
restApiId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
httpMethod
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
statusCode
instance Prelude.NFData GetMethodResponse where
rnf :: GetMethodResponse -> ()
rnf 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
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
restApiId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resourceId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
httpMethod
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
statusCode
instance Data.ToHeaders GetMethodResponse where
toHeaders :: GetMethodResponse -> 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 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
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/restapis/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
restApiId,
ByteString
"/resources/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
resourceId,
ByteString
"/methods/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
httpMethod,
ByteString
"/responses/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
statusCode
]
instance Data.ToQuery GetMethodResponse where
toQuery :: GetMethodResponse -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty