{-# 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_apiKeyRequired,
method_authorizationScopes,
method_authorizationType,
method_authorizerId,
method_httpMethod,
method_methodIntegration,
method_methodResponses,
method_operationName,
method_requestModels,
method_requestParameters,
method_requestValidatorId,
)
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 GetMethod = GetMethod'
{
GetMethod -> Text
restApiId :: Prelude.Text,
GetMethod -> Text
resourceId :: Prelude.Text,
GetMethod -> Text
httpMethod :: Prelude.Text
}
deriving (GetMethod -> GetMethod -> Bool
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]
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
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. 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'
{ $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 :: Lens' GetMethod Text
getMethod_restApiId = 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 :: Lens' GetMethod Text
getMethod_resourceId = 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 :: Lens' GetMethod Text
getMethod_httpMethod = 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 :: (Service -> Service) -> GetMethod -> Request GetMethod
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 GetMethod
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMethod)))
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 GetMethod where
hashWithSalt :: Int -> GetMethod -> Int
hashWithSalt Int
_salt GetMethod' {Text
httpMethod :: Text
resourceId :: Text
restApiId :: Text
$sel:httpMethod:GetMethod' :: GetMethod -> Text
$sel:resourceId:GetMethod' :: GetMethod -> Text
$sel:restApiId:GetMethod' :: GetMethod -> 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
instance Prelude.NFData GetMethod where
rnf :: GetMethod -> ()
rnf GetMethod' {Text
httpMethod :: Text
resourceId :: Text
restApiId :: Text
$sel:httpMethod:GetMethod' :: GetMethod -> Text
$sel:resourceId:GetMethod' :: GetMethod -> Text
$sel:restApiId:GetMethod' :: GetMethod -> 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
instance Data.ToHeaders GetMethod where
toHeaders :: GetMethod -> 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 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
..} =
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
]
instance Data.ToQuery GetMethod where
toQuery :: GetMethod -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty