{-# 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.FraudDetector.GetModels
(
GetModels (..),
newGetModels,
getModels_modelType,
getModels_modelId,
getModels_nextToken,
getModels_maxResults,
GetModelsResponse (..),
newGetModelsResponse,
getModelsResponse_models,
getModelsResponse_nextToken,
getModelsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.FraudDetector.Types
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 GetModels = GetModels'
{
GetModels -> Maybe ModelTypeEnum
modelType :: Prelude.Maybe ModelTypeEnum,
GetModels -> Maybe Text
modelId :: Prelude.Maybe Prelude.Text,
GetModels -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetModels -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (GetModels -> GetModels -> Bool
(GetModels -> GetModels -> Bool)
-> (GetModels -> GetModels -> Bool) -> Eq GetModels
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetModels -> GetModels -> Bool
$c/= :: GetModels -> GetModels -> Bool
== :: GetModels -> GetModels -> Bool
$c== :: GetModels -> GetModels -> Bool
Prelude.Eq, ReadPrec [GetModels]
ReadPrec GetModels
Int -> ReadS GetModels
ReadS [GetModels]
(Int -> ReadS GetModels)
-> ReadS [GetModels]
-> ReadPrec GetModels
-> ReadPrec [GetModels]
-> Read GetModels
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetModels]
$creadListPrec :: ReadPrec [GetModels]
readPrec :: ReadPrec GetModels
$creadPrec :: ReadPrec GetModels
readList :: ReadS [GetModels]
$creadList :: ReadS [GetModels]
readsPrec :: Int -> ReadS GetModels
$creadsPrec :: Int -> ReadS GetModels
Prelude.Read, Int -> GetModels -> ShowS
[GetModels] -> ShowS
GetModels -> String
(Int -> GetModels -> ShowS)
-> (GetModels -> String)
-> ([GetModels] -> ShowS)
-> Show GetModels
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetModels] -> ShowS
$cshowList :: [GetModels] -> ShowS
show :: GetModels -> String
$cshow :: GetModels -> String
showsPrec :: Int -> GetModels -> ShowS
$cshowsPrec :: Int -> GetModels -> ShowS
Prelude.Show, (forall x. GetModels -> Rep GetModels x)
-> (forall x. Rep GetModels x -> GetModels) -> Generic GetModels
forall x. Rep GetModels x -> GetModels
forall x. GetModels -> Rep GetModels x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetModels x -> GetModels
$cfrom :: forall x. GetModels -> Rep GetModels x
Prelude.Generic)
newGetModels ::
GetModels
newGetModels :: GetModels
newGetModels =
GetModels' :: Maybe ModelTypeEnum
-> Maybe Text -> Maybe Text -> Maybe Natural -> GetModels
GetModels'
{ $sel:modelType:GetModels' :: Maybe ModelTypeEnum
modelType = Maybe ModelTypeEnum
forall a. Maybe a
Prelude.Nothing,
$sel:modelId:GetModels' :: Maybe Text
modelId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetModels' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:GetModels' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
getModels_modelType :: Lens.Lens' GetModels (Prelude.Maybe ModelTypeEnum)
getModels_modelType :: (Maybe ModelTypeEnum -> f (Maybe ModelTypeEnum))
-> GetModels -> f GetModels
getModels_modelType = (GetModels -> Maybe ModelTypeEnum)
-> (GetModels -> Maybe ModelTypeEnum -> GetModels)
-> Lens
GetModels GetModels (Maybe ModelTypeEnum) (Maybe ModelTypeEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetModels' {Maybe ModelTypeEnum
modelType :: Maybe ModelTypeEnum
$sel:modelType:GetModels' :: GetModels -> Maybe ModelTypeEnum
modelType} -> Maybe ModelTypeEnum
modelType) (\s :: GetModels
s@GetModels' {} Maybe ModelTypeEnum
a -> GetModels
s {$sel:modelType:GetModels' :: Maybe ModelTypeEnum
modelType = Maybe ModelTypeEnum
a} :: GetModels)
getModels_modelId :: Lens.Lens' GetModels (Prelude.Maybe Prelude.Text)
getModels_modelId :: (Maybe Text -> f (Maybe Text)) -> GetModels -> f GetModels
getModels_modelId = (GetModels -> Maybe Text)
-> (GetModels -> Maybe Text -> GetModels)
-> Lens GetModels GetModels (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetModels' {Maybe Text
modelId :: Maybe Text
$sel:modelId:GetModels' :: GetModels -> Maybe Text
modelId} -> Maybe Text
modelId) (\s :: GetModels
s@GetModels' {} Maybe Text
a -> GetModels
s {$sel:modelId:GetModels' :: Maybe Text
modelId = Maybe Text
a} :: GetModels)
getModels_nextToken :: Lens.Lens' GetModels (Prelude.Maybe Prelude.Text)
getModels_nextToken :: (Maybe Text -> f (Maybe Text)) -> GetModels -> f GetModels
getModels_nextToken = (GetModels -> Maybe Text)
-> (GetModels -> Maybe Text -> GetModels)
-> Lens GetModels GetModels (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetModels' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetModels' :: GetModels -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetModels
s@GetModels' {} Maybe Text
a -> GetModels
s {$sel:nextToken:GetModels' :: Maybe Text
nextToken = Maybe Text
a} :: GetModels)
getModels_maxResults :: Lens.Lens' GetModels (Prelude.Maybe Prelude.Natural)
getModels_maxResults :: (Maybe Natural -> f (Maybe Natural)) -> GetModels -> f GetModels
getModels_maxResults = (GetModels -> Maybe Natural)
-> (GetModels -> Maybe Natural -> GetModels)
-> Lens GetModels GetModels (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetModels' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetModels' :: GetModels -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetModels
s@GetModels' {} Maybe Natural
a -> GetModels
s {$sel:maxResults:GetModels' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetModels)
instance Core.AWSRequest GetModels where
type AWSResponse GetModels = GetModelsResponse
request :: GetModels -> Request GetModels
request = Service -> GetModels -> Request GetModels
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetModels
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetModels)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetModels))
-> Logger
-> Service
-> Proxy GetModels
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetModels)))
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 [Model] -> Maybe Text -> Int -> GetModelsResponse
GetModelsResponse'
(Maybe [Model] -> Maybe Text -> Int -> GetModelsResponse)
-> Either String (Maybe [Model])
-> Either String (Maybe Text -> Int -> GetModelsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Model]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"models" Either String (Maybe (Maybe [Model]))
-> Maybe [Model] -> Either String (Maybe [Model])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Model]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> GetModelsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetModelsResponse)
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
"nextToken")
Either String (Int -> GetModelsResponse)
-> Either String Int -> Either String GetModelsResponse
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 GetModels
instance Prelude.NFData GetModels
instance Core.ToHeaders GetModels where
toHeaders :: GetModels -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetModels -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSHawksNestServiceFacade.GetModels" ::
Prelude.ByteString
),
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 GetModels where
toJSON :: GetModels -> Value
toJSON GetModels' {Maybe Natural
Maybe Text
Maybe ModelTypeEnum
maxResults :: Maybe Natural
nextToken :: Maybe Text
modelId :: Maybe Text
modelType :: Maybe ModelTypeEnum
$sel:maxResults:GetModels' :: GetModels -> Maybe Natural
$sel:nextToken:GetModels' :: GetModels -> Maybe Text
$sel:modelId:GetModels' :: GetModels -> Maybe Text
$sel:modelType:GetModels' :: GetModels -> Maybe ModelTypeEnum
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"modelType" Text -> ModelTypeEnum -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ModelTypeEnum -> Pair) -> Maybe ModelTypeEnum -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ModelTypeEnum
modelType,
(Text
"modelId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
modelId,
(Text
"nextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
(Text
"maxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
]
)
instance Core.ToPath GetModels where
toPath :: GetModels -> ByteString
toPath = ByteString -> GetModels -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetModels where
toQuery :: GetModels -> QueryString
toQuery = QueryString -> GetModels -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetModelsResponse = GetModelsResponse'
{
GetModelsResponse -> Maybe [Model]
models :: Prelude.Maybe [Model],
GetModelsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetModelsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetModelsResponse -> GetModelsResponse -> Bool
(GetModelsResponse -> GetModelsResponse -> Bool)
-> (GetModelsResponse -> GetModelsResponse -> Bool)
-> Eq GetModelsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetModelsResponse -> GetModelsResponse -> Bool
$c/= :: GetModelsResponse -> GetModelsResponse -> Bool
== :: GetModelsResponse -> GetModelsResponse -> Bool
$c== :: GetModelsResponse -> GetModelsResponse -> Bool
Prelude.Eq, ReadPrec [GetModelsResponse]
ReadPrec GetModelsResponse
Int -> ReadS GetModelsResponse
ReadS [GetModelsResponse]
(Int -> ReadS GetModelsResponse)
-> ReadS [GetModelsResponse]
-> ReadPrec GetModelsResponse
-> ReadPrec [GetModelsResponse]
-> Read GetModelsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetModelsResponse]
$creadListPrec :: ReadPrec [GetModelsResponse]
readPrec :: ReadPrec GetModelsResponse
$creadPrec :: ReadPrec GetModelsResponse
readList :: ReadS [GetModelsResponse]
$creadList :: ReadS [GetModelsResponse]
readsPrec :: Int -> ReadS GetModelsResponse
$creadsPrec :: Int -> ReadS GetModelsResponse
Prelude.Read, Int -> GetModelsResponse -> ShowS
[GetModelsResponse] -> ShowS
GetModelsResponse -> String
(Int -> GetModelsResponse -> ShowS)
-> (GetModelsResponse -> String)
-> ([GetModelsResponse] -> ShowS)
-> Show GetModelsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetModelsResponse] -> ShowS
$cshowList :: [GetModelsResponse] -> ShowS
show :: GetModelsResponse -> String
$cshow :: GetModelsResponse -> String
showsPrec :: Int -> GetModelsResponse -> ShowS
$cshowsPrec :: Int -> GetModelsResponse -> ShowS
Prelude.Show, (forall x. GetModelsResponse -> Rep GetModelsResponse x)
-> (forall x. Rep GetModelsResponse x -> GetModelsResponse)
-> Generic GetModelsResponse
forall x. Rep GetModelsResponse x -> GetModelsResponse
forall x. GetModelsResponse -> Rep GetModelsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetModelsResponse x -> GetModelsResponse
$cfrom :: forall x. GetModelsResponse -> Rep GetModelsResponse x
Prelude.Generic)
newGetModelsResponse ::
Prelude.Int ->
GetModelsResponse
newGetModelsResponse :: Int -> GetModelsResponse
newGetModelsResponse Int
pHttpStatus_ =
GetModelsResponse' :: Maybe [Model] -> Maybe Text -> Int -> GetModelsResponse
GetModelsResponse'
{ $sel:models:GetModelsResponse' :: Maybe [Model]
models = Maybe [Model]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetModelsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetModelsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getModelsResponse_models :: Lens.Lens' GetModelsResponse (Prelude.Maybe [Model])
getModelsResponse_models :: (Maybe [Model] -> f (Maybe [Model]))
-> GetModelsResponse -> f GetModelsResponse
getModelsResponse_models = (GetModelsResponse -> Maybe [Model])
-> (GetModelsResponse -> Maybe [Model] -> GetModelsResponse)
-> Lens
GetModelsResponse GetModelsResponse (Maybe [Model]) (Maybe [Model])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetModelsResponse' {Maybe [Model]
models :: Maybe [Model]
$sel:models:GetModelsResponse' :: GetModelsResponse -> Maybe [Model]
models} -> Maybe [Model]
models) (\s :: GetModelsResponse
s@GetModelsResponse' {} Maybe [Model]
a -> GetModelsResponse
s {$sel:models:GetModelsResponse' :: Maybe [Model]
models = Maybe [Model]
a} :: GetModelsResponse) ((Maybe [Model] -> f (Maybe [Model]))
-> GetModelsResponse -> f GetModelsResponse)
-> ((Maybe [Model] -> f (Maybe [Model]))
-> Maybe [Model] -> f (Maybe [Model]))
-> (Maybe [Model] -> f (Maybe [Model]))
-> GetModelsResponse
-> f GetModelsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Model] [Model] [Model] [Model]
-> Iso
(Maybe [Model]) (Maybe [Model]) (Maybe [Model]) (Maybe [Model])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Model] [Model] [Model] [Model]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getModelsResponse_nextToken :: Lens.Lens' GetModelsResponse (Prelude.Maybe Prelude.Text)
getModelsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetModelsResponse -> f GetModelsResponse
getModelsResponse_nextToken = (GetModelsResponse -> Maybe Text)
-> (GetModelsResponse -> Maybe Text -> GetModelsResponse)
-> Lens
GetModelsResponse GetModelsResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetModelsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetModelsResponse' :: GetModelsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetModelsResponse
s@GetModelsResponse' {} Maybe Text
a -> GetModelsResponse
s {$sel:nextToken:GetModelsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetModelsResponse)
getModelsResponse_httpStatus :: Lens.Lens' GetModelsResponse Prelude.Int
getModelsResponse_httpStatus :: (Int -> f Int) -> GetModelsResponse -> f GetModelsResponse
getModelsResponse_httpStatus = (GetModelsResponse -> Int)
-> (GetModelsResponse -> Int -> GetModelsResponse)
-> Lens GetModelsResponse GetModelsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetModelsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetModelsResponse' :: GetModelsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetModelsResponse
s@GetModelsResponse' {} Int
a -> GetModelsResponse
s {$sel:httpStatus:GetModelsResponse' :: Int
httpStatus = Int
a} :: GetModelsResponse)
instance Prelude.NFData GetModelsResponse