{-# 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.ApiGatewayV2.GetModelTemplate
(
GetModelTemplate (..),
newGetModelTemplate,
getModelTemplate_modelId,
getModelTemplate_apiId,
GetModelTemplateResponse (..),
newGetModelTemplateResponse,
getModelTemplateResponse_value,
getModelTemplateResponse_httpStatus,
)
where
import Amazonka.ApiGatewayV2.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 GetModelTemplate = GetModelTemplate'
{
GetModelTemplate -> Text
modelId :: Prelude.Text,
GetModelTemplate -> Text
apiId :: Prelude.Text
}
deriving (GetModelTemplate -> GetModelTemplate -> Bool
(GetModelTemplate -> GetModelTemplate -> Bool)
-> (GetModelTemplate -> GetModelTemplate -> Bool)
-> Eq GetModelTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetModelTemplate -> GetModelTemplate -> Bool
$c/= :: GetModelTemplate -> GetModelTemplate -> Bool
== :: GetModelTemplate -> GetModelTemplate -> Bool
$c== :: GetModelTemplate -> GetModelTemplate -> Bool
Prelude.Eq, ReadPrec [GetModelTemplate]
ReadPrec GetModelTemplate
Int -> ReadS GetModelTemplate
ReadS [GetModelTemplate]
(Int -> ReadS GetModelTemplate)
-> ReadS [GetModelTemplate]
-> ReadPrec GetModelTemplate
-> ReadPrec [GetModelTemplate]
-> Read GetModelTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetModelTemplate]
$creadListPrec :: ReadPrec [GetModelTemplate]
readPrec :: ReadPrec GetModelTemplate
$creadPrec :: ReadPrec GetModelTemplate
readList :: ReadS [GetModelTemplate]
$creadList :: ReadS [GetModelTemplate]
readsPrec :: Int -> ReadS GetModelTemplate
$creadsPrec :: Int -> ReadS GetModelTemplate
Prelude.Read, Int -> GetModelTemplate -> ShowS
[GetModelTemplate] -> ShowS
GetModelTemplate -> String
(Int -> GetModelTemplate -> ShowS)
-> (GetModelTemplate -> String)
-> ([GetModelTemplate] -> ShowS)
-> Show GetModelTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetModelTemplate] -> ShowS
$cshowList :: [GetModelTemplate] -> ShowS
show :: GetModelTemplate -> String
$cshow :: GetModelTemplate -> String
showsPrec :: Int -> GetModelTemplate -> ShowS
$cshowsPrec :: Int -> GetModelTemplate -> ShowS
Prelude.Show, (forall x. GetModelTemplate -> Rep GetModelTemplate x)
-> (forall x. Rep GetModelTemplate x -> GetModelTemplate)
-> Generic GetModelTemplate
forall x. Rep GetModelTemplate x -> GetModelTemplate
forall x. GetModelTemplate -> Rep GetModelTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetModelTemplate x -> GetModelTemplate
$cfrom :: forall x. GetModelTemplate -> Rep GetModelTemplate x
Prelude.Generic)
newGetModelTemplate ::
Prelude.Text ->
Prelude.Text ->
GetModelTemplate
newGetModelTemplate :: Text -> Text -> GetModelTemplate
newGetModelTemplate Text
pModelId_ Text
pApiId_ =
GetModelTemplate' :: Text -> Text -> GetModelTemplate
GetModelTemplate'
{ $sel:modelId:GetModelTemplate' :: Text
modelId = Text
pModelId_,
$sel:apiId:GetModelTemplate' :: Text
apiId = Text
pApiId_
}
getModelTemplate_modelId :: Lens.Lens' GetModelTemplate Prelude.Text
getModelTemplate_modelId :: (Text -> f Text) -> GetModelTemplate -> f GetModelTemplate
getModelTemplate_modelId = (GetModelTemplate -> Text)
-> (GetModelTemplate -> Text -> GetModelTemplate)
-> Lens GetModelTemplate GetModelTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetModelTemplate' {Text
modelId :: Text
$sel:modelId:GetModelTemplate' :: GetModelTemplate -> Text
modelId} -> Text
modelId) (\s :: GetModelTemplate
s@GetModelTemplate' {} Text
a -> GetModelTemplate
s {$sel:modelId:GetModelTemplate' :: Text
modelId = Text
a} :: GetModelTemplate)
getModelTemplate_apiId :: Lens.Lens' GetModelTemplate Prelude.Text
getModelTemplate_apiId :: (Text -> f Text) -> GetModelTemplate -> f GetModelTemplate
getModelTemplate_apiId = (GetModelTemplate -> Text)
-> (GetModelTemplate -> Text -> GetModelTemplate)
-> Lens GetModelTemplate GetModelTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetModelTemplate' {Text
apiId :: Text
$sel:apiId:GetModelTemplate' :: GetModelTemplate -> Text
apiId} -> Text
apiId) (\s :: GetModelTemplate
s@GetModelTemplate' {} Text
a -> GetModelTemplate
s {$sel:apiId:GetModelTemplate' :: Text
apiId = Text
a} :: GetModelTemplate)
instance Core.AWSRequest GetModelTemplate where
type
AWSResponse GetModelTemplate =
GetModelTemplateResponse
request :: GetModelTemplate -> Request GetModelTemplate
request = Service -> GetModelTemplate -> Request GetModelTemplate
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetModelTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetModelTemplate)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetModelTemplate))
-> Logger
-> Service
-> Proxy GetModelTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetModelTemplate)))
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 ->
Maybe Text -> Int -> GetModelTemplateResponse
GetModelTemplateResponse'
(Maybe Text -> Int -> GetModelTemplateResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetModelTemplateResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"value")
Either String (Int -> GetModelTemplateResponse)
-> Either String Int -> Either String GetModelTemplateResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetModelTemplate
instance Prelude.NFData GetModelTemplate
instance Core.ToHeaders GetModelTemplate where
toHeaders :: GetModelTemplate -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetModelTemplate -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToPath GetModelTemplate where
toPath :: GetModelTemplate -> ByteString
toPath GetModelTemplate' {Text
apiId :: Text
modelId :: Text
$sel:apiId:GetModelTemplate' :: GetModelTemplate -> Text
$sel:modelId:GetModelTemplate' :: GetModelTemplate -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/v2/apis/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
apiId,
ByteString
"/models/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
modelId,
ByteString
"/template"
]
instance Core.ToQuery GetModelTemplate where
toQuery :: GetModelTemplate -> QueryString
toQuery = QueryString -> GetModelTemplate -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetModelTemplateResponse = GetModelTemplateResponse'
{
GetModelTemplateResponse -> Maybe Text
value :: Prelude.Maybe Prelude.Text,
GetModelTemplateResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetModelTemplateResponse -> GetModelTemplateResponse -> Bool
(GetModelTemplateResponse -> GetModelTemplateResponse -> Bool)
-> (GetModelTemplateResponse -> GetModelTemplateResponse -> Bool)
-> Eq GetModelTemplateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetModelTemplateResponse -> GetModelTemplateResponse -> Bool
$c/= :: GetModelTemplateResponse -> GetModelTemplateResponse -> Bool
== :: GetModelTemplateResponse -> GetModelTemplateResponse -> Bool
$c== :: GetModelTemplateResponse -> GetModelTemplateResponse -> Bool
Prelude.Eq, ReadPrec [GetModelTemplateResponse]
ReadPrec GetModelTemplateResponse
Int -> ReadS GetModelTemplateResponse
ReadS [GetModelTemplateResponse]
(Int -> ReadS GetModelTemplateResponse)
-> ReadS [GetModelTemplateResponse]
-> ReadPrec GetModelTemplateResponse
-> ReadPrec [GetModelTemplateResponse]
-> Read GetModelTemplateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetModelTemplateResponse]
$creadListPrec :: ReadPrec [GetModelTemplateResponse]
readPrec :: ReadPrec GetModelTemplateResponse
$creadPrec :: ReadPrec GetModelTemplateResponse
readList :: ReadS [GetModelTemplateResponse]
$creadList :: ReadS [GetModelTemplateResponse]
readsPrec :: Int -> ReadS GetModelTemplateResponse
$creadsPrec :: Int -> ReadS GetModelTemplateResponse
Prelude.Read, Int -> GetModelTemplateResponse -> ShowS
[GetModelTemplateResponse] -> ShowS
GetModelTemplateResponse -> String
(Int -> GetModelTemplateResponse -> ShowS)
-> (GetModelTemplateResponse -> String)
-> ([GetModelTemplateResponse] -> ShowS)
-> Show GetModelTemplateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetModelTemplateResponse] -> ShowS
$cshowList :: [GetModelTemplateResponse] -> ShowS
show :: GetModelTemplateResponse -> String
$cshow :: GetModelTemplateResponse -> String
showsPrec :: Int -> GetModelTemplateResponse -> ShowS
$cshowsPrec :: Int -> GetModelTemplateResponse -> ShowS
Prelude.Show, (forall x.
GetModelTemplateResponse -> Rep GetModelTemplateResponse x)
-> (forall x.
Rep GetModelTemplateResponse x -> GetModelTemplateResponse)
-> Generic GetModelTemplateResponse
forall x.
Rep GetModelTemplateResponse x -> GetModelTemplateResponse
forall x.
GetModelTemplateResponse -> Rep GetModelTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetModelTemplateResponse x -> GetModelTemplateResponse
$cfrom :: forall x.
GetModelTemplateResponse -> Rep GetModelTemplateResponse x
Prelude.Generic)
newGetModelTemplateResponse ::
Prelude.Int ->
GetModelTemplateResponse
newGetModelTemplateResponse :: Int -> GetModelTemplateResponse
newGetModelTemplateResponse Int
pHttpStatus_ =
GetModelTemplateResponse' :: Maybe Text -> Int -> GetModelTemplateResponse
GetModelTemplateResponse'
{ $sel:value:GetModelTemplateResponse' :: Maybe Text
value = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetModelTemplateResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getModelTemplateResponse_value :: Lens.Lens' GetModelTemplateResponse (Prelude.Maybe Prelude.Text)
getModelTemplateResponse_value :: (Maybe Text -> f (Maybe Text))
-> GetModelTemplateResponse -> f GetModelTemplateResponse
getModelTemplateResponse_value = (GetModelTemplateResponse -> Maybe Text)
-> (GetModelTemplateResponse
-> Maybe Text -> GetModelTemplateResponse)
-> Lens
GetModelTemplateResponse
GetModelTemplateResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetModelTemplateResponse' {Maybe Text
value :: Maybe Text
$sel:value:GetModelTemplateResponse' :: GetModelTemplateResponse -> Maybe Text
value} -> Maybe Text
value) (\s :: GetModelTemplateResponse
s@GetModelTemplateResponse' {} Maybe Text
a -> GetModelTemplateResponse
s {$sel:value:GetModelTemplateResponse' :: Maybe Text
value = Maybe Text
a} :: GetModelTemplateResponse)
getModelTemplateResponse_httpStatus :: Lens.Lens' GetModelTemplateResponse Prelude.Int
getModelTemplateResponse_httpStatus :: (Int -> f Int)
-> GetModelTemplateResponse -> f GetModelTemplateResponse
getModelTemplateResponse_httpStatus = (GetModelTemplateResponse -> Int)
-> (GetModelTemplateResponse -> Int -> GetModelTemplateResponse)
-> Lens GetModelTemplateResponse GetModelTemplateResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetModelTemplateResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetModelTemplateResponse' :: GetModelTemplateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetModelTemplateResponse
s@GetModelTemplateResponse' {} Int
a -> GetModelTemplateResponse
s {$sel:httpStatus:GetModelTemplateResponse' :: Int
httpStatus = Int
a} :: GetModelTemplateResponse)
instance Prelude.NFData GetModelTemplateResponse