{-# 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.SageMaker.Types.TrainingJobSummary
-- 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.SageMaker.Types.TrainingJobSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.TrainingJobStatus

-- | Provides summary information about a training job.
--
-- /See:/ 'newTrainingJobSummary' smart constructor.
data TrainingJobSummary = TrainingJobSummary'
  { -- | A timestamp that shows when the training job ended. This field is set
    -- only if the training job has one of the terminal statuses (@Completed@,
    -- @Failed@, or @Stopped@).
    TrainingJobSummary -> Maybe POSIX
trainingEndTime :: Prelude.Maybe Core.POSIX,
    -- | Timestamp when the training job was last modified.
    TrainingJobSummary -> Maybe POSIX
lastModifiedTime :: Prelude.Maybe Core.POSIX,
    -- | The name of the training job that you want a summary for.
    TrainingJobSummary -> Text
trainingJobName :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the training job.
    TrainingJobSummary -> Text
trainingJobArn :: Prelude.Text,
    -- | A timestamp that shows when the training job was created.
    TrainingJobSummary -> POSIX
creationTime :: Core.POSIX,
    -- | The status of the training job.
    TrainingJobSummary -> TrainingJobStatus
trainingJobStatus :: TrainingJobStatus
  }
  deriving (TrainingJobSummary -> TrainingJobSummary -> Bool
(TrainingJobSummary -> TrainingJobSummary -> Bool)
-> (TrainingJobSummary -> TrainingJobSummary -> Bool)
-> Eq TrainingJobSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TrainingJobSummary -> TrainingJobSummary -> Bool
$c/= :: TrainingJobSummary -> TrainingJobSummary -> Bool
== :: TrainingJobSummary -> TrainingJobSummary -> Bool
$c== :: TrainingJobSummary -> TrainingJobSummary -> Bool
Prelude.Eq, ReadPrec [TrainingJobSummary]
ReadPrec TrainingJobSummary
Int -> ReadS TrainingJobSummary
ReadS [TrainingJobSummary]
(Int -> ReadS TrainingJobSummary)
-> ReadS [TrainingJobSummary]
-> ReadPrec TrainingJobSummary
-> ReadPrec [TrainingJobSummary]
-> Read TrainingJobSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TrainingJobSummary]
$creadListPrec :: ReadPrec [TrainingJobSummary]
readPrec :: ReadPrec TrainingJobSummary
$creadPrec :: ReadPrec TrainingJobSummary
readList :: ReadS [TrainingJobSummary]
$creadList :: ReadS [TrainingJobSummary]
readsPrec :: Int -> ReadS TrainingJobSummary
$creadsPrec :: Int -> ReadS TrainingJobSummary
Prelude.Read, Int -> TrainingJobSummary -> ShowS
[TrainingJobSummary] -> ShowS
TrainingJobSummary -> String
(Int -> TrainingJobSummary -> ShowS)
-> (TrainingJobSummary -> String)
-> ([TrainingJobSummary] -> ShowS)
-> Show TrainingJobSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TrainingJobSummary] -> ShowS
$cshowList :: [TrainingJobSummary] -> ShowS
show :: TrainingJobSummary -> String
$cshow :: TrainingJobSummary -> String
showsPrec :: Int -> TrainingJobSummary -> ShowS
$cshowsPrec :: Int -> TrainingJobSummary -> ShowS
Prelude.Show, (forall x. TrainingJobSummary -> Rep TrainingJobSummary x)
-> (forall x. Rep TrainingJobSummary x -> TrainingJobSummary)
-> Generic TrainingJobSummary
forall x. Rep TrainingJobSummary x -> TrainingJobSummary
forall x. TrainingJobSummary -> Rep TrainingJobSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TrainingJobSummary x -> TrainingJobSummary
$cfrom :: forall x. TrainingJobSummary -> Rep TrainingJobSummary x
Prelude.Generic)

-- |
-- Create a value of 'TrainingJobSummary' 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:
--
-- 'trainingEndTime', 'trainingJobSummary_trainingEndTime' - A timestamp that shows when the training job ended. This field is set
-- only if the training job has one of the terminal statuses (@Completed@,
-- @Failed@, or @Stopped@).
--
-- 'lastModifiedTime', 'trainingJobSummary_lastModifiedTime' - Timestamp when the training job was last modified.
--
-- 'trainingJobName', 'trainingJobSummary_trainingJobName' - The name of the training job that you want a summary for.
--
-- 'trainingJobArn', 'trainingJobSummary_trainingJobArn' - The Amazon Resource Name (ARN) of the training job.
--
-- 'creationTime', 'trainingJobSummary_creationTime' - A timestamp that shows when the training job was created.
--
-- 'trainingJobStatus', 'trainingJobSummary_trainingJobStatus' - The status of the training job.
newTrainingJobSummary ::
  -- | 'trainingJobName'
  Prelude.Text ->
  -- | 'trainingJobArn'
  Prelude.Text ->
  -- | 'creationTime'
  Prelude.UTCTime ->
  -- | 'trainingJobStatus'
  TrainingJobStatus ->
  TrainingJobSummary
newTrainingJobSummary :: Text -> Text -> UTCTime -> TrainingJobStatus -> TrainingJobSummary
newTrainingJobSummary
  Text
pTrainingJobName_
  Text
pTrainingJobArn_
  UTCTime
pCreationTime_
  TrainingJobStatus
pTrainingJobStatus_ =
    TrainingJobSummary' :: Maybe POSIX
-> Maybe POSIX
-> Text
-> Text
-> POSIX
-> TrainingJobStatus
-> TrainingJobSummary
TrainingJobSummary'
      { $sel:trainingEndTime:TrainingJobSummary' :: Maybe POSIX
trainingEndTime =
          Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:lastModifiedTime:TrainingJobSummary' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:trainingJobName:TrainingJobSummary' :: Text
trainingJobName = Text
pTrainingJobName_,
        $sel:trainingJobArn:TrainingJobSummary' :: Text
trainingJobArn = Text
pTrainingJobArn_,
        $sel:creationTime:TrainingJobSummary' :: POSIX
creationTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationTime_,
        $sel:trainingJobStatus:TrainingJobSummary' :: TrainingJobStatus
trainingJobStatus = TrainingJobStatus
pTrainingJobStatus_
      }

-- | A timestamp that shows when the training job ended. This field is set
-- only if the training job has one of the terminal statuses (@Completed@,
-- @Failed@, or @Stopped@).
trainingJobSummary_trainingEndTime :: Lens.Lens' TrainingJobSummary (Prelude.Maybe Prelude.UTCTime)
trainingJobSummary_trainingEndTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> TrainingJobSummary -> f TrainingJobSummary
trainingJobSummary_trainingEndTime = (TrainingJobSummary -> Maybe POSIX)
-> (TrainingJobSummary -> Maybe POSIX -> TrainingJobSummary)
-> Lens
     TrainingJobSummary TrainingJobSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingJobSummary' {Maybe POSIX
trainingEndTime :: Maybe POSIX
$sel:trainingEndTime:TrainingJobSummary' :: TrainingJobSummary -> Maybe POSIX
trainingEndTime} -> Maybe POSIX
trainingEndTime) (\s :: TrainingJobSummary
s@TrainingJobSummary' {} Maybe POSIX
a -> TrainingJobSummary
s {$sel:trainingEndTime:TrainingJobSummary' :: Maybe POSIX
trainingEndTime = Maybe POSIX
a} :: TrainingJobSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> TrainingJobSummary -> f TrainingJobSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> TrainingJobSummary
-> f TrainingJobSummary
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

-- | Timestamp when the training job was last modified.
trainingJobSummary_lastModifiedTime :: Lens.Lens' TrainingJobSummary (Prelude.Maybe Prelude.UTCTime)
trainingJobSummary_lastModifiedTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> TrainingJobSummary -> f TrainingJobSummary
trainingJobSummary_lastModifiedTime = (TrainingJobSummary -> Maybe POSIX)
-> (TrainingJobSummary -> Maybe POSIX -> TrainingJobSummary)
-> Lens
     TrainingJobSummary TrainingJobSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingJobSummary' {Maybe POSIX
lastModifiedTime :: Maybe POSIX
$sel:lastModifiedTime:TrainingJobSummary' :: TrainingJobSummary -> Maybe POSIX
lastModifiedTime} -> Maybe POSIX
lastModifiedTime) (\s :: TrainingJobSummary
s@TrainingJobSummary' {} Maybe POSIX
a -> TrainingJobSummary
s {$sel:lastModifiedTime:TrainingJobSummary' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
a} :: TrainingJobSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> TrainingJobSummary -> f TrainingJobSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> TrainingJobSummary
-> f TrainingJobSummary
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 name of the training job that you want a summary for.
trainingJobSummary_trainingJobName :: Lens.Lens' TrainingJobSummary Prelude.Text
trainingJobSummary_trainingJobName :: (Text -> f Text) -> TrainingJobSummary -> f TrainingJobSummary
trainingJobSummary_trainingJobName = (TrainingJobSummary -> Text)
-> (TrainingJobSummary -> Text -> TrainingJobSummary)
-> Lens TrainingJobSummary TrainingJobSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingJobSummary' {Text
trainingJobName :: Text
$sel:trainingJobName:TrainingJobSummary' :: TrainingJobSummary -> Text
trainingJobName} -> Text
trainingJobName) (\s :: TrainingJobSummary
s@TrainingJobSummary' {} Text
a -> TrainingJobSummary
s {$sel:trainingJobName:TrainingJobSummary' :: Text
trainingJobName = Text
a} :: TrainingJobSummary)

-- | The Amazon Resource Name (ARN) of the training job.
trainingJobSummary_trainingJobArn :: Lens.Lens' TrainingJobSummary Prelude.Text
trainingJobSummary_trainingJobArn :: (Text -> f Text) -> TrainingJobSummary -> f TrainingJobSummary
trainingJobSummary_trainingJobArn = (TrainingJobSummary -> Text)
-> (TrainingJobSummary -> Text -> TrainingJobSummary)
-> Lens TrainingJobSummary TrainingJobSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingJobSummary' {Text
trainingJobArn :: Text
$sel:trainingJobArn:TrainingJobSummary' :: TrainingJobSummary -> Text
trainingJobArn} -> Text
trainingJobArn) (\s :: TrainingJobSummary
s@TrainingJobSummary' {} Text
a -> TrainingJobSummary
s {$sel:trainingJobArn:TrainingJobSummary' :: Text
trainingJobArn = Text
a} :: TrainingJobSummary)

-- | A timestamp that shows when the training job was created.
trainingJobSummary_creationTime :: Lens.Lens' TrainingJobSummary Prelude.UTCTime
trainingJobSummary_creationTime :: (UTCTime -> f UTCTime)
-> TrainingJobSummary -> f TrainingJobSummary
trainingJobSummary_creationTime = (TrainingJobSummary -> POSIX)
-> (TrainingJobSummary -> POSIX -> TrainingJobSummary)
-> Lens TrainingJobSummary TrainingJobSummary POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingJobSummary' {POSIX
creationTime :: POSIX
$sel:creationTime:TrainingJobSummary' :: TrainingJobSummary -> POSIX
creationTime} -> POSIX
creationTime) (\s :: TrainingJobSummary
s@TrainingJobSummary' {} POSIX
a -> TrainingJobSummary
s {$sel:creationTime:TrainingJobSummary' :: POSIX
creationTime = POSIX
a} :: TrainingJobSummary) ((POSIX -> f POSIX) -> TrainingJobSummary -> f TrainingJobSummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> TrainingJobSummary
-> f TrainingJobSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The status of the training job.
trainingJobSummary_trainingJobStatus :: Lens.Lens' TrainingJobSummary TrainingJobStatus
trainingJobSummary_trainingJobStatus :: (TrainingJobStatus -> f TrainingJobStatus)
-> TrainingJobSummary -> f TrainingJobSummary
trainingJobSummary_trainingJobStatus = (TrainingJobSummary -> TrainingJobStatus)
-> (TrainingJobSummary -> TrainingJobStatus -> TrainingJobSummary)
-> Lens
     TrainingJobSummary
     TrainingJobSummary
     TrainingJobStatus
     TrainingJobStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingJobSummary' {TrainingJobStatus
trainingJobStatus :: TrainingJobStatus
$sel:trainingJobStatus:TrainingJobSummary' :: TrainingJobSummary -> TrainingJobStatus
trainingJobStatus} -> TrainingJobStatus
trainingJobStatus) (\s :: TrainingJobSummary
s@TrainingJobSummary' {} TrainingJobStatus
a -> TrainingJobSummary
s {$sel:trainingJobStatus:TrainingJobSummary' :: TrainingJobStatus
trainingJobStatus = TrainingJobStatus
a} :: TrainingJobSummary)

instance Core.FromJSON TrainingJobSummary where
  parseJSON :: Value -> Parser TrainingJobSummary
parseJSON =
    String
-> (Object -> Parser TrainingJobSummary)
-> Value
-> Parser TrainingJobSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TrainingJobSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe POSIX
-> Text
-> Text
-> POSIX
-> TrainingJobStatus
-> TrainingJobSummary
TrainingJobSummary'
            (Maybe POSIX
 -> Maybe POSIX
 -> Text
 -> Text
 -> POSIX
 -> TrainingJobStatus
 -> TrainingJobSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX
      -> Text
      -> Text
      -> POSIX
      -> TrainingJobStatus
      -> TrainingJobSummary)
forall (f :: * -> *) a b. Functor 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
"TrainingEndTime")
            Parser
  (Maybe POSIX
   -> Text
   -> Text
   -> POSIX
   -> TrainingJobStatus
   -> TrainingJobSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Text -> Text -> POSIX -> TrainingJobStatus -> TrainingJobSummary)
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
"LastModifiedTime")
            Parser
  (Text -> Text -> POSIX -> TrainingJobStatus -> TrainingJobSummary)
-> Parser Text
-> Parser
     (Text -> POSIX -> TrainingJobStatus -> TrainingJobSummary)
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
"TrainingJobName")
            Parser (Text -> POSIX -> TrainingJobStatus -> TrainingJobSummary)
-> Parser Text
-> Parser (POSIX -> TrainingJobStatus -> TrainingJobSummary)
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
"TrainingJobArn")
            Parser (POSIX -> TrainingJobStatus -> TrainingJobSummary)
-> Parser POSIX -> Parser (TrainingJobStatus -> TrainingJobSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"CreationTime")
            Parser (TrainingJobStatus -> TrainingJobSummary)
-> Parser TrainingJobStatus -> Parser TrainingJobSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser TrainingJobStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TrainingJobStatus")
      )

instance Prelude.Hashable TrainingJobSummary

instance Prelude.NFData TrainingJobSummary