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

import qualified Amazonka.Core as Core
import Amazonka.EMR.Types.InstanceGroupState
import Amazonka.EMR.Types.InstanceGroupStateChangeReason
import Amazonka.EMR.Types.InstanceGroupTimeline
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The details of the instance group status.
--
-- /See:/ 'newInstanceGroupStatus' smart constructor.
data InstanceGroupStatus = InstanceGroupStatus'
  { -- | The current state of the instance group.
    InstanceGroupStatus -> Maybe InstanceGroupState
state :: Prelude.Maybe InstanceGroupState,
    -- | The status change reason details for the instance group.
    InstanceGroupStatus -> Maybe InstanceGroupStateChangeReason
stateChangeReason :: Prelude.Maybe InstanceGroupStateChangeReason,
    -- | The timeline of the instance group status over time.
    InstanceGroupStatus -> Maybe InstanceGroupTimeline
timeline :: Prelude.Maybe InstanceGroupTimeline
  }
  deriving (InstanceGroupStatus -> InstanceGroupStatus -> Bool
(InstanceGroupStatus -> InstanceGroupStatus -> Bool)
-> (InstanceGroupStatus -> InstanceGroupStatus -> Bool)
-> Eq InstanceGroupStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceGroupStatus -> InstanceGroupStatus -> Bool
$c/= :: InstanceGroupStatus -> InstanceGroupStatus -> Bool
== :: InstanceGroupStatus -> InstanceGroupStatus -> Bool
$c== :: InstanceGroupStatus -> InstanceGroupStatus -> Bool
Prelude.Eq, ReadPrec [InstanceGroupStatus]
ReadPrec InstanceGroupStatus
Int -> ReadS InstanceGroupStatus
ReadS [InstanceGroupStatus]
(Int -> ReadS InstanceGroupStatus)
-> ReadS [InstanceGroupStatus]
-> ReadPrec InstanceGroupStatus
-> ReadPrec [InstanceGroupStatus]
-> Read InstanceGroupStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceGroupStatus]
$creadListPrec :: ReadPrec [InstanceGroupStatus]
readPrec :: ReadPrec InstanceGroupStatus
$creadPrec :: ReadPrec InstanceGroupStatus
readList :: ReadS [InstanceGroupStatus]
$creadList :: ReadS [InstanceGroupStatus]
readsPrec :: Int -> ReadS InstanceGroupStatus
$creadsPrec :: Int -> ReadS InstanceGroupStatus
Prelude.Read, Int -> InstanceGroupStatus -> ShowS
[InstanceGroupStatus] -> ShowS
InstanceGroupStatus -> String
(Int -> InstanceGroupStatus -> ShowS)
-> (InstanceGroupStatus -> String)
-> ([InstanceGroupStatus] -> ShowS)
-> Show InstanceGroupStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceGroupStatus] -> ShowS
$cshowList :: [InstanceGroupStatus] -> ShowS
show :: InstanceGroupStatus -> String
$cshow :: InstanceGroupStatus -> String
showsPrec :: Int -> InstanceGroupStatus -> ShowS
$cshowsPrec :: Int -> InstanceGroupStatus -> ShowS
Prelude.Show, (forall x. InstanceGroupStatus -> Rep InstanceGroupStatus x)
-> (forall x. Rep InstanceGroupStatus x -> InstanceGroupStatus)
-> Generic InstanceGroupStatus
forall x. Rep InstanceGroupStatus x -> InstanceGroupStatus
forall x. InstanceGroupStatus -> Rep InstanceGroupStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceGroupStatus x -> InstanceGroupStatus
$cfrom :: forall x. InstanceGroupStatus -> Rep InstanceGroupStatus x
Prelude.Generic)

-- |
-- Create a value of 'InstanceGroupStatus' 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:
--
-- 'state', 'instanceGroupStatus_state' - The current state of the instance group.
--
-- 'stateChangeReason', 'instanceGroupStatus_stateChangeReason' - The status change reason details for the instance group.
--
-- 'timeline', 'instanceGroupStatus_timeline' - The timeline of the instance group status over time.
newInstanceGroupStatus ::
  InstanceGroupStatus
newInstanceGroupStatus :: InstanceGroupStatus
newInstanceGroupStatus =
  InstanceGroupStatus' :: Maybe InstanceGroupState
-> Maybe InstanceGroupStateChangeReason
-> Maybe InstanceGroupTimeline
-> InstanceGroupStatus
InstanceGroupStatus'
    { $sel:state:InstanceGroupStatus' :: Maybe InstanceGroupState
state = Maybe InstanceGroupState
forall a. Maybe a
Prelude.Nothing,
      $sel:stateChangeReason:InstanceGroupStatus' :: Maybe InstanceGroupStateChangeReason
stateChangeReason = Maybe InstanceGroupStateChangeReason
forall a. Maybe a
Prelude.Nothing,
      $sel:timeline:InstanceGroupStatus' :: Maybe InstanceGroupTimeline
timeline = Maybe InstanceGroupTimeline
forall a. Maybe a
Prelude.Nothing
    }

-- | The current state of the instance group.
instanceGroupStatus_state :: Lens.Lens' InstanceGroupStatus (Prelude.Maybe InstanceGroupState)
instanceGroupStatus_state :: (Maybe InstanceGroupState -> f (Maybe InstanceGroupState))
-> InstanceGroupStatus -> f InstanceGroupStatus
instanceGroupStatus_state = (InstanceGroupStatus -> Maybe InstanceGroupState)
-> (InstanceGroupStatus
    -> Maybe InstanceGroupState -> InstanceGroupStatus)
-> Lens
     InstanceGroupStatus
     InstanceGroupStatus
     (Maybe InstanceGroupState)
     (Maybe InstanceGroupState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceGroupStatus' {Maybe InstanceGroupState
state :: Maybe InstanceGroupState
$sel:state:InstanceGroupStatus' :: InstanceGroupStatus -> Maybe InstanceGroupState
state} -> Maybe InstanceGroupState
state) (\s :: InstanceGroupStatus
s@InstanceGroupStatus' {} Maybe InstanceGroupState
a -> InstanceGroupStatus
s {$sel:state:InstanceGroupStatus' :: Maybe InstanceGroupState
state = Maybe InstanceGroupState
a} :: InstanceGroupStatus)

-- | The status change reason details for the instance group.
instanceGroupStatus_stateChangeReason :: Lens.Lens' InstanceGroupStatus (Prelude.Maybe InstanceGroupStateChangeReason)
instanceGroupStatus_stateChangeReason :: (Maybe InstanceGroupStateChangeReason
 -> f (Maybe InstanceGroupStateChangeReason))
-> InstanceGroupStatus -> f InstanceGroupStatus
instanceGroupStatus_stateChangeReason = (InstanceGroupStatus -> Maybe InstanceGroupStateChangeReason)
-> (InstanceGroupStatus
    -> Maybe InstanceGroupStateChangeReason -> InstanceGroupStatus)
-> Lens
     InstanceGroupStatus
     InstanceGroupStatus
     (Maybe InstanceGroupStateChangeReason)
     (Maybe InstanceGroupStateChangeReason)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceGroupStatus' {Maybe InstanceGroupStateChangeReason
stateChangeReason :: Maybe InstanceGroupStateChangeReason
$sel:stateChangeReason:InstanceGroupStatus' :: InstanceGroupStatus -> Maybe InstanceGroupStateChangeReason
stateChangeReason} -> Maybe InstanceGroupStateChangeReason
stateChangeReason) (\s :: InstanceGroupStatus
s@InstanceGroupStatus' {} Maybe InstanceGroupStateChangeReason
a -> InstanceGroupStatus
s {$sel:stateChangeReason:InstanceGroupStatus' :: Maybe InstanceGroupStateChangeReason
stateChangeReason = Maybe InstanceGroupStateChangeReason
a} :: InstanceGroupStatus)

-- | The timeline of the instance group status over time.
instanceGroupStatus_timeline :: Lens.Lens' InstanceGroupStatus (Prelude.Maybe InstanceGroupTimeline)
instanceGroupStatus_timeline :: (Maybe InstanceGroupTimeline -> f (Maybe InstanceGroupTimeline))
-> InstanceGroupStatus -> f InstanceGroupStatus
instanceGroupStatus_timeline = (InstanceGroupStatus -> Maybe InstanceGroupTimeline)
-> (InstanceGroupStatus
    -> Maybe InstanceGroupTimeline -> InstanceGroupStatus)
-> Lens
     InstanceGroupStatus
     InstanceGroupStatus
     (Maybe InstanceGroupTimeline)
     (Maybe InstanceGroupTimeline)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceGroupStatus' {Maybe InstanceGroupTimeline
timeline :: Maybe InstanceGroupTimeline
$sel:timeline:InstanceGroupStatus' :: InstanceGroupStatus -> Maybe InstanceGroupTimeline
timeline} -> Maybe InstanceGroupTimeline
timeline) (\s :: InstanceGroupStatus
s@InstanceGroupStatus' {} Maybe InstanceGroupTimeline
a -> InstanceGroupStatus
s {$sel:timeline:InstanceGroupStatus' :: Maybe InstanceGroupTimeline
timeline = Maybe InstanceGroupTimeline
a} :: InstanceGroupStatus)

instance Core.FromJSON InstanceGroupStatus where
  parseJSON :: Value -> Parser InstanceGroupStatus
parseJSON =
    String
-> (Object -> Parser InstanceGroupStatus)
-> Value
-> Parser InstanceGroupStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InstanceGroupStatus"
      ( \Object
x ->
          Maybe InstanceGroupState
-> Maybe InstanceGroupStateChangeReason
-> Maybe InstanceGroupTimeline
-> InstanceGroupStatus
InstanceGroupStatus'
            (Maybe InstanceGroupState
 -> Maybe InstanceGroupStateChangeReason
 -> Maybe InstanceGroupTimeline
 -> InstanceGroupStatus)
-> Parser (Maybe InstanceGroupState)
-> Parser
     (Maybe InstanceGroupStateChangeReason
      -> Maybe InstanceGroupTimeline -> InstanceGroupStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe InstanceGroupState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
            Parser
  (Maybe InstanceGroupStateChangeReason
   -> Maybe InstanceGroupTimeline -> InstanceGroupStatus)
-> Parser (Maybe InstanceGroupStateChangeReason)
-> Parser (Maybe InstanceGroupTimeline -> InstanceGroupStatus)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InstanceGroupStateChangeReason)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StateChangeReason")
            Parser (Maybe InstanceGroupTimeline -> InstanceGroupStatus)
-> Parser (Maybe InstanceGroupTimeline)
-> Parser InstanceGroupStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InstanceGroupTimeline)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Timeline")
      )

instance Prelude.Hashable InstanceGroupStatus

instance Prelude.NFData InstanceGroupStatus