{-# 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.GetExternalModels
(
GetExternalModels (..),
newGetExternalModels,
getExternalModels_modelEndpoint,
getExternalModels_nextToken,
getExternalModels_maxResults,
GetExternalModelsResponse (..),
newGetExternalModelsResponse,
getExternalModelsResponse_nextToken,
getExternalModelsResponse_externalModels,
getExternalModelsResponse_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 GetExternalModels = GetExternalModels'
{
GetExternalModels -> Maybe Text
modelEndpoint :: Prelude.Maybe Prelude.Text,
GetExternalModels -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetExternalModels -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (GetExternalModels -> GetExternalModels -> Bool
(GetExternalModels -> GetExternalModels -> Bool)
-> (GetExternalModels -> GetExternalModels -> Bool)
-> Eq GetExternalModels
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetExternalModels -> GetExternalModels -> Bool
$c/= :: GetExternalModels -> GetExternalModels -> Bool
== :: GetExternalModels -> GetExternalModels -> Bool
$c== :: GetExternalModels -> GetExternalModels -> Bool
Prelude.Eq, ReadPrec [GetExternalModels]
ReadPrec GetExternalModels
Int -> ReadS GetExternalModels
ReadS [GetExternalModels]
(Int -> ReadS GetExternalModels)
-> ReadS [GetExternalModels]
-> ReadPrec GetExternalModels
-> ReadPrec [GetExternalModels]
-> Read GetExternalModels
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetExternalModels]
$creadListPrec :: ReadPrec [GetExternalModels]
readPrec :: ReadPrec GetExternalModels
$creadPrec :: ReadPrec GetExternalModels
readList :: ReadS [GetExternalModels]
$creadList :: ReadS [GetExternalModels]
readsPrec :: Int -> ReadS GetExternalModels
$creadsPrec :: Int -> ReadS GetExternalModels
Prelude.Read, Int -> GetExternalModels -> ShowS
[GetExternalModels] -> ShowS
GetExternalModels -> String
(Int -> GetExternalModels -> ShowS)
-> (GetExternalModels -> String)
-> ([GetExternalModels] -> ShowS)
-> Show GetExternalModels
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetExternalModels] -> ShowS
$cshowList :: [GetExternalModels] -> ShowS
show :: GetExternalModels -> String
$cshow :: GetExternalModels -> String
showsPrec :: Int -> GetExternalModels -> ShowS
$cshowsPrec :: Int -> GetExternalModels -> ShowS
Prelude.Show, (forall x. GetExternalModels -> Rep GetExternalModels x)
-> (forall x. Rep GetExternalModels x -> GetExternalModels)
-> Generic GetExternalModels
forall x. Rep GetExternalModels x -> GetExternalModels
forall x. GetExternalModels -> Rep GetExternalModels x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetExternalModels x -> GetExternalModels
$cfrom :: forall x. GetExternalModels -> Rep GetExternalModels x
Prelude.Generic)
newGetExternalModels ::
GetExternalModels
newGetExternalModels :: GetExternalModels
newGetExternalModels =
GetExternalModels' :: Maybe Text -> Maybe Text -> Maybe Natural -> GetExternalModels
GetExternalModels'
{ $sel:modelEndpoint:GetExternalModels' :: Maybe Text
modelEndpoint = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetExternalModels' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:GetExternalModels' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
getExternalModels_modelEndpoint :: Lens.Lens' GetExternalModels (Prelude.Maybe Prelude.Text)
getExternalModels_modelEndpoint :: (Maybe Text -> f (Maybe Text))
-> GetExternalModels -> f GetExternalModels
getExternalModels_modelEndpoint = (GetExternalModels -> Maybe Text)
-> (GetExternalModels -> Maybe Text -> GetExternalModels)
-> Lens
GetExternalModels GetExternalModels (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetExternalModels' {Maybe Text
modelEndpoint :: Maybe Text
$sel:modelEndpoint:GetExternalModels' :: GetExternalModels -> Maybe Text
modelEndpoint} -> Maybe Text
modelEndpoint) (\s :: GetExternalModels
s@GetExternalModels' {} Maybe Text
a -> GetExternalModels
s {$sel:modelEndpoint:GetExternalModels' :: Maybe Text
modelEndpoint = Maybe Text
a} :: GetExternalModels)
getExternalModels_nextToken :: Lens.Lens' GetExternalModels (Prelude.Maybe Prelude.Text)
getExternalModels_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetExternalModels -> f GetExternalModels
getExternalModels_nextToken = (GetExternalModels -> Maybe Text)
-> (GetExternalModels -> Maybe Text -> GetExternalModels)
-> Lens
GetExternalModels GetExternalModels (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetExternalModels' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetExternalModels' :: GetExternalModels -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetExternalModels
s@GetExternalModels' {} Maybe Text
a -> GetExternalModels
s {$sel:nextToken:GetExternalModels' :: Maybe Text
nextToken = Maybe Text
a} :: GetExternalModels)
getExternalModels_maxResults :: Lens.Lens' GetExternalModels (Prelude.Maybe Prelude.Natural)
getExternalModels_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetExternalModels -> f GetExternalModels
getExternalModels_maxResults = (GetExternalModels -> Maybe Natural)
-> (GetExternalModels -> Maybe Natural -> GetExternalModels)
-> Lens
GetExternalModels GetExternalModels (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetExternalModels' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetExternalModels' :: GetExternalModels -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetExternalModels
s@GetExternalModels' {} Maybe Natural
a -> GetExternalModels
s {$sel:maxResults:GetExternalModels' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetExternalModels)
instance Core.AWSRequest GetExternalModels where
type
AWSResponse GetExternalModels =
GetExternalModelsResponse
request :: GetExternalModels -> Request GetExternalModels
request = Service -> GetExternalModels -> Request GetExternalModels
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetExternalModels
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetExternalModels)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetExternalModels))
-> Logger
-> Service
-> Proxy GetExternalModels
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetExternalModels)))
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
-> Maybe [ExternalModel] -> Int -> GetExternalModelsResponse
GetExternalModelsResponse'
(Maybe Text
-> Maybe [ExternalModel] -> Int -> GetExternalModelsResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe [ExternalModel] -> Int -> GetExternalModelsResponse)
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
"nextToken")
Either
String (Maybe [ExternalModel] -> Int -> GetExternalModelsResponse)
-> Either String (Maybe [ExternalModel])
-> Either String (Int -> GetExternalModelsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [ExternalModel]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"externalModels" Either String (Maybe (Maybe [ExternalModel]))
-> Maybe [ExternalModel] -> Either String (Maybe [ExternalModel])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ExternalModel]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> GetExternalModelsResponse)
-> Either String Int -> Either String GetExternalModelsResponse
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 GetExternalModels
instance Prelude.NFData GetExternalModels
instance Core.ToHeaders GetExternalModels where
toHeaders :: GetExternalModels -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetExternalModels -> 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.GetExternalModels" ::
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 GetExternalModels where
toJSON :: GetExternalModels -> Value
toJSON GetExternalModels' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
modelEndpoint :: Maybe Text
$sel:maxResults:GetExternalModels' :: GetExternalModels -> Maybe Natural
$sel:nextToken:GetExternalModels' :: GetExternalModels -> Maybe Text
$sel:modelEndpoint:GetExternalModels' :: GetExternalModels -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"modelEndpoint" 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
modelEndpoint,
(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 GetExternalModels where
toPath :: GetExternalModels -> ByteString
toPath = ByteString -> GetExternalModels -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetExternalModels where
toQuery :: GetExternalModels -> QueryString
toQuery = QueryString -> GetExternalModels -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetExternalModelsResponse = GetExternalModelsResponse'
{
GetExternalModelsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetExternalModelsResponse -> Maybe [ExternalModel]
externalModels :: Prelude.Maybe [ExternalModel],
GetExternalModelsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetExternalModelsResponse -> GetExternalModelsResponse -> Bool
(GetExternalModelsResponse -> GetExternalModelsResponse -> Bool)
-> (GetExternalModelsResponse -> GetExternalModelsResponse -> Bool)
-> Eq GetExternalModelsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetExternalModelsResponse -> GetExternalModelsResponse -> Bool
$c/= :: GetExternalModelsResponse -> GetExternalModelsResponse -> Bool
== :: GetExternalModelsResponse -> GetExternalModelsResponse -> Bool
$c== :: GetExternalModelsResponse -> GetExternalModelsResponse -> Bool
Prelude.Eq, ReadPrec [GetExternalModelsResponse]
ReadPrec GetExternalModelsResponse
Int -> ReadS GetExternalModelsResponse
ReadS [GetExternalModelsResponse]
(Int -> ReadS GetExternalModelsResponse)
-> ReadS [GetExternalModelsResponse]
-> ReadPrec GetExternalModelsResponse
-> ReadPrec [GetExternalModelsResponse]
-> Read GetExternalModelsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetExternalModelsResponse]
$creadListPrec :: ReadPrec [GetExternalModelsResponse]
readPrec :: ReadPrec GetExternalModelsResponse
$creadPrec :: ReadPrec GetExternalModelsResponse
readList :: ReadS [GetExternalModelsResponse]
$creadList :: ReadS [GetExternalModelsResponse]
readsPrec :: Int -> ReadS GetExternalModelsResponse
$creadsPrec :: Int -> ReadS GetExternalModelsResponse
Prelude.Read, Int -> GetExternalModelsResponse -> ShowS
[GetExternalModelsResponse] -> ShowS
GetExternalModelsResponse -> String
(Int -> GetExternalModelsResponse -> ShowS)
-> (GetExternalModelsResponse -> String)
-> ([GetExternalModelsResponse] -> ShowS)
-> Show GetExternalModelsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetExternalModelsResponse] -> ShowS
$cshowList :: [GetExternalModelsResponse] -> ShowS
show :: GetExternalModelsResponse -> String
$cshow :: GetExternalModelsResponse -> String
showsPrec :: Int -> GetExternalModelsResponse -> ShowS
$cshowsPrec :: Int -> GetExternalModelsResponse -> ShowS
Prelude.Show, (forall x.
GetExternalModelsResponse -> Rep GetExternalModelsResponse x)
-> (forall x.
Rep GetExternalModelsResponse x -> GetExternalModelsResponse)
-> Generic GetExternalModelsResponse
forall x.
Rep GetExternalModelsResponse x -> GetExternalModelsResponse
forall x.
GetExternalModelsResponse -> Rep GetExternalModelsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetExternalModelsResponse x -> GetExternalModelsResponse
$cfrom :: forall x.
GetExternalModelsResponse -> Rep GetExternalModelsResponse x
Prelude.Generic)
newGetExternalModelsResponse ::
Prelude.Int ->
GetExternalModelsResponse
newGetExternalModelsResponse :: Int -> GetExternalModelsResponse
newGetExternalModelsResponse Int
pHttpStatus_ =
GetExternalModelsResponse' :: Maybe Text
-> Maybe [ExternalModel] -> Int -> GetExternalModelsResponse
GetExternalModelsResponse'
{ $sel:nextToken:GetExternalModelsResponse' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:externalModels:GetExternalModelsResponse' :: Maybe [ExternalModel]
externalModels = Maybe [ExternalModel]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetExternalModelsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getExternalModelsResponse_nextToken :: Lens.Lens' GetExternalModelsResponse (Prelude.Maybe Prelude.Text)
getExternalModelsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetExternalModelsResponse -> f GetExternalModelsResponse
getExternalModelsResponse_nextToken = (GetExternalModelsResponse -> Maybe Text)
-> (GetExternalModelsResponse
-> Maybe Text -> GetExternalModelsResponse)
-> Lens
GetExternalModelsResponse
GetExternalModelsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetExternalModelsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetExternalModelsResponse' :: GetExternalModelsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetExternalModelsResponse
s@GetExternalModelsResponse' {} Maybe Text
a -> GetExternalModelsResponse
s {$sel:nextToken:GetExternalModelsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetExternalModelsResponse)
getExternalModelsResponse_externalModels :: Lens.Lens' GetExternalModelsResponse (Prelude.Maybe [ExternalModel])
getExternalModelsResponse_externalModels :: (Maybe [ExternalModel] -> f (Maybe [ExternalModel]))
-> GetExternalModelsResponse -> f GetExternalModelsResponse
getExternalModelsResponse_externalModels = (GetExternalModelsResponse -> Maybe [ExternalModel])
-> (GetExternalModelsResponse
-> Maybe [ExternalModel] -> GetExternalModelsResponse)
-> Lens
GetExternalModelsResponse
GetExternalModelsResponse
(Maybe [ExternalModel])
(Maybe [ExternalModel])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetExternalModelsResponse' {Maybe [ExternalModel]
externalModels :: Maybe [ExternalModel]
$sel:externalModels:GetExternalModelsResponse' :: GetExternalModelsResponse -> Maybe [ExternalModel]
externalModels} -> Maybe [ExternalModel]
externalModels) (\s :: GetExternalModelsResponse
s@GetExternalModelsResponse' {} Maybe [ExternalModel]
a -> GetExternalModelsResponse
s {$sel:externalModels:GetExternalModelsResponse' :: Maybe [ExternalModel]
externalModels = Maybe [ExternalModel]
a} :: GetExternalModelsResponse) ((Maybe [ExternalModel] -> f (Maybe [ExternalModel]))
-> GetExternalModelsResponse -> f GetExternalModelsResponse)
-> ((Maybe [ExternalModel] -> f (Maybe [ExternalModel]))
-> Maybe [ExternalModel] -> f (Maybe [ExternalModel]))
-> (Maybe [ExternalModel] -> f (Maybe [ExternalModel]))
-> GetExternalModelsResponse
-> f GetExternalModelsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[ExternalModel] [ExternalModel] [ExternalModel] [ExternalModel]
-> Iso
(Maybe [ExternalModel])
(Maybe [ExternalModel])
(Maybe [ExternalModel])
(Maybe [ExternalModel])
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
[ExternalModel] [ExternalModel] [ExternalModel] [ExternalModel]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getExternalModelsResponse_httpStatus :: Lens.Lens' GetExternalModelsResponse Prelude.Int
getExternalModelsResponse_httpStatus :: (Int -> f Int)
-> GetExternalModelsResponse -> f GetExternalModelsResponse
getExternalModelsResponse_httpStatus = (GetExternalModelsResponse -> Int)
-> (GetExternalModelsResponse -> Int -> GetExternalModelsResponse)
-> Lens GetExternalModelsResponse GetExternalModelsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetExternalModelsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetExternalModelsResponse' :: GetExternalModelsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetExternalModelsResponse
s@GetExternalModelsResponse' {} Int
a -> GetExternalModelsResponse
s {$sel:httpStatus:GetExternalModelsResponse' :: Int
httpStatus = Int
a} :: GetExternalModelsResponse)
instance Prelude.NFData GetExternalModelsResponse