{-# 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.EMR.Types.StepTimeline
-- 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.EMR.Types.StepTimeline 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

-- | The timeline of the cluster step lifecycle.
--
-- /See:/ 'newStepTimeline' smart constructor.
data StepTimeline = StepTimeline'
  { -- | The date and time when the cluster step was created.
    StepTimeline -> Maybe POSIX
creationDateTime :: Prelude.Maybe Data.POSIX,
    -- | The date and time when the cluster step execution completed or failed.
    StepTimeline -> Maybe POSIX
endDateTime :: Prelude.Maybe Data.POSIX,
    -- | The date and time when the cluster step execution started.
    StepTimeline -> Maybe POSIX
startDateTime :: Prelude.Maybe Data.POSIX
  }
  deriving (StepTimeline -> StepTimeline -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StepTimeline -> StepTimeline -> Bool
$c/= :: StepTimeline -> StepTimeline -> Bool
== :: StepTimeline -> StepTimeline -> Bool
$c== :: StepTimeline -> StepTimeline -> Bool
Prelude.Eq, ReadPrec [StepTimeline]
ReadPrec StepTimeline
Int -> ReadS StepTimeline
ReadS [StepTimeline]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StepTimeline]
$creadListPrec :: ReadPrec [StepTimeline]
readPrec :: ReadPrec StepTimeline
$creadPrec :: ReadPrec StepTimeline
readList :: ReadS [StepTimeline]
$creadList :: ReadS [StepTimeline]
readsPrec :: Int -> ReadS StepTimeline
$creadsPrec :: Int -> ReadS StepTimeline
Prelude.Read, Int -> StepTimeline -> ShowS
[StepTimeline] -> ShowS
StepTimeline -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StepTimeline] -> ShowS
$cshowList :: [StepTimeline] -> ShowS
show :: StepTimeline -> String
$cshow :: StepTimeline -> String
showsPrec :: Int -> StepTimeline -> ShowS
$cshowsPrec :: Int -> StepTimeline -> ShowS
Prelude.Show, forall x. Rep StepTimeline x -> StepTimeline
forall x. StepTimeline -> Rep StepTimeline x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StepTimeline x -> StepTimeline
$cfrom :: forall x. StepTimeline -> Rep StepTimeline x
Prelude.Generic)

-- |
-- Create a value of 'StepTimeline' 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:
--
-- 'creationDateTime', 'stepTimeline_creationDateTime' - The date and time when the cluster step was created.
--
-- 'endDateTime', 'stepTimeline_endDateTime' - The date and time when the cluster step execution completed or failed.
--
-- 'startDateTime', 'stepTimeline_startDateTime' - The date and time when the cluster step execution started.
newStepTimeline ::
  StepTimeline
newStepTimeline :: StepTimeline
newStepTimeline =
  StepTimeline'
    { $sel:creationDateTime:StepTimeline' :: Maybe POSIX
creationDateTime = forall a. Maybe a
Prelude.Nothing,
      $sel:endDateTime:StepTimeline' :: Maybe POSIX
endDateTime = forall a. Maybe a
Prelude.Nothing,
      $sel:startDateTime:StepTimeline' :: Maybe POSIX
startDateTime = forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time when the cluster step was created.
stepTimeline_creationDateTime :: Lens.Lens' StepTimeline (Prelude.Maybe Prelude.UTCTime)
stepTimeline_creationDateTime :: Lens' StepTimeline (Maybe UTCTime)
stepTimeline_creationDateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StepTimeline' {Maybe POSIX
creationDateTime :: Maybe POSIX
$sel:creationDateTime:StepTimeline' :: StepTimeline -> Maybe POSIX
creationDateTime} -> Maybe POSIX
creationDateTime) (\s :: StepTimeline
s@StepTimeline' {} Maybe POSIX
a -> StepTimeline
s {$sel:creationDateTime:StepTimeline' :: Maybe POSIX
creationDateTime = Maybe POSIX
a} :: StepTimeline) 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 date and time when the cluster step execution completed or failed.
stepTimeline_endDateTime :: Lens.Lens' StepTimeline (Prelude.Maybe Prelude.UTCTime)
stepTimeline_endDateTime :: Lens' StepTimeline (Maybe UTCTime)
stepTimeline_endDateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StepTimeline' {Maybe POSIX
endDateTime :: Maybe POSIX
$sel:endDateTime:StepTimeline' :: StepTimeline -> Maybe POSIX
endDateTime} -> Maybe POSIX
endDateTime) (\s :: StepTimeline
s@StepTimeline' {} Maybe POSIX
a -> StepTimeline
s {$sel:endDateTime:StepTimeline' :: Maybe POSIX
endDateTime = Maybe POSIX
a} :: StepTimeline) 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 date and time when the cluster step execution started.
stepTimeline_startDateTime :: Lens.Lens' StepTimeline (Prelude.Maybe Prelude.UTCTime)
stepTimeline_startDateTime :: Lens' StepTimeline (Maybe UTCTime)
stepTimeline_startDateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StepTimeline' {Maybe POSIX
startDateTime :: Maybe POSIX
$sel:startDateTime:StepTimeline' :: StepTimeline -> Maybe POSIX
startDateTime} -> Maybe POSIX
startDateTime) (\s :: StepTimeline
s@StepTimeline' {} Maybe POSIX
a -> StepTimeline
s {$sel:startDateTime:StepTimeline' :: Maybe POSIX
startDateTime = Maybe POSIX
a} :: StepTimeline) 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

instance Data.FromJSON StepTimeline where
  parseJSON :: Value -> Parser StepTimeline
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StepTimeline"
      ( \Object
x ->
          Maybe POSIX -> Maybe POSIX -> Maybe POSIX -> StepTimeline
StepTimeline'
            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
"CreationDateTime")
            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
"EndDateTime")
            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
"StartDateTime")
      )

instance Prelude.Hashable StepTimeline where
  hashWithSalt :: Int -> StepTimeline -> Int
hashWithSalt Int
_salt StepTimeline' {Maybe POSIX
startDateTime :: Maybe POSIX
endDateTime :: Maybe POSIX
creationDateTime :: Maybe POSIX
$sel:startDateTime:StepTimeline' :: StepTimeline -> Maybe POSIX
$sel:endDateTime:StepTimeline' :: StepTimeline -> Maybe POSIX
$sel:creationDateTime:StepTimeline' :: StepTimeline -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationDateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
endDateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
startDateTime

instance Prelude.NFData StepTimeline where
  rnf :: StepTimeline -> ()
rnf StepTimeline' {Maybe POSIX
startDateTime :: Maybe POSIX
endDateTime :: Maybe POSIX
creationDateTime :: Maybe POSIX
$sel:startDateTime:StepTimeline' :: StepTimeline -> Maybe POSIX
$sel:endDateTime:StepTimeline' :: StepTimeline -> Maybe POSIX
$sel:creationDateTime:StepTimeline' :: StepTimeline -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationDateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
endDateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
startDateTime