{-# 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-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.InstanceGroupTimeline 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 instance group lifecycle.
--
-- /See:/ 'newInstanceGroupTimeline' smart constructor.
data InstanceGroupTimeline = InstanceGroupTimeline'
  { -- | The creation date and time of the instance group.
    InstanceGroupTimeline -> Maybe POSIX
creationDateTime :: Prelude.Maybe Data.POSIX,
    -- | The date and time when the instance group terminated.
    InstanceGroupTimeline -> Maybe POSIX
endDateTime :: Prelude.Maybe Data.POSIX,
    -- | The date and time when the instance group became ready to perform tasks.
    InstanceGroupTimeline -> Maybe POSIX
readyDateTime :: Prelude.Maybe Data.POSIX
  }
  deriving (InstanceGroupTimeline -> InstanceGroupTimeline -> Bool
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]
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
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. 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:
--
-- 'creationDateTime', 'instanceGroupTimeline_creationDateTime' - The creation date and time of the instance group.
--
-- 'endDateTime', 'instanceGroupTimeline_endDateTime' - The date and time when the instance group terminated.
--
-- 'readyDateTime', 'instanceGroupTimeline_readyDateTime' - The date and time when the instance group became ready to perform tasks.
newInstanceGroupTimeline ::
  InstanceGroupTimeline
newInstanceGroupTimeline :: InstanceGroupTimeline
newInstanceGroupTimeline =
  InstanceGroupTimeline'
    { $sel:creationDateTime:InstanceGroupTimeline' :: Maybe POSIX
creationDateTime =
        forall a. Maybe a
Prelude.Nothing,
      $sel:endDateTime:InstanceGroupTimeline' :: Maybe POSIX
endDateTime = forall a. Maybe a
Prelude.Nothing,
      $sel:readyDateTime:InstanceGroupTimeline' :: Maybe POSIX
readyDateTime = forall a. Maybe a
Prelude.Nothing
    }

-- | The creation date and time of the instance group.
instanceGroupTimeline_creationDateTime :: Lens.Lens' InstanceGroupTimeline (Prelude.Maybe Prelude.UTCTime)
instanceGroupTimeline_creationDateTime :: Lens' InstanceGroupTimeline (Maybe UTCTime)
instanceGroupTimeline_creationDateTime = 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) 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 instance group terminated.
instanceGroupTimeline_endDateTime :: Lens.Lens' InstanceGroupTimeline (Prelude.Maybe Prelude.UTCTime)
instanceGroupTimeline_endDateTime :: Lens' InstanceGroupTimeline (Maybe UTCTime)
instanceGroupTimeline_endDateTime = 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) 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 instance group became ready to perform tasks.
instanceGroupTimeline_readyDateTime :: Lens.Lens' InstanceGroupTimeline (Prelude.Maybe Prelude.UTCTime)
instanceGroupTimeline_readyDateTime :: Lens' InstanceGroupTimeline (Maybe UTCTime)
instanceGroupTimeline_readyDateTime = 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) 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 InstanceGroupTimeline where
  parseJSON :: Value -> Parser InstanceGroupTimeline
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InstanceGroupTimeline"
      ( \Object
x ->
          Maybe POSIX -> Maybe POSIX -> Maybe POSIX -> InstanceGroupTimeline
InstanceGroupTimeline'
            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
"ReadyDateTime")
      )

instance Prelude.Hashable InstanceGroupTimeline where
  hashWithSalt :: Int -> InstanceGroupTimeline -> Int
hashWithSalt Int
_salt InstanceGroupTimeline' {Maybe POSIX
readyDateTime :: Maybe POSIX
endDateTime :: Maybe POSIX
creationDateTime :: Maybe POSIX
$sel:readyDateTime:InstanceGroupTimeline' :: InstanceGroupTimeline -> Maybe POSIX
$sel:endDateTime:InstanceGroupTimeline' :: InstanceGroupTimeline -> Maybe POSIX
$sel:creationDateTime:InstanceGroupTimeline' :: InstanceGroupTimeline -> 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
readyDateTime

instance Prelude.NFData InstanceGroupTimeline where
  rnf :: InstanceGroupTimeline -> ()
rnf InstanceGroupTimeline' {Maybe POSIX
readyDateTime :: Maybe POSIX
endDateTime :: Maybe POSIX
creationDateTime :: Maybe POSIX
$sel:readyDateTime:InstanceGroupTimeline' :: InstanceGroupTimeline -> Maybe POSIX
$sel:endDateTime:InstanceGroupTimeline' :: InstanceGroupTimeline -> Maybe POSIX
$sel:creationDateTime:InstanceGroupTimeline' :: InstanceGroupTimeline -> 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
readyDateTime