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

import qualified Amazonka.Core as Core
import Amazonka.EMR.Types.ActionOnFailure
import Amazonka.EMR.Types.HadoopStepConfig
import Amazonka.EMR.Types.StepStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The summary of the cluster step.
--
-- /See:/ 'newStepSummary' smart constructor.
data StepSummary = StepSummary'
  { -- | The current execution status details of the cluster step.
    StepSummary -> Maybe StepStatus
status :: Prelude.Maybe StepStatus,
    -- | The action to take when the cluster step fails. Possible values are
    -- TERMINATE_CLUSTER, CANCEL_AND_WAIT, and CONTINUE. TERMINATE_JOB_FLOW is
    -- available for backward compatibility.
    StepSummary -> Maybe ActionOnFailure
actionOnFailure :: Prelude.Maybe ActionOnFailure,
    -- | The Hadoop job configuration of the cluster step.
    StepSummary -> Maybe HadoopStepConfig
config :: Prelude.Maybe HadoopStepConfig,
    -- | The name of the cluster step.
    StepSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the cluster step.
    StepSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (StepSummary -> StepSummary -> Bool
(StepSummary -> StepSummary -> Bool)
-> (StepSummary -> StepSummary -> Bool) -> Eq StepSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StepSummary -> StepSummary -> Bool
$c/= :: StepSummary -> StepSummary -> Bool
== :: StepSummary -> StepSummary -> Bool
$c== :: StepSummary -> StepSummary -> Bool
Prelude.Eq, ReadPrec [StepSummary]
ReadPrec StepSummary
Int -> ReadS StepSummary
ReadS [StepSummary]
(Int -> ReadS StepSummary)
-> ReadS [StepSummary]
-> ReadPrec StepSummary
-> ReadPrec [StepSummary]
-> Read StepSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StepSummary]
$creadListPrec :: ReadPrec [StepSummary]
readPrec :: ReadPrec StepSummary
$creadPrec :: ReadPrec StepSummary
readList :: ReadS [StepSummary]
$creadList :: ReadS [StepSummary]
readsPrec :: Int -> ReadS StepSummary
$creadsPrec :: Int -> ReadS StepSummary
Prelude.Read, Int -> StepSummary -> ShowS
[StepSummary] -> ShowS
StepSummary -> String
(Int -> StepSummary -> ShowS)
-> (StepSummary -> String)
-> ([StepSummary] -> ShowS)
-> Show StepSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StepSummary] -> ShowS
$cshowList :: [StepSummary] -> ShowS
show :: StepSummary -> String
$cshow :: StepSummary -> String
showsPrec :: Int -> StepSummary -> ShowS
$cshowsPrec :: Int -> StepSummary -> ShowS
Prelude.Show, (forall x. StepSummary -> Rep StepSummary x)
-> (forall x. Rep StepSummary x -> StepSummary)
-> Generic StepSummary
forall x. Rep StepSummary x -> StepSummary
forall x. StepSummary -> Rep StepSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StepSummary x -> StepSummary
$cfrom :: forall x. StepSummary -> Rep StepSummary x
Prelude.Generic)

-- |
-- Create a value of 'StepSummary' 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:
--
-- 'status', 'stepSummary_status' - The current execution status details of the cluster step.
--
-- 'actionOnFailure', 'stepSummary_actionOnFailure' - The action to take when the cluster step fails. Possible values are
-- TERMINATE_CLUSTER, CANCEL_AND_WAIT, and CONTINUE. TERMINATE_JOB_FLOW is
-- available for backward compatibility.
--
-- 'config', 'stepSummary_config' - The Hadoop job configuration of the cluster step.
--
-- 'name', 'stepSummary_name' - The name of the cluster step.
--
-- 'id', 'stepSummary_id' - The identifier of the cluster step.
newStepSummary ::
  StepSummary
newStepSummary :: StepSummary
newStepSummary =
  StepSummary' :: Maybe StepStatus
-> Maybe ActionOnFailure
-> Maybe HadoopStepConfig
-> Maybe Text
-> Maybe Text
-> StepSummary
StepSummary'
    { $sel:status:StepSummary' :: Maybe StepStatus
status = Maybe StepStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:actionOnFailure:StepSummary' :: Maybe ActionOnFailure
actionOnFailure = Maybe ActionOnFailure
forall a. Maybe a
Prelude.Nothing,
      $sel:config:StepSummary' :: Maybe HadoopStepConfig
config = Maybe HadoopStepConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:name:StepSummary' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:StepSummary' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The current execution status details of the cluster step.
stepSummary_status :: Lens.Lens' StepSummary (Prelude.Maybe StepStatus)
stepSummary_status :: (Maybe StepStatus -> f (Maybe StepStatus))
-> StepSummary -> f StepSummary
stepSummary_status = (StepSummary -> Maybe StepStatus)
-> (StepSummary -> Maybe StepStatus -> StepSummary)
-> Lens
     StepSummary StepSummary (Maybe StepStatus) (Maybe StepStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StepSummary' {Maybe StepStatus
status :: Maybe StepStatus
$sel:status:StepSummary' :: StepSummary -> Maybe StepStatus
status} -> Maybe StepStatus
status) (\s :: StepSummary
s@StepSummary' {} Maybe StepStatus
a -> StepSummary
s {$sel:status:StepSummary' :: Maybe StepStatus
status = Maybe StepStatus
a} :: StepSummary)

-- | The action to take when the cluster step fails. Possible values are
-- TERMINATE_CLUSTER, CANCEL_AND_WAIT, and CONTINUE. TERMINATE_JOB_FLOW is
-- available for backward compatibility.
stepSummary_actionOnFailure :: Lens.Lens' StepSummary (Prelude.Maybe ActionOnFailure)
stepSummary_actionOnFailure :: (Maybe ActionOnFailure -> f (Maybe ActionOnFailure))
-> StepSummary -> f StepSummary
stepSummary_actionOnFailure = (StepSummary -> Maybe ActionOnFailure)
-> (StepSummary -> Maybe ActionOnFailure -> StepSummary)
-> Lens
     StepSummary
     StepSummary
     (Maybe ActionOnFailure)
     (Maybe ActionOnFailure)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StepSummary' {Maybe ActionOnFailure
actionOnFailure :: Maybe ActionOnFailure
$sel:actionOnFailure:StepSummary' :: StepSummary -> Maybe ActionOnFailure
actionOnFailure} -> Maybe ActionOnFailure
actionOnFailure) (\s :: StepSummary
s@StepSummary' {} Maybe ActionOnFailure
a -> StepSummary
s {$sel:actionOnFailure:StepSummary' :: Maybe ActionOnFailure
actionOnFailure = Maybe ActionOnFailure
a} :: StepSummary)

-- | The Hadoop job configuration of the cluster step.
stepSummary_config :: Lens.Lens' StepSummary (Prelude.Maybe HadoopStepConfig)
stepSummary_config :: (Maybe HadoopStepConfig -> f (Maybe HadoopStepConfig))
-> StepSummary -> f StepSummary
stepSummary_config = (StepSummary -> Maybe HadoopStepConfig)
-> (StepSummary -> Maybe HadoopStepConfig -> StepSummary)
-> Lens
     StepSummary
     StepSummary
     (Maybe HadoopStepConfig)
     (Maybe HadoopStepConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StepSummary' {Maybe HadoopStepConfig
config :: Maybe HadoopStepConfig
$sel:config:StepSummary' :: StepSummary -> Maybe HadoopStepConfig
config} -> Maybe HadoopStepConfig
config) (\s :: StepSummary
s@StepSummary' {} Maybe HadoopStepConfig
a -> StepSummary
s {$sel:config:StepSummary' :: Maybe HadoopStepConfig
config = Maybe HadoopStepConfig
a} :: StepSummary)

-- | The name of the cluster step.
stepSummary_name :: Lens.Lens' StepSummary (Prelude.Maybe Prelude.Text)
stepSummary_name :: (Maybe Text -> f (Maybe Text)) -> StepSummary -> f StepSummary
stepSummary_name = (StepSummary -> Maybe Text)
-> (StepSummary -> Maybe Text -> StepSummary)
-> Lens StepSummary StepSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StepSummary' {Maybe Text
name :: Maybe Text
$sel:name:StepSummary' :: StepSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: StepSummary
s@StepSummary' {} Maybe Text
a -> StepSummary
s {$sel:name:StepSummary' :: Maybe Text
name = Maybe Text
a} :: StepSummary)

-- | The identifier of the cluster step.
stepSummary_id :: Lens.Lens' StepSummary (Prelude.Maybe Prelude.Text)
stepSummary_id :: (Maybe Text -> f (Maybe Text)) -> StepSummary -> f StepSummary
stepSummary_id = (StepSummary -> Maybe Text)
-> (StepSummary -> Maybe Text -> StepSummary)
-> Lens StepSummary StepSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StepSummary' {Maybe Text
id :: Maybe Text
$sel:id:StepSummary' :: StepSummary -> Maybe Text
id} -> Maybe Text
id) (\s :: StepSummary
s@StepSummary' {} Maybe Text
a -> StepSummary
s {$sel:id:StepSummary' :: Maybe Text
id = Maybe Text
a} :: StepSummary)

instance Core.FromJSON StepSummary where
  parseJSON :: Value -> Parser StepSummary
parseJSON =
    String
-> (Object -> Parser StepSummary) -> Value -> Parser StepSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StepSummary"
      ( \Object
x ->
          Maybe StepStatus
-> Maybe ActionOnFailure
-> Maybe HadoopStepConfig
-> Maybe Text
-> Maybe Text
-> StepSummary
StepSummary'
            (Maybe StepStatus
 -> Maybe ActionOnFailure
 -> Maybe HadoopStepConfig
 -> Maybe Text
 -> Maybe Text
 -> StepSummary)
-> Parser (Maybe StepStatus)
-> Parser
     (Maybe ActionOnFailure
      -> Maybe HadoopStepConfig
      -> Maybe Text
      -> Maybe Text
      -> StepSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe StepStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe ActionOnFailure
   -> Maybe HadoopStepConfig
   -> Maybe Text
   -> Maybe Text
   -> StepSummary)
-> Parser (Maybe ActionOnFailure)
-> Parser
     (Maybe HadoopStepConfig -> Maybe Text -> Maybe Text -> StepSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ActionOnFailure)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ActionOnFailure")
            Parser
  (Maybe HadoopStepConfig -> Maybe Text -> Maybe Text -> StepSummary)
-> Parser (Maybe HadoopStepConfig)
-> Parser (Maybe Text -> Maybe Text -> StepSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HadoopStepConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Config")
            Parser (Maybe Text -> Maybe Text -> StepSummary)
-> Parser (Maybe Text) -> Parser (Maybe Text -> StepSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
            Parser (Maybe Text -> StepSummary)
-> Parser (Maybe Text) -> Parser StepSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Id")
      )

instance Prelude.Hashable StepSummary

instance Prelude.NFData StepSummary