{-# 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.GetModel
(
GetModel (..),
newGetModel,
getModel_flatten,
getModel_restApiId,
getModel_modelName,
Model (..),
newModel,
model_schema,
model_name,
model_id,
model_description,
model_contentType,
)
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 GetModel = GetModel'
{
GetModel -> Maybe Bool
flatten :: Prelude.Maybe Prelude.Bool,
GetModel -> Text
restApiId :: Prelude.Text,
GetModel -> Text
modelName :: Prelude.Text
}
deriving (GetModel -> GetModel -> Bool
(GetModel -> GetModel -> Bool)
-> (GetModel -> GetModel -> Bool) -> Eq GetModel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetModel -> GetModel -> Bool
$c/= :: GetModel -> GetModel -> Bool
== :: GetModel -> GetModel -> Bool
$c== :: GetModel -> GetModel -> Bool
Prelude.Eq, ReadPrec [GetModel]
ReadPrec GetModel
Int -> ReadS GetModel
ReadS [GetModel]
(Int -> ReadS GetModel)
-> ReadS [GetModel]
-> ReadPrec GetModel
-> ReadPrec [GetModel]
-> Read GetModel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetModel]
$creadListPrec :: ReadPrec [GetModel]
readPrec :: ReadPrec GetModel
$creadPrec :: ReadPrec GetModel
readList :: ReadS [GetModel]
$creadList :: ReadS [GetModel]
readsPrec :: Int -> ReadS GetModel
$creadsPrec :: Int -> ReadS GetModel
Prelude.Read, Int -> GetModel -> ShowS
[GetModel] -> ShowS
GetModel -> String
(Int -> GetModel -> ShowS)
-> (GetModel -> String) -> ([GetModel] -> ShowS) -> Show GetModel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetModel] -> ShowS
$cshowList :: [GetModel] -> ShowS
show :: GetModel -> String
$cshow :: GetModel -> String
showsPrec :: Int -> GetModel -> ShowS
$cshowsPrec :: Int -> GetModel -> ShowS
Prelude.Show, (forall x. GetModel -> Rep GetModel x)
-> (forall x. Rep GetModel x -> GetModel) -> Generic GetModel
forall x. Rep GetModel x -> GetModel
forall x. GetModel -> Rep GetModel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetModel x -> GetModel
$cfrom :: forall x. GetModel -> Rep GetModel x
Prelude.Generic)
newGetModel ::
Prelude.Text ->
Prelude.Text ->
GetModel
newGetModel :: Text -> Text -> GetModel
newGetModel Text
pRestApiId_ Text
pModelName_ =
GetModel' :: Maybe Bool -> Text -> Text -> GetModel
GetModel'
{ $sel:flatten:GetModel' :: Maybe Bool
flatten = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:restApiId:GetModel' :: Text
restApiId = Text
pRestApiId_,
$sel:modelName:GetModel' :: Text
modelName = Text
pModelName_
}
getModel_flatten :: Lens.Lens' GetModel (Prelude.Maybe Prelude.Bool)
getModel_flatten :: (Maybe Bool -> f (Maybe Bool)) -> GetModel -> f GetModel
getModel_flatten = (GetModel -> Maybe Bool)
-> (GetModel -> Maybe Bool -> GetModel)
-> Lens GetModel GetModel (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetModel' {Maybe Bool
flatten :: Maybe Bool
$sel:flatten:GetModel' :: GetModel -> Maybe Bool
flatten} -> Maybe Bool
flatten) (\s :: GetModel
s@GetModel' {} Maybe Bool
a -> GetModel
s {$sel:flatten:GetModel' :: Maybe Bool
flatten = Maybe Bool
a} :: GetModel)
getModel_restApiId :: Lens.Lens' GetModel Prelude.Text
getModel_restApiId :: (Text -> f Text) -> GetModel -> f GetModel
getModel_restApiId = (GetModel -> Text)
-> (GetModel -> Text -> GetModel)
-> Lens GetModel GetModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetModel' {Text
restApiId :: Text
$sel:restApiId:GetModel' :: GetModel -> Text
restApiId} -> Text
restApiId) (\s :: GetModel
s@GetModel' {} Text
a -> GetModel
s {$sel:restApiId:GetModel' :: Text
restApiId = Text
a} :: GetModel)
getModel_modelName :: Lens.Lens' GetModel Prelude.Text
getModel_modelName :: (Text -> f Text) -> GetModel -> f GetModel
getModel_modelName = (GetModel -> Text)
-> (GetModel -> Text -> GetModel)
-> Lens GetModel GetModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetModel' {Text
modelName :: Text
$sel:modelName:GetModel' :: GetModel -> Text
modelName} -> Text
modelName) (\s :: GetModel
s@GetModel' {} Text
a -> GetModel
s {$sel:modelName:GetModel' :: Text
modelName = Text
a} :: GetModel)
instance Core.AWSRequest GetModel where
type AWSResponse GetModel = Model
request :: GetModel -> Request GetModel
request = Service -> GetModel -> Request GetModel
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetModel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetModel)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetModel))
-> Logger
-> Service
-> Proxy GetModel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetModel)))
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 Model
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable GetModel
instance Prelude.NFData GetModel
instance Core.ToHeaders GetModel where
toHeaders :: GetModel -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetModel -> 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 GetModel where
toPath :: GetModel -> ByteString
toPath GetModel' {Maybe Bool
Text
modelName :: Text
restApiId :: Text
flatten :: Maybe Bool
$sel:modelName:GetModel' :: GetModel -> Text
$sel:restApiId:GetModel' :: GetModel -> Text
$sel:flatten:GetModel' :: GetModel -> Maybe Bool
..} =
[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
"/models/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
modelName
]
instance Core.ToQuery GetModel where
toQuery :: GetModel -> QueryString
toQuery GetModel' {Maybe Bool
Text
modelName :: Text
restApiId :: Text
flatten :: Maybe Bool
$sel:modelName:GetModel' :: GetModel -> Text
$sel:restApiId:GetModel' :: GetModel -> Text
$sel:flatten:GetModel' :: GetModel -> Maybe Bool
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"flatten" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
flatten]