{-# 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.GetMethod
(
GetMethod (..),
newGetMethod,
getMethod_restApiId,
getMethod_resourceId,
getMethod_httpMethod,
Method (..),
newMethod,
method_methodResponses,
method_httpMethod,
method_authorizationScopes,
method_requestValidatorId,
method_requestModels,
method_requestParameters,
method_authorizerId,
method_operationName,
method_authorizationType,
method_apiKeyRequired,
method_methodIntegration,
)
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 GetMethod = GetMethod'
{
GetMethod -> Text
restApiId :: Prelude.Text,
GetMethod -> Text
resourceId :: Prelude.Text,
GetMethod -> Text
httpMethod :: Prelude.Text
}
deriving (GetMethod -> GetMethod -> Bool
(GetMethod -> GetMethod -> Bool)
-> (GetMethod -> GetMethod -> Bool) -> Eq GetMethod
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMethod -> GetMethod -> Bool
$c/= :: GetMethod -> GetMethod -> Bool
== :: GetMethod -> GetMethod -> Bool
$c== :: GetMethod -> GetMethod -> Bool
Prelude.Eq, ReadPrec [GetMethod]
ReadPrec GetMethod
Int -> ReadS GetMethod
ReadS [GetMethod]
(Int -> ReadS GetMethod)
-> ReadS [GetMethod]
-> ReadPrec GetMethod
-> ReadPrec [GetMethod]
-> Read GetMethod
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMethod]
$creadListPrec :: ReadPrec [GetMethod]
readPrec :: ReadPrec GetMethod
$creadPrec :: ReadPrec GetMethod
readList :: ReadS [GetMethod]
$creadList :: ReadS [GetMethod]
readsPrec :: Int -> ReadS GetMethod
$creadsPrec :: Int -> ReadS GetMethod
Prelude.Read, Int -> GetMethod -> ShowS
[GetMethod] -> ShowS
GetMethod -> String
(Int -> GetMethod -> ShowS)
-> (GetMethod -> String)
-> ([GetMethod] -> ShowS)
-> Show GetMethod
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMethod] -> ShowS
$cshowList :: [GetMethod] -> ShowS
show :: GetMethod -> String
$cshow :: GetMethod -> String
showsPrec :: Int -> GetMethod -> ShowS
$cshowsPrec :: Int -> GetMethod -> ShowS
Prelude.Show, (forall x. GetMethod -> Rep GetMethod x)
-> (forall x. Rep GetMethod x -> GetMethod) -> Generic GetMethod
forall x. Rep GetMethod x -> GetMethod
forall x. GetMethod -> Rep GetMethod x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMethod x -> GetMethod
$cfrom :: forall x. GetMethod -> Rep GetMethod x
Prelude.Generic)
newGetMethod ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
GetMethod
newGetMethod :: Text -> Text -> Text -> GetMethod
newGetMethod Text
pRestApiId_ Text
pResourceId_ Text
pHttpMethod_ =
GetMethod' :: Text -> Text -> Text -> GetMethod
GetMethod'
{ $sel:restApiId:GetMethod' :: Text
restApiId = Text
pRestApiId_,
$sel:resourceId:GetMethod' :: Text
resourceId = Text
pResourceId_,
$sel:httpMethod:GetMethod' :: Text
httpMethod = Text
pHttpMethod_
}
getMethod_restApiId :: Lens.Lens' GetMethod Prelude.Text
getMethod_restApiId :: (Text -> f Text) -> GetMethod -> f GetMethod
getMethod_restApiId = (GetMethod -> Text)
-> (GetMethod -> Text -> GetMethod)
-> Lens GetMethod GetMethod Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMethod' {Text
restApiId :: Text
$sel:restApiId:GetMethod' :: GetMethod -> Text
restApiId} -> Text
restApiId) (\s :: GetMethod
s@GetMethod' {} Text
a -> GetMethod
s {$sel:restApiId:GetMethod' :: Text
restApiId = Text
a} :: GetMethod)
getMethod_resourceId :: Lens.Lens' GetMethod Prelude.Text
getMethod_resourceId :: (Text -> f Text) -> GetMethod -> f GetMethod
getMethod_resourceId = (GetMethod -> Text)
-> (GetMethod -> Text -> GetMethod)
-> Lens GetMethod GetMethod Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMethod' {Text
resourceId :: Text
$sel:resourceId:GetMethod' :: GetMethod -> Text
resourceId} -> Text
resourceId) (\s :: GetMethod
s@GetMethod' {} Text
a -> GetMethod
s {$sel:resourceId:GetMethod' :: Text
resourceId = Text
a} :: GetMethod)
getMethod_httpMethod :: Lens.Lens' GetMethod Prelude.Text
getMethod_httpMethod :: (Text -> f Text) -> GetMethod -> f GetMethod
getMethod_httpMethod = (GetMethod -> Text)
-> (GetMethod -> Text -> GetMethod)
-> Lens GetMethod GetMethod Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMethod' {Text
httpMethod :: Text
$sel:httpMethod:GetMethod' :: GetMethod -> Text
httpMethod} -> Text
httpMethod) (\s :: GetMethod
s@GetMethod' {} Text
a -> GetMethod
s {$sel:httpMethod:GetMethod' :: Text
httpMethod = Text
a} :: GetMethod)
instance Core.AWSRequest GetMethod where
type AWSResponse GetMethod = Method
request :: GetMethod -> Request GetMethod
request = Service -> GetMethod -> Request GetMethod
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetMethod
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMethod)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetMethod))
-> Logger
-> Service
-> Proxy GetMethod
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMethod)))
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 Method
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable GetMethod
instance Prelude.NFData GetMethod
instance Core.ToHeaders GetMethod where
toHeaders :: GetMethod -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetMethod -> 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 GetMethod where
toPath :: GetMethod -> ByteString
toPath GetMethod' {Text
httpMethod :: Text
resourceId :: Text
restApiId :: Text
$sel:httpMethod:GetMethod' :: GetMethod -> Text
$sel:resourceId:GetMethod' :: GetMethod -> Text
$sel:restApiId:GetMethod' :: GetMethod -> 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
]
instance Core.ToQuery GetMethod where
toQuery :: GetMethod -> QueryString
toQuery = QueryString -> GetMethod -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty