{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SageMaker.Types.TrainingJobSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.TrainingJobStatus
import Amazonka.SageMaker.Types.WarmPoolStatus

-- | Provides summary information about a training job.
--
-- /See:/ 'newTrainingJobSummary' smart constructor.
data TrainingJobSummary = TrainingJobSummary'
  { -- | Timestamp when the training job was last modified.
    TrainingJobSummary -> Maybe POSIX
lastModifiedTime :: Prelude.Maybe Data.POSIX,
    -- | 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 Data.POSIX,
    -- | The status of the warm pool associated with the training job.
    TrainingJobSummary -> Maybe WarmPoolStatus
warmPoolStatus :: Prelude.Maybe WarmPoolStatus,
    -- | 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 :: Data.POSIX,
    -- | The status of the training job.
    TrainingJobSummary -> TrainingJobStatus
trainingJobStatus :: TrainingJobStatus
  }
  deriving (TrainingJobSummary -> TrainingJobSummary -> Bool
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]
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
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. 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:
--
-- 'lastModifiedTime', 'trainingJobSummary_lastModifiedTime' - Timestamp when the training job was last modified.
--
-- '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@).
--
-- 'warmPoolStatus', 'trainingJobSummary_warmPoolStatus' - The status of the warm pool associated with the training job.
--
-- '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'
      { $sel:lastModifiedTime:TrainingJobSummary' :: Maybe POSIX
lastModifiedTime =
          forall a. Maybe a
Prelude.Nothing,
        $sel:trainingEndTime:TrainingJobSummary' :: Maybe POSIX
trainingEndTime = forall a. Maybe a
Prelude.Nothing,
        $sel:warmPoolStatus:TrainingJobSummary' :: Maybe WarmPoolStatus
warmPoolStatus = 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 = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationTime_,
        $sel:trainingJobStatus:TrainingJobSummary' :: TrainingJobStatus
trainingJobStatus = TrainingJobStatus
pTrainingJobStatus_
      }

-- | Timestamp when the training job was last modified.
trainingJobSummary_lastModifiedTime :: Lens.Lens' TrainingJobSummary (Prelude.Maybe Prelude.UTCTime)
trainingJobSummary_lastModifiedTime :: Lens' TrainingJobSummary (Maybe UTCTime)
trainingJobSummary_lastModifiedTime = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | 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 :: Lens' TrainingJobSummary (Maybe UTCTime)
trainingJobSummary_trainingEndTime = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The status of the warm pool associated with the training job.
trainingJobSummary_warmPoolStatus :: Lens.Lens' TrainingJobSummary (Prelude.Maybe WarmPoolStatus)
trainingJobSummary_warmPoolStatus :: Lens' TrainingJobSummary (Maybe WarmPoolStatus)
trainingJobSummary_warmPoolStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingJobSummary' {Maybe WarmPoolStatus
warmPoolStatus :: Maybe WarmPoolStatus
$sel:warmPoolStatus:TrainingJobSummary' :: TrainingJobSummary -> Maybe WarmPoolStatus
warmPoolStatus} -> Maybe WarmPoolStatus
warmPoolStatus) (\s :: TrainingJobSummary
s@TrainingJobSummary' {} Maybe WarmPoolStatus
a -> TrainingJobSummary
s {$sel:warmPoolStatus:TrainingJobSummary' :: Maybe WarmPoolStatus
warmPoolStatus = Maybe WarmPoolStatus
a} :: TrainingJobSummary)

-- | The name of the training job that you want a summary for.
trainingJobSummary_trainingJobName :: Lens.Lens' TrainingJobSummary Prelude.Text
trainingJobSummary_trainingJobName :: Lens' TrainingJobSummary Text
trainingJobSummary_trainingJobName = 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 :: Lens' TrainingJobSummary Text
trainingJobSummary_trainingJobArn = 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 :: Lens' TrainingJobSummary UTCTime
trainingJobSummary_creationTime = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The status of the training job.
trainingJobSummary_trainingJobStatus :: Lens.Lens' TrainingJobSummary TrainingJobStatus
trainingJobSummary_trainingJobStatus :: Lens' TrainingJobSummary TrainingJobStatus
trainingJobSummary_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 Data.FromJSON TrainingJobSummary where
  parseJSON :: Value -> Parser TrainingJobSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TrainingJobSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe POSIX
-> Maybe WarmPoolStatus
-> Text
-> Text
-> POSIX
-> TrainingJobStatus
-> TrainingJobSummary
TrainingJobSummary'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LastModifiedTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"TrainingEndTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"WarmPoolStatus")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"TrainingJobName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"TrainingJobArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"CreationTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"TrainingJobStatus")
      )

instance Prelude.Hashable TrainingJobSummary where
  hashWithSalt :: Int -> TrainingJobSummary -> Int
hashWithSalt Int
_salt TrainingJobSummary' {Maybe POSIX
Maybe WarmPoolStatus
Text
POSIX
TrainingJobStatus
trainingJobStatus :: TrainingJobStatus
creationTime :: POSIX
trainingJobArn :: Text
trainingJobName :: Text
warmPoolStatus :: Maybe WarmPoolStatus
trainingEndTime :: Maybe POSIX
lastModifiedTime :: Maybe POSIX
$sel:trainingJobStatus:TrainingJobSummary' :: TrainingJobSummary -> TrainingJobStatus
$sel:creationTime:TrainingJobSummary' :: TrainingJobSummary -> POSIX
$sel:trainingJobArn:TrainingJobSummary' :: TrainingJobSummary -> Text
$sel:trainingJobName:TrainingJobSummary' :: TrainingJobSummary -> Text
$sel:warmPoolStatus:TrainingJobSummary' :: TrainingJobSummary -> Maybe WarmPoolStatus
$sel:trainingEndTime:TrainingJobSummary' :: TrainingJobSummary -> Maybe POSIX
$sel:lastModifiedTime:TrainingJobSummary' :: TrainingJobSummary -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastModifiedTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
trainingEndTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe WarmPoolStatus
warmPoolStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
trainingJobName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
trainingJobArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` TrainingJobStatus
trainingJobStatus

instance Prelude.NFData TrainingJobSummary where
  rnf :: TrainingJobSummary -> ()
rnf TrainingJobSummary' {Maybe POSIX
Maybe WarmPoolStatus
Text
POSIX
TrainingJobStatus
trainingJobStatus :: TrainingJobStatus
creationTime :: POSIX
trainingJobArn :: Text
trainingJobName :: Text
warmPoolStatus :: Maybe WarmPoolStatus
trainingEndTime :: Maybe POSIX
lastModifiedTime :: Maybe POSIX
$sel:trainingJobStatus:TrainingJobSummary' :: TrainingJobSummary -> TrainingJobStatus
$sel:creationTime:TrainingJobSummary' :: TrainingJobSummary -> POSIX
$sel:trainingJobArn:TrainingJobSummary' :: TrainingJobSummary -> Text
$sel:trainingJobName:TrainingJobSummary' :: TrainingJobSummary -> Text
$sel:warmPoolStatus:TrainingJobSummary' :: TrainingJobSummary -> Maybe WarmPoolStatus
$sel:trainingEndTime:TrainingJobSummary' :: TrainingJobSummary -> Maybe POSIX
$sel:lastModifiedTime:TrainingJobSummary' :: TrainingJobSummary -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastModifiedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
trainingEndTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe WarmPoolStatus
warmPoolStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
trainingJobName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
trainingJobArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf TrainingJobStatus
trainingJobStatus