{-# 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.Glue.Types.TaskRun
-- 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.Glue.Types.TaskRun where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Glue.Types.TaskRunProperties
import Amazonka.Glue.Types.TaskStatusType
import qualified Amazonka.Prelude as Prelude

-- | The sampling parameters that are associated with the machine learning
-- transform.
--
-- /See:/ 'newTaskRun' smart constructor.
data TaskRun = TaskRun'
  { -- | The last point in time that the requested task run was completed.
    TaskRun -> Maybe POSIX
completedOn :: Prelude.Maybe Data.POSIX,
    -- | The list of error strings associated with this task run.
    TaskRun -> Maybe Text
errorString :: Prelude.Maybe Prelude.Text,
    -- | The amount of time (in seconds) that the task run consumed resources.
    TaskRun -> Maybe Int
executionTime :: Prelude.Maybe Prelude.Int,
    -- | The last point in time that the requested task run was updated.
    TaskRun -> Maybe POSIX
lastModifiedOn :: Prelude.Maybe Data.POSIX,
    -- | The names of the log group for secure logging, associated with this task
    -- run.
    TaskRun -> Maybe Text
logGroupName :: Prelude.Maybe Prelude.Text,
    -- | Specifies configuration properties associated with this task run.
    TaskRun -> Maybe TaskRunProperties
properties :: Prelude.Maybe TaskRunProperties,
    -- | The date and time that this task run started.
    TaskRun -> Maybe POSIX
startedOn :: Prelude.Maybe Data.POSIX,
    -- | The current status of the requested task run.
    TaskRun -> Maybe TaskStatusType
status :: Prelude.Maybe TaskStatusType,
    -- | The unique identifier for this task run.
    TaskRun -> Maybe Text
taskRunId :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for the transform.
    TaskRun -> Maybe Text
transformId :: Prelude.Maybe Prelude.Text
  }
  deriving (TaskRun -> TaskRun -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TaskRun -> TaskRun -> Bool
$c/= :: TaskRun -> TaskRun -> Bool
== :: TaskRun -> TaskRun -> Bool
$c== :: TaskRun -> TaskRun -> Bool
Prelude.Eq, ReadPrec [TaskRun]
ReadPrec TaskRun
Int -> ReadS TaskRun
ReadS [TaskRun]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TaskRun]
$creadListPrec :: ReadPrec [TaskRun]
readPrec :: ReadPrec TaskRun
$creadPrec :: ReadPrec TaskRun
readList :: ReadS [TaskRun]
$creadList :: ReadS [TaskRun]
readsPrec :: Int -> ReadS TaskRun
$creadsPrec :: Int -> ReadS TaskRun
Prelude.Read, Int -> TaskRun -> ShowS
[TaskRun] -> ShowS
TaskRun -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TaskRun] -> ShowS
$cshowList :: [TaskRun] -> ShowS
show :: TaskRun -> String
$cshow :: TaskRun -> String
showsPrec :: Int -> TaskRun -> ShowS
$cshowsPrec :: Int -> TaskRun -> ShowS
Prelude.Show, forall x. Rep TaskRun x -> TaskRun
forall x. TaskRun -> Rep TaskRun x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TaskRun x -> TaskRun
$cfrom :: forall x. TaskRun -> Rep TaskRun x
Prelude.Generic)

-- |
-- Create a value of 'TaskRun' 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:
--
-- 'completedOn', 'taskRun_completedOn' - The last point in time that the requested task run was completed.
--
-- 'errorString', 'taskRun_errorString' - The list of error strings associated with this task run.
--
-- 'executionTime', 'taskRun_executionTime' - The amount of time (in seconds) that the task run consumed resources.
--
-- 'lastModifiedOn', 'taskRun_lastModifiedOn' - The last point in time that the requested task run was updated.
--
-- 'logGroupName', 'taskRun_logGroupName' - The names of the log group for secure logging, associated with this task
-- run.
--
-- 'properties', 'taskRun_properties' - Specifies configuration properties associated with this task run.
--
-- 'startedOn', 'taskRun_startedOn' - The date and time that this task run started.
--
-- 'status', 'taskRun_status' - The current status of the requested task run.
--
-- 'taskRunId', 'taskRun_taskRunId' - The unique identifier for this task run.
--
-- 'transformId', 'taskRun_transformId' - The unique identifier for the transform.
newTaskRun ::
  TaskRun
newTaskRun :: TaskRun
newTaskRun =
  TaskRun'
    { $sel:completedOn:TaskRun' :: Maybe POSIX
completedOn = forall a. Maybe a
Prelude.Nothing,
      $sel:errorString:TaskRun' :: Maybe Text
errorString = forall a. Maybe a
Prelude.Nothing,
      $sel:executionTime:TaskRun' :: Maybe Int
executionTime = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedOn:TaskRun' :: Maybe POSIX
lastModifiedOn = forall a. Maybe a
Prelude.Nothing,
      $sel:logGroupName:TaskRun' :: Maybe Text
logGroupName = forall a. Maybe a
Prelude.Nothing,
      $sel:properties:TaskRun' :: Maybe TaskRunProperties
properties = forall a. Maybe a
Prelude.Nothing,
      $sel:startedOn:TaskRun' :: Maybe POSIX
startedOn = forall a. Maybe a
Prelude.Nothing,
      $sel:status:TaskRun' :: Maybe TaskStatusType
status = forall a. Maybe a
Prelude.Nothing,
      $sel:taskRunId:TaskRun' :: Maybe Text
taskRunId = forall a. Maybe a
Prelude.Nothing,
      $sel:transformId:TaskRun' :: Maybe Text
transformId = forall a. Maybe a
Prelude.Nothing
    }

-- | The last point in time that the requested task run was completed.
taskRun_completedOn :: Lens.Lens' TaskRun (Prelude.Maybe Prelude.UTCTime)
taskRun_completedOn :: Lens' TaskRun (Maybe UTCTime)
taskRun_completedOn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskRun' {Maybe POSIX
completedOn :: Maybe POSIX
$sel:completedOn:TaskRun' :: TaskRun -> Maybe POSIX
completedOn} -> Maybe POSIX
completedOn) (\s :: TaskRun
s@TaskRun' {} Maybe POSIX
a -> TaskRun
s {$sel:completedOn:TaskRun' :: Maybe POSIX
completedOn = Maybe POSIX
a} :: TaskRun) 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 list of error strings associated with this task run.
taskRun_errorString :: Lens.Lens' TaskRun (Prelude.Maybe Prelude.Text)
taskRun_errorString :: Lens' TaskRun (Maybe Text)
taskRun_errorString = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskRun' {Maybe Text
errorString :: Maybe Text
$sel:errorString:TaskRun' :: TaskRun -> Maybe Text
errorString} -> Maybe Text
errorString) (\s :: TaskRun
s@TaskRun' {} Maybe Text
a -> TaskRun
s {$sel:errorString:TaskRun' :: Maybe Text
errorString = Maybe Text
a} :: TaskRun)

-- | The amount of time (in seconds) that the task run consumed resources.
taskRun_executionTime :: Lens.Lens' TaskRun (Prelude.Maybe Prelude.Int)
taskRun_executionTime :: Lens' TaskRun (Maybe Int)
taskRun_executionTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskRun' {Maybe Int
executionTime :: Maybe Int
$sel:executionTime:TaskRun' :: TaskRun -> Maybe Int
executionTime} -> Maybe Int
executionTime) (\s :: TaskRun
s@TaskRun' {} Maybe Int
a -> TaskRun
s {$sel:executionTime:TaskRun' :: Maybe Int
executionTime = Maybe Int
a} :: TaskRun)

-- | The last point in time that the requested task run was updated.
taskRun_lastModifiedOn :: Lens.Lens' TaskRun (Prelude.Maybe Prelude.UTCTime)
taskRun_lastModifiedOn :: Lens' TaskRun (Maybe UTCTime)
taskRun_lastModifiedOn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskRun' {Maybe POSIX
lastModifiedOn :: Maybe POSIX
$sel:lastModifiedOn:TaskRun' :: TaskRun -> Maybe POSIX
lastModifiedOn} -> Maybe POSIX
lastModifiedOn) (\s :: TaskRun
s@TaskRun' {} Maybe POSIX
a -> TaskRun
s {$sel:lastModifiedOn:TaskRun' :: Maybe POSIX
lastModifiedOn = Maybe POSIX
a} :: TaskRun) 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 names of the log group for secure logging, associated with this task
-- run.
taskRun_logGroupName :: Lens.Lens' TaskRun (Prelude.Maybe Prelude.Text)
taskRun_logGroupName :: Lens' TaskRun (Maybe Text)
taskRun_logGroupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskRun' {Maybe Text
logGroupName :: Maybe Text
$sel:logGroupName:TaskRun' :: TaskRun -> Maybe Text
logGroupName} -> Maybe Text
logGroupName) (\s :: TaskRun
s@TaskRun' {} Maybe Text
a -> TaskRun
s {$sel:logGroupName:TaskRun' :: Maybe Text
logGroupName = Maybe Text
a} :: TaskRun)

-- | Specifies configuration properties associated with this task run.
taskRun_properties :: Lens.Lens' TaskRun (Prelude.Maybe TaskRunProperties)
taskRun_properties :: Lens' TaskRun (Maybe TaskRunProperties)
taskRun_properties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskRun' {Maybe TaskRunProperties
properties :: Maybe TaskRunProperties
$sel:properties:TaskRun' :: TaskRun -> Maybe TaskRunProperties
properties} -> Maybe TaskRunProperties
properties) (\s :: TaskRun
s@TaskRun' {} Maybe TaskRunProperties
a -> TaskRun
s {$sel:properties:TaskRun' :: Maybe TaskRunProperties
properties = Maybe TaskRunProperties
a} :: TaskRun)

-- | The date and time that this task run started.
taskRun_startedOn :: Lens.Lens' TaskRun (Prelude.Maybe Prelude.UTCTime)
taskRun_startedOn :: Lens' TaskRun (Maybe UTCTime)
taskRun_startedOn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskRun' {Maybe POSIX
startedOn :: Maybe POSIX
$sel:startedOn:TaskRun' :: TaskRun -> Maybe POSIX
startedOn} -> Maybe POSIX
startedOn) (\s :: TaskRun
s@TaskRun' {} Maybe POSIX
a -> TaskRun
s {$sel:startedOn:TaskRun' :: Maybe POSIX
startedOn = Maybe POSIX
a} :: TaskRun) 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 current status of the requested task run.
taskRun_status :: Lens.Lens' TaskRun (Prelude.Maybe TaskStatusType)
taskRun_status :: Lens' TaskRun (Maybe TaskStatusType)
taskRun_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskRun' {Maybe TaskStatusType
status :: Maybe TaskStatusType
$sel:status:TaskRun' :: TaskRun -> Maybe TaskStatusType
status} -> Maybe TaskStatusType
status) (\s :: TaskRun
s@TaskRun' {} Maybe TaskStatusType
a -> TaskRun
s {$sel:status:TaskRun' :: Maybe TaskStatusType
status = Maybe TaskStatusType
a} :: TaskRun)

-- | The unique identifier for this task run.
taskRun_taskRunId :: Lens.Lens' TaskRun (Prelude.Maybe Prelude.Text)
taskRun_taskRunId :: Lens' TaskRun (Maybe Text)
taskRun_taskRunId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskRun' {Maybe Text
taskRunId :: Maybe Text
$sel:taskRunId:TaskRun' :: TaskRun -> Maybe Text
taskRunId} -> Maybe Text
taskRunId) (\s :: TaskRun
s@TaskRun' {} Maybe Text
a -> TaskRun
s {$sel:taskRunId:TaskRun' :: Maybe Text
taskRunId = Maybe Text
a} :: TaskRun)

-- | The unique identifier for the transform.
taskRun_transformId :: Lens.Lens' TaskRun (Prelude.Maybe Prelude.Text)
taskRun_transformId :: Lens' TaskRun (Maybe Text)
taskRun_transformId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskRun' {Maybe Text
transformId :: Maybe Text
$sel:transformId:TaskRun' :: TaskRun -> Maybe Text
transformId} -> Maybe Text
transformId) (\s :: TaskRun
s@TaskRun' {} Maybe Text
a -> TaskRun
s {$sel:transformId:TaskRun' :: Maybe Text
transformId = Maybe Text
a} :: TaskRun)

instance Data.FromJSON TaskRun where
  parseJSON :: Value -> Parser TaskRun
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TaskRun"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Int
-> Maybe POSIX
-> Maybe Text
-> Maybe TaskRunProperties
-> Maybe POSIX
-> Maybe TaskStatusType
-> Maybe Text
-> Maybe Text
-> TaskRun
TaskRun'
            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
"CompletedOn")
            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
"ErrorString")
            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
"ExecutionTime")
            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
"LastModifiedOn")
            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
"LogGroupName")
            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
"Properties")
            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
"StartedOn")
            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
"Status")
            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
"TaskRunId")
            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
"TransformId")
      )

instance Prelude.Hashable TaskRun where
  hashWithSalt :: Int -> TaskRun -> Int
hashWithSalt Int
_salt TaskRun' {Maybe Int
Maybe Text
Maybe POSIX
Maybe TaskStatusType
Maybe TaskRunProperties
transformId :: Maybe Text
taskRunId :: Maybe Text
status :: Maybe TaskStatusType
startedOn :: Maybe POSIX
properties :: Maybe TaskRunProperties
logGroupName :: Maybe Text
lastModifiedOn :: Maybe POSIX
executionTime :: Maybe Int
errorString :: Maybe Text
completedOn :: Maybe POSIX
$sel:transformId:TaskRun' :: TaskRun -> Maybe Text
$sel:taskRunId:TaskRun' :: TaskRun -> Maybe Text
$sel:status:TaskRun' :: TaskRun -> Maybe TaskStatusType
$sel:startedOn:TaskRun' :: TaskRun -> Maybe POSIX
$sel:properties:TaskRun' :: TaskRun -> Maybe TaskRunProperties
$sel:logGroupName:TaskRun' :: TaskRun -> Maybe Text
$sel:lastModifiedOn:TaskRun' :: TaskRun -> Maybe POSIX
$sel:executionTime:TaskRun' :: TaskRun -> Maybe Int
$sel:errorString:TaskRun' :: TaskRun -> Maybe Text
$sel:completedOn:TaskRun' :: TaskRun -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
completedOn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorString
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
executionTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastModifiedOn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
logGroupName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TaskRunProperties
properties
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
startedOn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TaskStatusType
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
taskRunId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
transformId

instance Prelude.NFData TaskRun where
  rnf :: TaskRun -> ()
rnf TaskRun' {Maybe Int
Maybe Text
Maybe POSIX
Maybe TaskStatusType
Maybe TaskRunProperties
transformId :: Maybe Text
taskRunId :: Maybe Text
status :: Maybe TaskStatusType
startedOn :: Maybe POSIX
properties :: Maybe TaskRunProperties
logGroupName :: Maybe Text
lastModifiedOn :: Maybe POSIX
executionTime :: Maybe Int
errorString :: Maybe Text
completedOn :: Maybe POSIX
$sel:transformId:TaskRun' :: TaskRun -> Maybe Text
$sel:taskRunId:TaskRun' :: TaskRun -> Maybe Text
$sel:status:TaskRun' :: TaskRun -> Maybe TaskStatusType
$sel:startedOn:TaskRun' :: TaskRun -> Maybe POSIX
$sel:properties:TaskRun' :: TaskRun -> Maybe TaskRunProperties
$sel:logGroupName:TaskRun' :: TaskRun -> Maybe Text
$sel:lastModifiedOn:TaskRun' :: TaskRun -> Maybe POSIX
$sel:executionTime:TaskRun' :: TaskRun -> Maybe Int
$sel:errorString:TaskRun' :: TaskRun -> Maybe Text
$sel:completedOn:TaskRun' :: TaskRun -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
completedOn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorString
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
executionTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastModifiedOn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
logGroupName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TaskRunProperties
properties
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
startedOn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TaskStatusType
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
taskRunId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
transformId