{-# 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.AmplifyBackend.GetBackendAPIModels
(
GetBackendAPIModels (..),
newGetBackendAPIModels,
getBackendAPIModels_appId,
getBackendAPIModels_backendEnvironmentName,
getBackendAPIModels_resourceName,
GetBackendAPIModelsResponse (..),
newGetBackendAPIModelsResponse,
getBackendAPIModelsResponse_status,
getBackendAPIModelsResponse_models,
getBackendAPIModelsResponse_httpStatus,
)
where
import Amazonka.AmplifyBackend.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 GetBackendAPIModels = GetBackendAPIModels'
{
GetBackendAPIModels -> Text
appId :: Prelude.Text,
GetBackendAPIModels -> Text
backendEnvironmentName :: Prelude.Text,
GetBackendAPIModels -> Text
resourceName :: Prelude.Text
}
deriving (GetBackendAPIModels -> GetBackendAPIModels -> Bool
(GetBackendAPIModels -> GetBackendAPIModels -> Bool)
-> (GetBackendAPIModels -> GetBackendAPIModels -> Bool)
-> Eq GetBackendAPIModels
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBackendAPIModels -> GetBackendAPIModels -> Bool
$c/= :: GetBackendAPIModels -> GetBackendAPIModels -> Bool
== :: GetBackendAPIModels -> GetBackendAPIModels -> Bool
$c== :: GetBackendAPIModels -> GetBackendAPIModels -> Bool
Prelude.Eq, ReadPrec [GetBackendAPIModels]
ReadPrec GetBackendAPIModels
Int -> ReadS GetBackendAPIModels
ReadS [GetBackendAPIModels]
(Int -> ReadS GetBackendAPIModels)
-> ReadS [GetBackendAPIModels]
-> ReadPrec GetBackendAPIModels
-> ReadPrec [GetBackendAPIModels]
-> Read GetBackendAPIModels
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBackendAPIModels]
$creadListPrec :: ReadPrec [GetBackendAPIModels]
readPrec :: ReadPrec GetBackendAPIModels
$creadPrec :: ReadPrec GetBackendAPIModels
readList :: ReadS [GetBackendAPIModels]
$creadList :: ReadS [GetBackendAPIModels]
readsPrec :: Int -> ReadS GetBackendAPIModels
$creadsPrec :: Int -> ReadS GetBackendAPIModels
Prelude.Read, Int -> GetBackendAPIModels -> ShowS
[GetBackendAPIModels] -> ShowS
GetBackendAPIModels -> String
(Int -> GetBackendAPIModels -> ShowS)
-> (GetBackendAPIModels -> String)
-> ([GetBackendAPIModels] -> ShowS)
-> Show GetBackendAPIModels
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBackendAPIModels] -> ShowS
$cshowList :: [GetBackendAPIModels] -> ShowS
show :: GetBackendAPIModels -> String
$cshow :: GetBackendAPIModels -> String
showsPrec :: Int -> GetBackendAPIModels -> ShowS
$cshowsPrec :: Int -> GetBackendAPIModels -> ShowS
Prelude.Show, (forall x. GetBackendAPIModels -> Rep GetBackendAPIModels x)
-> (forall x. Rep GetBackendAPIModels x -> GetBackendAPIModels)
-> Generic GetBackendAPIModels
forall x. Rep GetBackendAPIModels x -> GetBackendAPIModels
forall x. GetBackendAPIModels -> Rep GetBackendAPIModels x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBackendAPIModels x -> GetBackendAPIModels
$cfrom :: forall x. GetBackendAPIModels -> Rep GetBackendAPIModels x
Prelude.Generic)
newGetBackendAPIModels ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
GetBackendAPIModels
newGetBackendAPIModels :: Text -> Text -> Text -> GetBackendAPIModels
newGetBackendAPIModels
Text
pAppId_
Text
pBackendEnvironmentName_
Text
pResourceName_ =
GetBackendAPIModels' :: Text -> Text -> Text -> GetBackendAPIModels
GetBackendAPIModels'
{ $sel:appId:GetBackendAPIModels' :: Text
appId = Text
pAppId_,
$sel:backendEnvironmentName:GetBackendAPIModels' :: Text
backendEnvironmentName = Text
pBackendEnvironmentName_,
$sel:resourceName:GetBackendAPIModels' :: Text
resourceName = Text
pResourceName_
}
getBackendAPIModels_appId :: Lens.Lens' GetBackendAPIModels Prelude.Text
getBackendAPIModels_appId :: (Text -> f Text) -> GetBackendAPIModels -> f GetBackendAPIModels
getBackendAPIModels_appId = (GetBackendAPIModels -> Text)
-> (GetBackendAPIModels -> Text -> GetBackendAPIModels)
-> Lens GetBackendAPIModels GetBackendAPIModels Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackendAPIModels' {Text
appId :: Text
$sel:appId:GetBackendAPIModels' :: GetBackendAPIModels -> Text
appId} -> Text
appId) (\s :: GetBackendAPIModels
s@GetBackendAPIModels' {} Text
a -> GetBackendAPIModels
s {$sel:appId:GetBackendAPIModels' :: Text
appId = Text
a} :: GetBackendAPIModels)
getBackendAPIModels_backendEnvironmentName :: Lens.Lens' GetBackendAPIModels Prelude.Text
getBackendAPIModels_backendEnvironmentName :: (Text -> f Text) -> GetBackendAPIModels -> f GetBackendAPIModels
getBackendAPIModels_backendEnvironmentName = (GetBackendAPIModels -> Text)
-> (GetBackendAPIModels -> Text -> GetBackendAPIModels)
-> Lens GetBackendAPIModels GetBackendAPIModels Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackendAPIModels' {Text
backendEnvironmentName :: Text
$sel:backendEnvironmentName:GetBackendAPIModels' :: GetBackendAPIModels -> Text
backendEnvironmentName} -> Text
backendEnvironmentName) (\s :: GetBackendAPIModels
s@GetBackendAPIModels' {} Text
a -> GetBackendAPIModels
s {$sel:backendEnvironmentName:GetBackendAPIModels' :: Text
backendEnvironmentName = Text
a} :: GetBackendAPIModels)
getBackendAPIModels_resourceName :: Lens.Lens' GetBackendAPIModels Prelude.Text
getBackendAPIModels_resourceName :: (Text -> f Text) -> GetBackendAPIModels -> f GetBackendAPIModels
getBackendAPIModels_resourceName = (GetBackendAPIModels -> Text)
-> (GetBackendAPIModels -> Text -> GetBackendAPIModels)
-> Lens GetBackendAPIModels GetBackendAPIModels Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackendAPIModels' {Text
resourceName :: Text
$sel:resourceName:GetBackendAPIModels' :: GetBackendAPIModels -> Text
resourceName} -> Text
resourceName) (\s :: GetBackendAPIModels
s@GetBackendAPIModels' {} Text
a -> GetBackendAPIModels
s {$sel:resourceName:GetBackendAPIModels' :: Text
resourceName = Text
a} :: GetBackendAPIModels)
instance Core.AWSRequest GetBackendAPIModels where
type
AWSResponse GetBackendAPIModels =
GetBackendAPIModelsResponse
request :: GetBackendAPIModels -> Request GetBackendAPIModels
request = Service -> GetBackendAPIModels -> Request GetBackendAPIModels
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetBackendAPIModels
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetBackendAPIModels)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetBackendAPIModels))
-> Logger
-> Service
-> Proxy GetBackendAPIModels
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetBackendAPIModels)))
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 Status -> Maybe Text -> Int -> GetBackendAPIModelsResponse
GetBackendAPIModelsResponse'
(Maybe Status -> Maybe Text -> Int -> GetBackendAPIModelsResponse)
-> Either String (Maybe Status)
-> Either String (Maybe Text -> Int -> GetBackendAPIModelsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Status)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"status")
Either String (Maybe Text -> Int -> GetBackendAPIModelsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetBackendAPIModelsResponse)
forall (f :: * -> *) a b. Applicative f => 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
"models")
Either String (Int -> GetBackendAPIModelsResponse)
-> Either String Int -> Either String GetBackendAPIModelsResponse
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 GetBackendAPIModels
instance Prelude.NFData GetBackendAPIModels
instance Core.ToHeaders GetBackendAPIModels where
toHeaders :: GetBackendAPIModels -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetBackendAPIModels -> 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.ToJSON GetBackendAPIModels where
toJSON :: GetBackendAPIModels -> Value
toJSON GetBackendAPIModels' {Text
resourceName :: Text
backendEnvironmentName :: Text
appId :: Text
$sel:resourceName:GetBackendAPIModels' :: GetBackendAPIModels -> Text
$sel:backendEnvironmentName:GetBackendAPIModels' :: GetBackendAPIModels -> Text
$sel:appId:GetBackendAPIModels' :: GetBackendAPIModels -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"resourceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceName)]
)
instance Core.ToPath GetBackendAPIModels where
toPath :: GetBackendAPIModels -> ByteString
toPath GetBackendAPIModels' {Text
resourceName :: Text
backendEnvironmentName :: Text
appId :: Text
$sel:resourceName:GetBackendAPIModels' :: GetBackendAPIModels -> Text
$sel:backendEnvironmentName:GetBackendAPIModels' :: GetBackendAPIModels -> Text
$sel:appId:GetBackendAPIModels' :: GetBackendAPIModels -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/backend/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
appId,
ByteString
"/api/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
backendEnvironmentName,
ByteString
"/getModels"
]
instance Core.ToQuery GetBackendAPIModels where
toQuery :: GetBackendAPIModels -> QueryString
toQuery = QueryString -> GetBackendAPIModels -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetBackendAPIModelsResponse = GetBackendAPIModelsResponse'
{
GetBackendAPIModelsResponse -> Maybe Status
status :: Prelude.Maybe Status,
GetBackendAPIModelsResponse -> Maybe Text
models :: Prelude.Maybe Prelude.Text,
GetBackendAPIModelsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetBackendAPIModelsResponse -> GetBackendAPIModelsResponse -> Bool
(GetBackendAPIModelsResponse
-> GetBackendAPIModelsResponse -> Bool)
-> (GetBackendAPIModelsResponse
-> GetBackendAPIModelsResponse -> Bool)
-> Eq GetBackendAPIModelsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBackendAPIModelsResponse -> GetBackendAPIModelsResponse -> Bool
$c/= :: GetBackendAPIModelsResponse -> GetBackendAPIModelsResponse -> Bool
== :: GetBackendAPIModelsResponse -> GetBackendAPIModelsResponse -> Bool
$c== :: GetBackendAPIModelsResponse -> GetBackendAPIModelsResponse -> Bool
Prelude.Eq, ReadPrec [GetBackendAPIModelsResponse]
ReadPrec GetBackendAPIModelsResponse
Int -> ReadS GetBackendAPIModelsResponse
ReadS [GetBackendAPIModelsResponse]
(Int -> ReadS GetBackendAPIModelsResponse)
-> ReadS [GetBackendAPIModelsResponse]
-> ReadPrec GetBackendAPIModelsResponse
-> ReadPrec [GetBackendAPIModelsResponse]
-> Read GetBackendAPIModelsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBackendAPIModelsResponse]
$creadListPrec :: ReadPrec [GetBackendAPIModelsResponse]
readPrec :: ReadPrec GetBackendAPIModelsResponse
$creadPrec :: ReadPrec GetBackendAPIModelsResponse
readList :: ReadS [GetBackendAPIModelsResponse]
$creadList :: ReadS [GetBackendAPIModelsResponse]
readsPrec :: Int -> ReadS GetBackendAPIModelsResponse
$creadsPrec :: Int -> ReadS GetBackendAPIModelsResponse
Prelude.Read, Int -> GetBackendAPIModelsResponse -> ShowS
[GetBackendAPIModelsResponse] -> ShowS
GetBackendAPIModelsResponse -> String
(Int -> GetBackendAPIModelsResponse -> ShowS)
-> (GetBackendAPIModelsResponse -> String)
-> ([GetBackendAPIModelsResponse] -> ShowS)
-> Show GetBackendAPIModelsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBackendAPIModelsResponse] -> ShowS
$cshowList :: [GetBackendAPIModelsResponse] -> ShowS
show :: GetBackendAPIModelsResponse -> String
$cshow :: GetBackendAPIModelsResponse -> String
showsPrec :: Int -> GetBackendAPIModelsResponse -> ShowS
$cshowsPrec :: Int -> GetBackendAPIModelsResponse -> ShowS
Prelude.Show, (forall x.
GetBackendAPIModelsResponse -> Rep GetBackendAPIModelsResponse x)
-> (forall x.
Rep GetBackendAPIModelsResponse x -> GetBackendAPIModelsResponse)
-> Generic GetBackendAPIModelsResponse
forall x.
Rep GetBackendAPIModelsResponse x -> GetBackendAPIModelsResponse
forall x.
GetBackendAPIModelsResponse -> Rep GetBackendAPIModelsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetBackendAPIModelsResponse x -> GetBackendAPIModelsResponse
$cfrom :: forall x.
GetBackendAPIModelsResponse -> Rep GetBackendAPIModelsResponse x
Prelude.Generic)
newGetBackendAPIModelsResponse ::
Prelude.Int ->
GetBackendAPIModelsResponse
newGetBackendAPIModelsResponse :: Int -> GetBackendAPIModelsResponse
newGetBackendAPIModelsResponse Int
pHttpStatus_ =
GetBackendAPIModelsResponse' :: Maybe Status -> Maybe Text -> Int -> GetBackendAPIModelsResponse
GetBackendAPIModelsResponse'
{ $sel:status:GetBackendAPIModelsResponse' :: Maybe Status
status =
Maybe Status
forall a. Maybe a
Prelude.Nothing,
$sel:models:GetBackendAPIModelsResponse' :: Maybe Text
models = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetBackendAPIModelsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getBackendAPIModelsResponse_status :: Lens.Lens' GetBackendAPIModelsResponse (Prelude.Maybe Status)
getBackendAPIModelsResponse_status :: (Maybe Status -> f (Maybe Status))
-> GetBackendAPIModelsResponse -> f GetBackendAPIModelsResponse
getBackendAPIModelsResponse_status = (GetBackendAPIModelsResponse -> Maybe Status)
-> (GetBackendAPIModelsResponse
-> Maybe Status -> GetBackendAPIModelsResponse)
-> Lens
GetBackendAPIModelsResponse
GetBackendAPIModelsResponse
(Maybe Status)
(Maybe Status)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackendAPIModelsResponse' {Maybe Status
status :: Maybe Status
$sel:status:GetBackendAPIModelsResponse' :: GetBackendAPIModelsResponse -> Maybe Status
status} -> Maybe Status
status) (\s :: GetBackendAPIModelsResponse
s@GetBackendAPIModelsResponse' {} Maybe Status
a -> GetBackendAPIModelsResponse
s {$sel:status:GetBackendAPIModelsResponse' :: Maybe Status
status = Maybe Status
a} :: GetBackendAPIModelsResponse)
getBackendAPIModelsResponse_models :: Lens.Lens' GetBackendAPIModelsResponse (Prelude.Maybe Prelude.Text)
getBackendAPIModelsResponse_models :: (Maybe Text -> f (Maybe Text))
-> GetBackendAPIModelsResponse -> f GetBackendAPIModelsResponse
getBackendAPIModelsResponse_models = (GetBackendAPIModelsResponse -> Maybe Text)
-> (GetBackendAPIModelsResponse
-> Maybe Text -> GetBackendAPIModelsResponse)
-> Lens
GetBackendAPIModelsResponse
GetBackendAPIModelsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackendAPIModelsResponse' {Maybe Text
models :: Maybe Text
$sel:models:GetBackendAPIModelsResponse' :: GetBackendAPIModelsResponse -> Maybe Text
models} -> Maybe Text
models) (\s :: GetBackendAPIModelsResponse
s@GetBackendAPIModelsResponse' {} Maybe Text
a -> GetBackendAPIModelsResponse
s {$sel:models:GetBackendAPIModelsResponse' :: Maybe Text
models = Maybe Text
a} :: GetBackendAPIModelsResponse)
getBackendAPIModelsResponse_httpStatus :: Lens.Lens' GetBackendAPIModelsResponse Prelude.Int
getBackendAPIModelsResponse_httpStatus :: (Int -> f Int)
-> GetBackendAPIModelsResponse -> f GetBackendAPIModelsResponse
getBackendAPIModelsResponse_httpStatus = (GetBackendAPIModelsResponse -> Int)
-> (GetBackendAPIModelsResponse
-> Int -> GetBackendAPIModelsResponse)
-> Lens
GetBackendAPIModelsResponse GetBackendAPIModelsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackendAPIModelsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetBackendAPIModelsResponse' :: GetBackendAPIModelsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetBackendAPIModelsResponse
s@GetBackendAPIModelsResponse' {} Int
a -> GetBackendAPIModelsResponse
s {$sel:httpStatus:GetBackendAPIModelsResponse' :: Int
httpStatus = Int
a} :: GetBackendAPIModelsResponse)
instance Prelude.NFData GetBackendAPIModelsResponse