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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 Core.POSIX,
    -- | The date and time when the cluster step execution completed or failed.
    StepTimeline -> Maybe POSIX
endDateTime :: Prelude.Maybe Core.POSIX,
    -- | The date and time when the cluster step execution started.
    StepTimeline -> Maybe POSIX
startDateTime :: Prelude.Maybe Core.POSIX
  }
  deriving (StepTimeline -> StepTimeline -> Bool
(StepTimeline -> StepTimeline -> Bool)
-> (StepTimeline -> StepTimeline -> Bool) -> Eq StepTimeline
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]
(Int -> ReadS StepTimeline)
-> ReadS [StepTimeline]
-> ReadPrec StepTimeline
-> ReadPrec [StepTimeline]
-> Read 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
(Int -> StepTimeline -> ShowS)
-> (StepTimeline -> String)
-> ([StepTimeline] -> ShowS)
-> Show StepTimeline
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. StepTimeline -> Rep StepTimeline x)
-> (forall x. Rep StepTimeline x -> StepTimeline)
-> Generic StepTimeline
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' :: Maybe POSIX -> Maybe POSIX -> Maybe POSIX -> StepTimeline
StepTimeline'
    { $sel:creationDateTime:StepTimeline' :: Maybe POSIX
creationDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:endDateTime:StepTimeline' :: Maybe POSIX
endDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:startDateTime:StepTimeline' :: Maybe POSIX
startDateTime = Maybe POSIX
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 :: (Maybe UTCTime -> f (Maybe UTCTime))
-> StepTimeline -> f StepTimeline
stepTimeline_creationDateTime = (StepTimeline -> Maybe POSIX)
-> (StepTimeline -> Maybe POSIX -> StepTimeline)
-> Lens StepTimeline StepTimeline (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> StepTimeline -> f StepTimeline)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> StepTimeline
-> f StepTimeline
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 date and time when the cluster step execution completed or failed.
stepTimeline_endDateTime :: Lens.Lens' StepTimeline (Prelude.Maybe Prelude.UTCTime)
stepTimeline_endDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> StepTimeline -> f StepTimeline
stepTimeline_endDateTime = (StepTimeline -> Maybe POSIX)
-> (StepTimeline -> Maybe POSIX -> StepTimeline)
-> Lens StepTimeline StepTimeline (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> StepTimeline -> f StepTimeline)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> StepTimeline
-> f StepTimeline
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 date and time when the cluster step execution started.
stepTimeline_startDateTime :: Lens.Lens' StepTimeline (Prelude.Maybe Prelude.UTCTime)
stepTimeline_startDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> StepTimeline -> f StepTimeline
stepTimeline_startDateTime = (StepTimeline -> Maybe POSIX)
-> (StepTimeline -> Maybe POSIX -> StepTimeline)
-> Lens StepTimeline StepTimeline (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> StepTimeline -> f StepTimeline)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> StepTimeline
-> f StepTimeline
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

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

instance Prelude.Hashable StepTimeline

instance Prelude.NFData StepTimeline