{-# 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.Kafka.Types.ClusterOperationStep
-- 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.Kafka.Types.ClusterOperationStep where

import qualified Amazonka.Core as Core
import Amazonka.Kafka.Types.ClusterOperationStepInfo
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Step taken during a cluster operation.
--
-- /See:/ 'newClusterOperationStep' smart constructor.
data ClusterOperationStep = ClusterOperationStep'
  { -- | The name of the step.
    ClusterOperationStep -> Maybe Text
stepName :: Prelude.Maybe Prelude.Text,
    -- | Information about the step and its status.
    ClusterOperationStep -> Maybe ClusterOperationStepInfo
stepInfo :: Prelude.Maybe ClusterOperationStepInfo
  }
  deriving (ClusterOperationStep -> ClusterOperationStep -> Bool
(ClusterOperationStep -> ClusterOperationStep -> Bool)
-> (ClusterOperationStep -> ClusterOperationStep -> Bool)
-> Eq ClusterOperationStep
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClusterOperationStep -> ClusterOperationStep -> Bool
$c/= :: ClusterOperationStep -> ClusterOperationStep -> Bool
== :: ClusterOperationStep -> ClusterOperationStep -> Bool
$c== :: ClusterOperationStep -> ClusterOperationStep -> Bool
Prelude.Eq, ReadPrec [ClusterOperationStep]
ReadPrec ClusterOperationStep
Int -> ReadS ClusterOperationStep
ReadS [ClusterOperationStep]
(Int -> ReadS ClusterOperationStep)
-> ReadS [ClusterOperationStep]
-> ReadPrec ClusterOperationStep
-> ReadPrec [ClusterOperationStep]
-> Read ClusterOperationStep
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClusterOperationStep]
$creadListPrec :: ReadPrec [ClusterOperationStep]
readPrec :: ReadPrec ClusterOperationStep
$creadPrec :: ReadPrec ClusterOperationStep
readList :: ReadS [ClusterOperationStep]
$creadList :: ReadS [ClusterOperationStep]
readsPrec :: Int -> ReadS ClusterOperationStep
$creadsPrec :: Int -> ReadS ClusterOperationStep
Prelude.Read, Int -> ClusterOperationStep -> ShowS
[ClusterOperationStep] -> ShowS
ClusterOperationStep -> String
(Int -> ClusterOperationStep -> ShowS)
-> (ClusterOperationStep -> String)
-> ([ClusterOperationStep] -> ShowS)
-> Show ClusterOperationStep
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClusterOperationStep] -> ShowS
$cshowList :: [ClusterOperationStep] -> ShowS
show :: ClusterOperationStep -> String
$cshow :: ClusterOperationStep -> String
showsPrec :: Int -> ClusterOperationStep -> ShowS
$cshowsPrec :: Int -> ClusterOperationStep -> ShowS
Prelude.Show, (forall x. ClusterOperationStep -> Rep ClusterOperationStep x)
-> (forall x. Rep ClusterOperationStep x -> ClusterOperationStep)
-> Generic ClusterOperationStep
forall x. Rep ClusterOperationStep x -> ClusterOperationStep
forall x. ClusterOperationStep -> Rep ClusterOperationStep x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClusterOperationStep x -> ClusterOperationStep
$cfrom :: forall x. ClusterOperationStep -> Rep ClusterOperationStep x
Prelude.Generic)

-- |
-- Create a value of 'ClusterOperationStep' 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:
--
-- 'stepName', 'clusterOperationStep_stepName' - The name of the step.
--
-- 'stepInfo', 'clusterOperationStep_stepInfo' - Information about the step and its status.
newClusterOperationStep ::
  ClusterOperationStep
newClusterOperationStep :: ClusterOperationStep
newClusterOperationStep =
  ClusterOperationStep' :: Maybe Text
-> Maybe ClusterOperationStepInfo -> ClusterOperationStep
ClusterOperationStep'
    { $sel:stepName:ClusterOperationStep' :: Maybe Text
stepName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:stepInfo:ClusterOperationStep' :: Maybe ClusterOperationStepInfo
stepInfo = Maybe ClusterOperationStepInfo
forall a. Maybe a
Prelude.Nothing
    }

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

-- | Information about the step and its status.
clusterOperationStep_stepInfo :: Lens.Lens' ClusterOperationStep (Prelude.Maybe ClusterOperationStepInfo)
clusterOperationStep_stepInfo :: (Maybe ClusterOperationStepInfo
 -> f (Maybe ClusterOperationStepInfo))
-> ClusterOperationStep -> f ClusterOperationStep
clusterOperationStep_stepInfo = (ClusterOperationStep -> Maybe ClusterOperationStepInfo)
-> (ClusterOperationStep
    -> Maybe ClusterOperationStepInfo -> ClusterOperationStep)
-> Lens
     ClusterOperationStep
     ClusterOperationStep
     (Maybe ClusterOperationStepInfo)
     (Maybe ClusterOperationStepInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterOperationStep' {Maybe ClusterOperationStepInfo
stepInfo :: Maybe ClusterOperationStepInfo
$sel:stepInfo:ClusterOperationStep' :: ClusterOperationStep -> Maybe ClusterOperationStepInfo
stepInfo} -> Maybe ClusterOperationStepInfo
stepInfo) (\s :: ClusterOperationStep
s@ClusterOperationStep' {} Maybe ClusterOperationStepInfo
a -> ClusterOperationStep
s {$sel:stepInfo:ClusterOperationStep' :: Maybe ClusterOperationStepInfo
stepInfo = Maybe ClusterOperationStepInfo
a} :: ClusterOperationStep)

instance Core.FromJSON ClusterOperationStep where
  parseJSON :: Value -> Parser ClusterOperationStep
parseJSON =
    String
-> (Object -> Parser ClusterOperationStep)
-> Value
-> Parser ClusterOperationStep
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ClusterOperationStep"
      ( \Object
x ->
          Maybe Text
-> Maybe ClusterOperationStepInfo -> ClusterOperationStep
ClusterOperationStep'
            (Maybe Text
 -> Maybe ClusterOperationStepInfo -> ClusterOperationStep)
-> Parser (Maybe Text)
-> Parser (Maybe ClusterOperationStepInfo -> ClusterOperationStep)
forall (f :: * -> *) a b. Functor 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
"stepName")
            Parser (Maybe ClusterOperationStepInfo -> ClusterOperationStep)
-> Parser (Maybe ClusterOperationStepInfo)
-> Parser ClusterOperationStep
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ClusterOperationStepInfo)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"stepInfo")
      )

instance Prelude.Hashable ClusterOperationStep

instance Prelude.NFData ClusterOperationStep