{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.FraudDetector.Types.ModelVersion where
import qualified Amazonka.Core as Core
import Amazonka.FraudDetector.Types.ModelTypeEnum
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ModelVersion = ModelVersion'
{
ModelVersion -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
ModelVersion -> Text
modelId :: Prelude.Text,
ModelVersion -> ModelTypeEnum
modelType :: ModelTypeEnum,
ModelVersion -> Text
modelVersionNumber :: Prelude.Text
}
deriving (ModelVersion -> ModelVersion -> Bool
(ModelVersion -> ModelVersion -> Bool)
-> (ModelVersion -> ModelVersion -> Bool) -> Eq ModelVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModelVersion -> ModelVersion -> Bool
$c/= :: ModelVersion -> ModelVersion -> Bool
== :: ModelVersion -> ModelVersion -> Bool
$c== :: ModelVersion -> ModelVersion -> Bool
Prelude.Eq, ReadPrec [ModelVersion]
ReadPrec ModelVersion
Int -> ReadS ModelVersion
ReadS [ModelVersion]
(Int -> ReadS ModelVersion)
-> ReadS [ModelVersion]
-> ReadPrec ModelVersion
-> ReadPrec [ModelVersion]
-> Read ModelVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModelVersion]
$creadListPrec :: ReadPrec [ModelVersion]
readPrec :: ReadPrec ModelVersion
$creadPrec :: ReadPrec ModelVersion
readList :: ReadS [ModelVersion]
$creadList :: ReadS [ModelVersion]
readsPrec :: Int -> ReadS ModelVersion
$creadsPrec :: Int -> ReadS ModelVersion
Prelude.Read, Int -> ModelVersion -> ShowS
[ModelVersion] -> ShowS
ModelVersion -> String
(Int -> ModelVersion -> ShowS)
-> (ModelVersion -> String)
-> ([ModelVersion] -> ShowS)
-> Show ModelVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModelVersion] -> ShowS
$cshowList :: [ModelVersion] -> ShowS
show :: ModelVersion -> String
$cshow :: ModelVersion -> String
showsPrec :: Int -> ModelVersion -> ShowS
$cshowsPrec :: Int -> ModelVersion -> ShowS
Prelude.Show, (forall x. ModelVersion -> Rep ModelVersion x)
-> (forall x. Rep ModelVersion x -> ModelVersion)
-> Generic ModelVersion
forall x. Rep ModelVersion x -> ModelVersion
forall x. ModelVersion -> Rep ModelVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModelVersion x -> ModelVersion
$cfrom :: forall x. ModelVersion -> Rep ModelVersion x
Prelude.Generic)
newModelVersion ::
Prelude.Text ->
ModelTypeEnum ->
Prelude.Text ->
ModelVersion
newModelVersion :: Text -> ModelTypeEnum -> Text -> ModelVersion
newModelVersion
Text
pModelId_
ModelTypeEnum
pModelType_
Text
pModelVersionNumber_ =
ModelVersion' :: Maybe Text -> Text -> ModelTypeEnum -> Text -> ModelVersion
ModelVersion'
{ $sel:arn:ModelVersion' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:modelId:ModelVersion' :: Text
modelId = Text
pModelId_,
$sel:modelType:ModelVersion' :: ModelTypeEnum
modelType = ModelTypeEnum
pModelType_,
$sel:modelVersionNumber:ModelVersion' :: Text
modelVersionNumber = Text
pModelVersionNumber_
}
modelVersion_arn :: Lens.Lens' ModelVersion (Prelude.Maybe Prelude.Text)
modelVersion_arn :: (Maybe Text -> f (Maybe Text)) -> ModelVersion -> f ModelVersion
modelVersion_arn = (ModelVersion -> Maybe Text)
-> (ModelVersion -> Maybe Text -> ModelVersion)
-> Lens ModelVersion ModelVersion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelVersion' {Maybe Text
arn :: Maybe Text
$sel:arn:ModelVersion' :: ModelVersion -> Maybe Text
arn} -> Maybe Text
arn) (\s :: ModelVersion
s@ModelVersion' {} Maybe Text
a -> ModelVersion
s {$sel:arn:ModelVersion' :: Maybe Text
arn = Maybe Text
a} :: ModelVersion)
modelVersion_modelId :: Lens.Lens' ModelVersion Prelude.Text
modelVersion_modelId :: (Text -> f Text) -> ModelVersion -> f ModelVersion
modelVersion_modelId = (ModelVersion -> Text)
-> (ModelVersion -> Text -> ModelVersion)
-> Lens ModelVersion ModelVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelVersion' {Text
modelId :: Text
$sel:modelId:ModelVersion' :: ModelVersion -> Text
modelId} -> Text
modelId) (\s :: ModelVersion
s@ModelVersion' {} Text
a -> ModelVersion
s {$sel:modelId:ModelVersion' :: Text
modelId = Text
a} :: ModelVersion)
modelVersion_modelType :: Lens.Lens' ModelVersion ModelTypeEnum
modelVersion_modelType :: (ModelTypeEnum -> f ModelTypeEnum)
-> ModelVersion -> f ModelVersion
modelVersion_modelType = (ModelVersion -> ModelTypeEnum)
-> (ModelVersion -> ModelTypeEnum -> ModelVersion)
-> Lens ModelVersion ModelVersion ModelTypeEnum ModelTypeEnum
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelVersion' {ModelTypeEnum
modelType :: ModelTypeEnum
$sel:modelType:ModelVersion' :: ModelVersion -> ModelTypeEnum
modelType} -> ModelTypeEnum
modelType) (\s :: ModelVersion
s@ModelVersion' {} ModelTypeEnum
a -> ModelVersion
s {$sel:modelType:ModelVersion' :: ModelTypeEnum
modelType = ModelTypeEnum
a} :: ModelVersion)
modelVersion_modelVersionNumber :: Lens.Lens' ModelVersion Prelude.Text
modelVersion_modelVersionNumber :: (Text -> f Text) -> ModelVersion -> f ModelVersion
modelVersion_modelVersionNumber = (ModelVersion -> Text)
-> (ModelVersion -> Text -> ModelVersion)
-> Lens ModelVersion ModelVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelVersion' {Text
modelVersionNumber :: Text
$sel:modelVersionNumber:ModelVersion' :: ModelVersion -> Text
modelVersionNumber} -> Text
modelVersionNumber) (\s :: ModelVersion
s@ModelVersion' {} Text
a -> ModelVersion
s {$sel:modelVersionNumber:ModelVersion' :: Text
modelVersionNumber = Text
a} :: ModelVersion)
instance Core.FromJSON ModelVersion where
parseJSON :: Value -> Parser ModelVersion
parseJSON =
String
-> (Object -> Parser ModelVersion) -> Value -> Parser ModelVersion
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ModelVersion"
( \Object
x ->
Maybe Text -> Text -> ModelTypeEnum -> Text -> ModelVersion
ModelVersion'
(Maybe Text -> Text -> ModelTypeEnum -> Text -> ModelVersion)
-> Parser (Maybe Text)
-> Parser (Text -> ModelTypeEnum -> Text -> ModelVersion)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"arn")
Parser (Text -> ModelTypeEnum -> Text -> ModelVersion)
-> Parser Text -> Parser (ModelTypeEnum -> Text -> ModelVersion)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"modelId")
Parser (ModelTypeEnum -> Text -> ModelVersion)
-> Parser ModelTypeEnum -> Parser (Text -> ModelVersion)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ModelTypeEnum
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"modelType")
Parser (Text -> ModelVersion) -> Parser Text -> Parser ModelVersion
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"modelVersionNumber")
)
instance Prelude.Hashable ModelVersion
instance Prelude.NFData ModelVersion
instance Core.ToJSON ModelVersion where
toJSON :: ModelVersion -> Value
toJSON ModelVersion' {Maybe Text
Text
ModelTypeEnum
modelVersionNumber :: Text
modelType :: ModelTypeEnum
modelId :: Text
arn :: Maybe Text
$sel:modelVersionNumber:ModelVersion' :: ModelVersion -> Text
$sel:modelType:ModelVersion' :: ModelVersion -> ModelTypeEnum
$sel:modelId:ModelVersion' :: ModelVersion -> Text
$sel:arn:ModelVersion' :: ModelVersion -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"arn" 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
arn,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"modelId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
modelId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"modelType" Text -> ModelTypeEnum -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ModelTypeEnum
modelType),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"modelVersionNumber" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
modelVersionNumber)
]
)