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

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

-- | Provides historical timestamps for the instance fleet, including the
-- time of creation, the time it became ready to run jobs, and the time of
-- termination.
--
-- The instance fleet configuration is available only in Amazon EMR
-- versions 4.8.0 and later, excluding 5.0.x versions.
--
-- /See:/ 'newInstanceFleetTimeline' smart constructor.
data InstanceFleetTimeline = InstanceFleetTimeline'
  { -- | The time and date the instance fleet was ready to run jobs.
    InstanceFleetTimeline -> Maybe POSIX
readyDateTime :: Prelude.Maybe Core.POSIX,
    -- | The time and date the instance fleet was created.
    InstanceFleetTimeline -> Maybe POSIX
creationDateTime :: Prelude.Maybe Core.POSIX,
    -- | The time and date the instance fleet terminated.
    InstanceFleetTimeline -> Maybe POSIX
endDateTime :: Prelude.Maybe Core.POSIX
  }
  deriving (InstanceFleetTimeline -> InstanceFleetTimeline -> Bool
(InstanceFleetTimeline -> InstanceFleetTimeline -> Bool)
-> (InstanceFleetTimeline -> InstanceFleetTimeline -> Bool)
-> Eq InstanceFleetTimeline
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceFleetTimeline -> InstanceFleetTimeline -> Bool
$c/= :: InstanceFleetTimeline -> InstanceFleetTimeline -> Bool
== :: InstanceFleetTimeline -> InstanceFleetTimeline -> Bool
$c== :: InstanceFleetTimeline -> InstanceFleetTimeline -> Bool
Prelude.Eq, ReadPrec [InstanceFleetTimeline]
ReadPrec InstanceFleetTimeline
Int -> ReadS InstanceFleetTimeline
ReadS [InstanceFleetTimeline]
(Int -> ReadS InstanceFleetTimeline)
-> ReadS [InstanceFleetTimeline]
-> ReadPrec InstanceFleetTimeline
-> ReadPrec [InstanceFleetTimeline]
-> Read InstanceFleetTimeline
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceFleetTimeline]
$creadListPrec :: ReadPrec [InstanceFleetTimeline]
readPrec :: ReadPrec InstanceFleetTimeline
$creadPrec :: ReadPrec InstanceFleetTimeline
readList :: ReadS [InstanceFleetTimeline]
$creadList :: ReadS [InstanceFleetTimeline]
readsPrec :: Int -> ReadS InstanceFleetTimeline
$creadsPrec :: Int -> ReadS InstanceFleetTimeline
Prelude.Read, Int -> InstanceFleetTimeline -> ShowS
[InstanceFleetTimeline] -> ShowS
InstanceFleetTimeline -> String
(Int -> InstanceFleetTimeline -> ShowS)
-> (InstanceFleetTimeline -> String)
-> ([InstanceFleetTimeline] -> ShowS)
-> Show InstanceFleetTimeline
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceFleetTimeline] -> ShowS
$cshowList :: [InstanceFleetTimeline] -> ShowS
show :: InstanceFleetTimeline -> String
$cshow :: InstanceFleetTimeline -> String
showsPrec :: Int -> InstanceFleetTimeline -> ShowS
$cshowsPrec :: Int -> InstanceFleetTimeline -> ShowS
Prelude.Show, (forall x. InstanceFleetTimeline -> Rep InstanceFleetTimeline x)
-> (forall x. Rep InstanceFleetTimeline x -> InstanceFleetTimeline)
-> Generic InstanceFleetTimeline
forall x. Rep InstanceFleetTimeline x -> InstanceFleetTimeline
forall x. InstanceFleetTimeline -> Rep InstanceFleetTimeline x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceFleetTimeline x -> InstanceFleetTimeline
$cfrom :: forall x. InstanceFleetTimeline -> Rep InstanceFleetTimeline x
Prelude.Generic)

-- |
-- Create a value of 'InstanceFleetTimeline' 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', 'instanceFleetTimeline_readyDateTime' - The time and date the instance fleet was ready to run jobs.
--
-- 'creationDateTime', 'instanceFleetTimeline_creationDateTime' - The time and date the instance fleet was created.
--
-- 'endDateTime', 'instanceFleetTimeline_endDateTime' - The time and date the instance fleet terminated.
newInstanceFleetTimeline ::
  InstanceFleetTimeline
newInstanceFleetTimeline :: InstanceFleetTimeline
newInstanceFleetTimeline =
  InstanceFleetTimeline' :: Maybe POSIX -> Maybe POSIX -> Maybe POSIX -> InstanceFleetTimeline
InstanceFleetTimeline'
    { $sel:readyDateTime:InstanceFleetTimeline' :: Maybe POSIX
readyDateTime =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDateTime:InstanceFleetTimeline' :: Maybe POSIX
creationDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:endDateTime:InstanceFleetTimeline' :: Maybe POSIX
endDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The time and date the instance fleet was ready to run jobs.
instanceFleetTimeline_readyDateTime :: Lens.Lens' InstanceFleetTimeline (Prelude.Maybe Prelude.UTCTime)
instanceFleetTimeline_readyDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> InstanceFleetTimeline -> f InstanceFleetTimeline
instanceFleetTimeline_readyDateTime = (InstanceFleetTimeline -> Maybe POSIX)
-> (InstanceFleetTimeline -> Maybe POSIX -> InstanceFleetTimeline)
-> Lens
     InstanceFleetTimeline
     InstanceFleetTimeline
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceFleetTimeline' {Maybe POSIX
readyDateTime :: Maybe POSIX
$sel:readyDateTime:InstanceFleetTimeline' :: InstanceFleetTimeline -> Maybe POSIX
readyDateTime} -> Maybe POSIX
readyDateTime) (\s :: InstanceFleetTimeline
s@InstanceFleetTimeline' {} Maybe POSIX
a -> InstanceFleetTimeline
s {$sel:readyDateTime:InstanceFleetTimeline' :: Maybe POSIX
readyDateTime = Maybe POSIX
a} :: InstanceFleetTimeline) ((Maybe POSIX -> f (Maybe POSIX))
 -> InstanceFleetTimeline -> f InstanceFleetTimeline)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> InstanceFleetTimeline
-> f InstanceFleetTimeline
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 time and date the instance fleet was created.
instanceFleetTimeline_creationDateTime :: Lens.Lens' InstanceFleetTimeline (Prelude.Maybe Prelude.UTCTime)
instanceFleetTimeline_creationDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> InstanceFleetTimeline -> f InstanceFleetTimeline
instanceFleetTimeline_creationDateTime = (InstanceFleetTimeline -> Maybe POSIX)
-> (InstanceFleetTimeline -> Maybe POSIX -> InstanceFleetTimeline)
-> Lens
     InstanceFleetTimeline
     InstanceFleetTimeline
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceFleetTimeline' {Maybe POSIX
creationDateTime :: Maybe POSIX
$sel:creationDateTime:InstanceFleetTimeline' :: InstanceFleetTimeline -> Maybe POSIX
creationDateTime} -> Maybe POSIX
creationDateTime) (\s :: InstanceFleetTimeline
s@InstanceFleetTimeline' {} Maybe POSIX
a -> InstanceFleetTimeline
s {$sel:creationDateTime:InstanceFleetTimeline' :: Maybe POSIX
creationDateTime = Maybe POSIX
a} :: InstanceFleetTimeline) ((Maybe POSIX -> f (Maybe POSIX))
 -> InstanceFleetTimeline -> f InstanceFleetTimeline)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> InstanceFleetTimeline
-> f InstanceFleetTimeline
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 time and date the instance fleet terminated.
instanceFleetTimeline_endDateTime :: Lens.Lens' InstanceFleetTimeline (Prelude.Maybe Prelude.UTCTime)
instanceFleetTimeline_endDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> InstanceFleetTimeline -> f InstanceFleetTimeline
instanceFleetTimeline_endDateTime = (InstanceFleetTimeline -> Maybe POSIX)
-> (InstanceFleetTimeline -> Maybe POSIX -> InstanceFleetTimeline)
-> Lens
     InstanceFleetTimeline
     InstanceFleetTimeline
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceFleetTimeline' {Maybe POSIX
endDateTime :: Maybe POSIX
$sel:endDateTime:InstanceFleetTimeline' :: InstanceFleetTimeline -> Maybe POSIX
endDateTime} -> Maybe POSIX
endDateTime) (\s :: InstanceFleetTimeline
s@InstanceFleetTimeline' {} Maybe POSIX
a -> InstanceFleetTimeline
s {$sel:endDateTime:InstanceFleetTimeline' :: Maybe POSIX
endDateTime = Maybe POSIX
a} :: InstanceFleetTimeline) ((Maybe POSIX -> f (Maybe POSIX))
 -> InstanceFleetTimeline -> f InstanceFleetTimeline)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> InstanceFleetTimeline
-> f InstanceFleetTimeline
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 InstanceFleetTimeline where
  parseJSON :: Value -> Parser InstanceFleetTimeline
parseJSON =
    String
-> (Object -> Parser InstanceFleetTimeline)
-> Value
-> Parser InstanceFleetTimeline
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InstanceFleetTimeline"
      ( \Object
x ->
          Maybe POSIX -> Maybe POSIX -> Maybe POSIX -> InstanceFleetTimeline
InstanceFleetTimeline'
            (Maybe POSIX
 -> Maybe POSIX -> Maybe POSIX -> InstanceFleetTimeline)
-> Parser (Maybe POSIX)
-> Parser (Maybe POSIX -> Maybe POSIX -> InstanceFleetTimeline)
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 -> InstanceFleetTimeline)
-> Parser (Maybe POSIX)
-> Parser (Maybe POSIX -> InstanceFleetTimeline)
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 -> InstanceFleetTimeline)
-> Parser (Maybe POSIX) -> Parser InstanceFleetTimeline
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 InstanceFleetTimeline

instance Prelude.NFData InstanceFleetTimeline