{-# 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.InstanceGroupTimeline
-- 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.InstanceGroupTimeline where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The timeline of the instance group lifecycle.
--
-- /See:/ 'newInstanceGroupTimeline' smart constructor.
data InstanceGroupTimeline = InstanceGroupTimeline'
  { -- | The date and time when the instance group became ready to perform tasks.
    InstanceGroupTimeline -> Maybe POSIX
readyDateTime :: Prelude.Maybe Core.POSIX,
    -- | The creation date and time of the instance group.
    InstanceGroupTimeline -> Maybe POSIX
creationDateTime :: Prelude.Maybe Core.POSIX,
    -- | The date and time when the instance group terminated.
    InstanceGroupTimeline -> Maybe POSIX
endDateTime :: Prelude.Maybe Core.POSIX
  }
  deriving (InstanceGroupTimeline -> InstanceGroupTimeline -> Bool
(InstanceGroupTimeline -> InstanceGroupTimeline -> Bool)
-> (InstanceGroupTimeline -> InstanceGroupTimeline -> Bool)
-> Eq InstanceGroupTimeline
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceGroupTimeline -> InstanceGroupTimeline -> Bool
$c/= :: InstanceGroupTimeline -> InstanceGroupTimeline -> Bool
== :: InstanceGroupTimeline -> InstanceGroupTimeline -> Bool
$c== :: InstanceGroupTimeline -> InstanceGroupTimeline -> Bool
Prelude.Eq, ReadPrec [InstanceGroupTimeline]
ReadPrec InstanceGroupTimeline
Int -> ReadS InstanceGroupTimeline
ReadS [InstanceGroupTimeline]
(Int -> ReadS InstanceGroupTimeline)
-> ReadS [InstanceGroupTimeline]
-> ReadPrec InstanceGroupTimeline
-> ReadPrec [InstanceGroupTimeline]
-> Read InstanceGroupTimeline
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceGroupTimeline]
$creadListPrec :: ReadPrec [InstanceGroupTimeline]
readPrec :: ReadPrec InstanceGroupTimeline
$creadPrec :: ReadPrec InstanceGroupTimeline
readList :: ReadS [InstanceGroupTimeline]
$creadList :: ReadS [InstanceGroupTimeline]
readsPrec :: Int -> ReadS InstanceGroupTimeline
$creadsPrec :: Int -> ReadS InstanceGroupTimeline
Prelude.Read, Int -> InstanceGroupTimeline -> ShowS
[InstanceGroupTimeline] -> ShowS
InstanceGroupTimeline -> String
(Int -> InstanceGroupTimeline -> ShowS)
-> (InstanceGroupTimeline -> String)
-> ([InstanceGroupTimeline] -> ShowS)
-> Show InstanceGroupTimeline
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceGroupTimeline] -> ShowS
$cshowList :: [InstanceGroupTimeline] -> ShowS
show :: InstanceGroupTimeline -> String
$cshow :: InstanceGroupTimeline -> String
showsPrec :: Int -> InstanceGroupTimeline -> ShowS
$cshowsPrec :: Int -> InstanceGroupTimeline -> ShowS
Prelude.Show, (forall x. InstanceGroupTimeline -> Rep InstanceGroupTimeline x)
-> (forall x. Rep InstanceGroupTimeline x -> InstanceGroupTimeline)
-> Generic InstanceGroupTimeline
forall x. Rep InstanceGroupTimeline x -> InstanceGroupTimeline
forall x. InstanceGroupTimeline -> Rep InstanceGroupTimeline x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceGroupTimeline x -> InstanceGroupTimeline
$cfrom :: forall x. InstanceGroupTimeline -> Rep InstanceGroupTimeline x
Prelude.Generic)

-- |
-- Create a value of 'InstanceGroupTimeline' 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:
--
-- 'readyDateTime', 'instanceGroupTimeline_readyDateTime' - The date and time when the instance group became ready to perform tasks.
--
-- 'creationDateTime', 'instanceGroupTimeline_creationDateTime' - The creation date and time of the instance group.
--
-- 'endDateTime', 'instanceGroupTimeline_endDateTime' - The date and time when the instance group terminated.
newInstanceGroupTimeline ::
  InstanceGroupTimeline
newInstanceGroupTimeline :: InstanceGroupTimeline
newInstanceGroupTimeline =
  InstanceGroupTimeline' :: Maybe POSIX -> Maybe POSIX -> Maybe POSIX -> InstanceGroupTimeline
InstanceGroupTimeline'
    { $sel:readyDateTime:InstanceGroupTimeline' :: Maybe POSIX
readyDateTime =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDateTime:InstanceGroupTimeline' :: Maybe POSIX
creationDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:endDateTime:InstanceGroupTimeline' :: Maybe POSIX
endDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time when the instance group became ready to perform tasks.
instanceGroupTimeline_readyDateTime :: Lens.Lens' InstanceGroupTimeline (Prelude.Maybe Prelude.UTCTime)
instanceGroupTimeline_readyDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> InstanceGroupTimeline -> f InstanceGroupTimeline
instanceGroupTimeline_readyDateTime = (InstanceGroupTimeline -> Maybe POSIX)
-> (InstanceGroupTimeline -> Maybe POSIX -> InstanceGroupTimeline)
-> Lens
     InstanceGroupTimeline
     InstanceGroupTimeline
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceGroupTimeline' {Maybe POSIX
readyDateTime :: Maybe POSIX
$sel:readyDateTime:InstanceGroupTimeline' :: InstanceGroupTimeline -> Maybe POSIX
readyDateTime} -> Maybe POSIX
readyDateTime) (\s :: InstanceGroupTimeline
s@InstanceGroupTimeline' {} Maybe POSIX
a -> InstanceGroupTimeline
s {$sel:readyDateTime:InstanceGroupTimeline' :: Maybe POSIX
readyDateTime = Maybe POSIX
a} :: InstanceGroupTimeline) ((Maybe POSIX -> f (Maybe POSIX))
 -> InstanceGroupTimeline -> f InstanceGroupTimeline)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> InstanceGroupTimeline
-> f InstanceGroupTimeline
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 creation date and time of the instance group.
instanceGroupTimeline_creationDateTime :: Lens.Lens' InstanceGroupTimeline (Prelude.Maybe Prelude.UTCTime)
instanceGroupTimeline_creationDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> InstanceGroupTimeline -> f InstanceGroupTimeline
instanceGroupTimeline_creationDateTime = (InstanceGroupTimeline -> Maybe POSIX)
-> (InstanceGroupTimeline -> Maybe POSIX -> InstanceGroupTimeline)
-> Lens
     InstanceGroupTimeline
     InstanceGroupTimeline
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceGroupTimeline' {Maybe POSIX
creationDateTime :: Maybe POSIX
$sel:creationDateTime:InstanceGroupTimeline' :: InstanceGroupTimeline -> Maybe POSIX
creationDateTime} -> Maybe POSIX
creationDateTime) (\s :: InstanceGroupTimeline
s@InstanceGroupTimeline' {} Maybe POSIX
a -> InstanceGroupTimeline
s {$sel:creationDateTime:InstanceGroupTimeline' :: Maybe POSIX
creationDateTime = Maybe POSIX
a} :: InstanceGroupTimeline) ((Maybe POSIX -> f (Maybe POSIX))
 -> InstanceGroupTimeline -> f InstanceGroupTimeline)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> InstanceGroupTimeline
-> f InstanceGroupTimeline
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 instance group terminated.
instanceGroupTimeline_endDateTime :: Lens.Lens' InstanceGroupTimeline (Prelude.Maybe Prelude.UTCTime)
instanceGroupTimeline_endDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> InstanceGroupTimeline -> f InstanceGroupTimeline
instanceGroupTimeline_endDateTime = (InstanceGroupTimeline -> Maybe POSIX)
-> (InstanceGroupTimeline -> Maybe POSIX -> InstanceGroupTimeline)
-> Lens
     InstanceGroupTimeline
     InstanceGroupTimeline
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceGroupTimeline' {Maybe POSIX
endDateTime :: Maybe POSIX
$sel:endDateTime:InstanceGroupTimeline' :: InstanceGroupTimeline -> Maybe POSIX
endDateTime} -> Maybe POSIX
endDateTime) (\s :: InstanceGroupTimeline
s@InstanceGroupTimeline' {} Maybe POSIX
a -> InstanceGroupTimeline
s {$sel:endDateTime:InstanceGroupTimeline' :: Maybe POSIX
endDateTime = Maybe POSIX
a} :: InstanceGroupTimeline) ((Maybe POSIX -> f (Maybe POSIX))
 -> InstanceGroupTimeline -> f InstanceGroupTimeline)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> InstanceGroupTimeline
-> f InstanceGroupTimeline
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 InstanceGroupTimeline where
  parseJSON :: Value -> Parser InstanceGroupTimeline
parseJSON =
    String
-> (Object -> Parser InstanceGroupTimeline)
-> Value
-> Parser InstanceGroupTimeline
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InstanceGroupTimeline"
      ( \Object
x ->
          Maybe POSIX -> Maybe POSIX -> Maybe POSIX -> InstanceGroupTimeline
InstanceGroupTimeline'
            (Maybe POSIX
 -> Maybe POSIX -> Maybe POSIX -> InstanceGroupTimeline)
-> Parser (Maybe POSIX)
-> Parser (Maybe POSIX -> Maybe POSIX -> InstanceGroupTimeline)
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
"ReadyDateTime")
            Parser (Maybe POSIX -> Maybe POSIX -> InstanceGroupTimeline)
-> Parser (Maybe POSIX)
-> Parser (Maybe POSIX -> InstanceGroupTimeline)
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
"CreationDateTime")
            Parser (Maybe POSIX -> InstanceGroupTimeline)
-> Parser (Maybe POSIX) -> Parser InstanceGroupTimeline
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")
      )

instance Prelude.Hashable InstanceGroupTimeline

instance Prelude.NFData InstanceGroupTimeline