{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.LookoutVision.Types.ModelMetadata
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.LookoutVision.Types.ModelMetadata where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LookoutVision.Types.ModelPerformance
import Amazonka.LookoutVision.Types.ModelStatus
import qualified Amazonka.Prelude as Prelude

-- | Describes an Amazon Lookout for Vision model.
--
-- /See:/ 'newModelMetadata' smart constructor.
data ModelMetadata = ModelMetadata'
  { -- | The status of the model.
    ModelMetadata -> Maybe ModelStatus
status :: Prelude.Maybe ModelStatus,
    -- | The Amazon Resource Name (ARN) of the model.
    ModelMetadata -> Maybe Text
modelArn :: Prelude.Maybe Prelude.Text,
    -- | Performance metrics for the model. Not available until training has
    -- successfully completed.
    ModelMetadata -> Maybe ModelPerformance
performance :: Prelude.Maybe ModelPerformance,
    -- | The status message for the model.
    ModelMetadata -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text,
    -- | The unix timestamp for the date and time that the model was created.
    ModelMetadata -> Maybe POSIX
creationTimestamp :: Prelude.Maybe Core.POSIX,
    -- | The version of the model.
    ModelMetadata -> Maybe Text
modelVersion :: Prelude.Maybe Prelude.Text,
    -- | The description for the model.
    ModelMetadata -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (ModelMetadata -> ModelMetadata -> Bool
(ModelMetadata -> ModelMetadata -> Bool)
-> (ModelMetadata -> ModelMetadata -> Bool) -> Eq ModelMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModelMetadata -> ModelMetadata -> Bool
$c/= :: ModelMetadata -> ModelMetadata -> Bool
== :: ModelMetadata -> ModelMetadata -> Bool
$c== :: ModelMetadata -> ModelMetadata -> Bool
Prelude.Eq, ReadPrec [ModelMetadata]
ReadPrec ModelMetadata
Int -> ReadS ModelMetadata
ReadS [ModelMetadata]
(Int -> ReadS ModelMetadata)
-> ReadS [ModelMetadata]
-> ReadPrec ModelMetadata
-> ReadPrec [ModelMetadata]
-> Read ModelMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModelMetadata]
$creadListPrec :: ReadPrec [ModelMetadata]
readPrec :: ReadPrec ModelMetadata
$creadPrec :: ReadPrec ModelMetadata
readList :: ReadS [ModelMetadata]
$creadList :: ReadS [ModelMetadata]
readsPrec :: Int -> ReadS ModelMetadata
$creadsPrec :: Int -> ReadS ModelMetadata
Prelude.Read, Int -> ModelMetadata -> ShowS
[ModelMetadata] -> ShowS
ModelMetadata -> String
(Int -> ModelMetadata -> ShowS)
-> (ModelMetadata -> String)
-> ([ModelMetadata] -> ShowS)
-> Show ModelMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModelMetadata] -> ShowS
$cshowList :: [ModelMetadata] -> ShowS
show :: ModelMetadata -> String
$cshow :: ModelMetadata -> String
showsPrec :: Int -> ModelMetadata -> ShowS
$cshowsPrec :: Int -> ModelMetadata -> ShowS
Prelude.Show, (forall x. ModelMetadata -> Rep ModelMetadata x)
-> (forall x. Rep ModelMetadata x -> ModelMetadata)
-> Generic ModelMetadata
forall x. Rep ModelMetadata x -> ModelMetadata
forall x. ModelMetadata -> Rep ModelMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModelMetadata x -> ModelMetadata
$cfrom :: forall x. ModelMetadata -> Rep ModelMetadata x
Prelude.Generic)

-- |
-- Create a value of 'ModelMetadata' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'status', 'modelMetadata_status' - The status of the model.
--
-- 'modelArn', 'modelMetadata_modelArn' - The Amazon Resource Name (ARN) of the model.
--
-- 'performance', 'modelMetadata_performance' - Performance metrics for the model. Not available until training has
-- successfully completed.
--
-- 'statusMessage', 'modelMetadata_statusMessage' - The status message for the model.
--
-- 'creationTimestamp', 'modelMetadata_creationTimestamp' - The unix timestamp for the date and time that the model was created.
--
-- 'modelVersion', 'modelMetadata_modelVersion' - The version of the model.
--
-- 'description', 'modelMetadata_description' - The description for the model.
newModelMetadata ::
  ModelMetadata
newModelMetadata :: ModelMetadata
newModelMetadata =
  ModelMetadata' :: Maybe ModelStatus
-> Maybe Text
-> Maybe ModelPerformance
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> ModelMetadata
ModelMetadata'
    { $sel:status:ModelMetadata' :: Maybe ModelStatus
status = Maybe ModelStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:modelArn:ModelMetadata' :: Maybe Text
modelArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:performance:ModelMetadata' :: Maybe ModelPerformance
performance = Maybe ModelPerformance
forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:ModelMetadata' :: Maybe Text
statusMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimestamp:ModelMetadata' :: Maybe POSIX
creationTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:modelVersion:ModelMetadata' :: Maybe Text
modelVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:ModelMetadata' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the model.
modelMetadata_status :: Lens.Lens' ModelMetadata (Prelude.Maybe ModelStatus)
modelMetadata_status :: (Maybe ModelStatus -> f (Maybe ModelStatus))
-> ModelMetadata -> f ModelMetadata
modelMetadata_status = (ModelMetadata -> Maybe ModelStatus)
-> (ModelMetadata -> Maybe ModelStatus -> ModelMetadata)
-> Lens
     ModelMetadata ModelMetadata (Maybe ModelStatus) (Maybe ModelStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelMetadata' {Maybe ModelStatus
status :: Maybe ModelStatus
$sel:status:ModelMetadata' :: ModelMetadata -> Maybe ModelStatus
status} -> Maybe ModelStatus
status) (\s :: ModelMetadata
s@ModelMetadata' {} Maybe ModelStatus
a -> ModelMetadata
s {$sel:status:ModelMetadata' :: Maybe ModelStatus
status = Maybe ModelStatus
a} :: ModelMetadata)

-- | The Amazon Resource Name (ARN) of the model.
modelMetadata_modelArn :: Lens.Lens' ModelMetadata (Prelude.Maybe Prelude.Text)
modelMetadata_modelArn :: (Maybe Text -> f (Maybe Text)) -> ModelMetadata -> f ModelMetadata
modelMetadata_modelArn = (ModelMetadata -> Maybe Text)
-> (ModelMetadata -> Maybe Text -> ModelMetadata)
-> Lens ModelMetadata ModelMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelMetadata' {Maybe Text
modelArn :: Maybe Text
$sel:modelArn:ModelMetadata' :: ModelMetadata -> Maybe Text
modelArn} -> Maybe Text
modelArn) (\s :: ModelMetadata
s@ModelMetadata' {} Maybe Text
a -> ModelMetadata
s {$sel:modelArn:ModelMetadata' :: Maybe Text
modelArn = Maybe Text
a} :: ModelMetadata)

-- | Performance metrics for the model. Not available until training has
-- successfully completed.
modelMetadata_performance :: Lens.Lens' ModelMetadata (Prelude.Maybe ModelPerformance)
modelMetadata_performance :: (Maybe ModelPerformance -> f (Maybe ModelPerformance))
-> ModelMetadata -> f ModelMetadata
modelMetadata_performance = (ModelMetadata -> Maybe ModelPerformance)
-> (ModelMetadata -> Maybe ModelPerformance -> ModelMetadata)
-> Lens
     ModelMetadata
     ModelMetadata
     (Maybe ModelPerformance)
     (Maybe ModelPerformance)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelMetadata' {Maybe ModelPerformance
performance :: Maybe ModelPerformance
$sel:performance:ModelMetadata' :: ModelMetadata -> Maybe ModelPerformance
performance} -> Maybe ModelPerformance
performance) (\s :: ModelMetadata
s@ModelMetadata' {} Maybe ModelPerformance
a -> ModelMetadata
s {$sel:performance:ModelMetadata' :: Maybe ModelPerformance
performance = Maybe ModelPerformance
a} :: ModelMetadata)

-- | The status message for the model.
modelMetadata_statusMessage :: Lens.Lens' ModelMetadata (Prelude.Maybe Prelude.Text)
modelMetadata_statusMessage :: (Maybe Text -> f (Maybe Text)) -> ModelMetadata -> f ModelMetadata
modelMetadata_statusMessage = (ModelMetadata -> Maybe Text)
-> (ModelMetadata -> Maybe Text -> ModelMetadata)
-> Lens ModelMetadata ModelMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelMetadata' {Maybe Text
statusMessage :: Maybe Text
$sel:statusMessage:ModelMetadata' :: ModelMetadata -> Maybe Text
statusMessage} -> Maybe Text
statusMessage) (\s :: ModelMetadata
s@ModelMetadata' {} Maybe Text
a -> ModelMetadata
s {$sel:statusMessage:ModelMetadata' :: Maybe Text
statusMessage = Maybe Text
a} :: ModelMetadata)

-- | The unix timestamp for the date and time that the model was created.
modelMetadata_creationTimestamp :: Lens.Lens' ModelMetadata (Prelude.Maybe Prelude.UTCTime)
modelMetadata_creationTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ModelMetadata -> f ModelMetadata
modelMetadata_creationTimestamp = (ModelMetadata -> Maybe POSIX)
-> (ModelMetadata -> Maybe POSIX -> ModelMetadata)
-> Lens ModelMetadata ModelMetadata (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelMetadata' {Maybe POSIX
creationTimestamp :: Maybe POSIX
$sel:creationTimestamp:ModelMetadata' :: ModelMetadata -> Maybe POSIX
creationTimestamp} -> Maybe POSIX
creationTimestamp) (\s :: ModelMetadata
s@ModelMetadata' {} Maybe POSIX
a -> ModelMetadata
s {$sel:creationTimestamp:ModelMetadata' :: Maybe POSIX
creationTimestamp = Maybe POSIX
a} :: ModelMetadata) ((Maybe POSIX -> f (Maybe POSIX))
 -> ModelMetadata -> f ModelMetadata)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ModelMetadata
-> f ModelMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The version of the model.
modelMetadata_modelVersion :: Lens.Lens' ModelMetadata (Prelude.Maybe Prelude.Text)
modelMetadata_modelVersion :: (Maybe Text -> f (Maybe Text)) -> ModelMetadata -> f ModelMetadata
modelMetadata_modelVersion = (ModelMetadata -> Maybe Text)
-> (ModelMetadata -> Maybe Text -> ModelMetadata)
-> Lens ModelMetadata ModelMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelMetadata' {Maybe Text
modelVersion :: Maybe Text
$sel:modelVersion:ModelMetadata' :: ModelMetadata -> Maybe Text
modelVersion} -> Maybe Text
modelVersion) (\s :: ModelMetadata
s@ModelMetadata' {} Maybe Text
a -> ModelMetadata
s {$sel:modelVersion:ModelMetadata' :: Maybe Text
modelVersion = Maybe Text
a} :: ModelMetadata)

-- | The description for the model.
modelMetadata_description :: Lens.Lens' ModelMetadata (Prelude.Maybe Prelude.Text)
modelMetadata_description :: (Maybe Text -> f (Maybe Text)) -> ModelMetadata -> f ModelMetadata
modelMetadata_description = (ModelMetadata -> Maybe Text)
-> (ModelMetadata -> Maybe Text -> ModelMetadata)
-> Lens ModelMetadata ModelMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelMetadata' {Maybe Text
description :: Maybe Text
$sel:description:ModelMetadata' :: ModelMetadata -> Maybe Text
description} -> Maybe Text
description) (\s :: ModelMetadata
s@ModelMetadata' {} Maybe Text
a -> ModelMetadata
s {$sel:description:ModelMetadata' :: Maybe Text
description = Maybe Text
a} :: ModelMetadata)

instance Core.FromJSON ModelMetadata where
  parseJSON :: Value -> Parser ModelMetadata
parseJSON =
    String
-> (Object -> Parser ModelMetadata)
-> Value
-> Parser ModelMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ModelMetadata"
      ( \Object
x ->
          Maybe ModelStatus
-> Maybe Text
-> Maybe ModelPerformance
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> ModelMetadata
ModelMetadata'
            (Maybe ModelStatus
 -> Maybe Text
 -> Maybe ModelPerformance
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> ModelMetadata)
-> Parser (Maybe ModelStatus)
-> Parser
     (Maybe Text
      -> Maybe ModelPerformance
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> ModelMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ModelStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe Text
   -> Maybe ModelPerformance
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> ModelMetadata)
-> Parser (Maybe Text)
-> Parser
     (Maybe ModelPerformance
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> ModelMetadata)
forall (f :: * -> *) a b. Applicative f => 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
"ModelArn")
            Parser
  (Maybe ModelPerformance
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> ModelMetadata)
-> Parser (Maybe ModelPerformance)
-> Parser
     (Maybe Text
      -> Maybe POSIX -> Maybe Text -> Maybe Text -> ModelMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ModelPerformance)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Performance")
            Parser
  (Maybe Text
   -> Maybe POSIX -> Maybe Text -> Maybe Text -> ModelMetadata)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX -> Maybe Text -> Maybe Text -> ModelMetadata)
forall (f :: * -> *) a b. Applicative f => 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
"StatusMessage")
            Parser (Maybe POSIX -> Maybe Text -> Maybe Text -> ModelMetadata)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe Text -> ModelMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreationTimestamp")
            Parser (Maybe Text -> Maybe Text -> ModelMetadata)
-> Parser (Maybe Text) -> Parser (Maybe Text -> ModelMetadata)
forall (f :: * -> *) a b. Applicative f => 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
"ModelVersion")
            Parser (Maybe Text -> ModelMetadata)
-> Parser (Maybe Text) -> Parser ModelMetadata
forall (f :: * -> *) a b. Applicative f => 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
"Description")
      )

instance Prelude.Hashable ModelMetadata

instance Prelude.NFData ModelMetadata