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

import qualified Amazonka.Core as Core
import Amazonka.EMR.Types.CancelStepsRequestStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specification of the status of a CancelSteps request. Available only in
-- Amazon EMR version 4.8.0 and later, excluding version 5.0.0.
--
-- /See:/ 'newCancelStepsInfo' smart constructor.
data CancelStepsInfo = CancelStepsInfo'
  { -- | The status of a CancelSteps Request. The value may be SUBMITTED or
    -- FAILED.
    CancelStepsInfo -> Maybe CancelStepsRequestStatus
status :: Prelude.Maybe CancelStepsRequestStatus,
    -- | The encrypted StepId of a step.
    CancelStepsInfo -> Maybe Text
stepId :: Prelude.Maybe Prelude.Text,
    -- | The reason for the failure if the CancelSteps request fails.
    CancelStepsInfo -> Maybe Text
reason :: Prelude.Maybe Prelude.Text
  }
  deriving (CancelStepsInfo -> CancelStepsInfo -> Bool
(CancelStepsInfo -> CancelStepsInfo -> Bool)
-> (CancelStepsInfo -> CancelStepsInfo -> Bool)
-> Eq CancelStepsInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelStepsInfo -> CancelStepsInfo -> Bool
$c/= :: CancelStepsInfo -> CancelStepsInfo -> Bool
== :: CancelStepsInfo -> CancelStepsInfo -> Bool
$c== :: CancelStepsInfo -> CancelStepsInfo -> Bool
Prelude.Eq, ReadPrec [CancelStepsInfo]
ReadPrec CancelStepsInfo
Int -> ReadS CancelStepsInfo
ReadS [CancelStepsInfo]
(Int -> ReadS CancelStepsInfo)
-> ReadS [CancelStepsInfo]
-> ReadPrec CancelStepsInfo
-> ReadPrec [CancelStepsInfo]
-> Read CancelStepsInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelStepsInfo]
$creadListPrec :: ReadPrec [CancelStepsInfo]
readPrec :: ReadPrec CancelStepsInfo
$creadPrec :: ReadPrec CancelStepsInfo
readList :: ReadS [CancelStepsInfo]
$creadList :: ReadS [CancelStepsInfo]
readsPrec :: Int -> ReadS CancelStepsInfo
$creadsPrec :: Int -> ReadS CancelStepsInfo
Prelude.Read, Int -> CancelStepsInfo -> ShowS
[CancelStepsInfo] -> ShowS
CancelStepsInfo -> String
(Int -> CancelStepsInfo -> ShowS)
-> (CancelStepsInfo -> String)
-> ([CancelStepsInfo] -> ShowS)
-> Show CancelStepsInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelStepsInfo] -> ShowS
$cshowList :: [CancelStepsInfo] -> ShowS
show :: CancelStepsInfo -> String
$cshow :: CancelStepsInfo -> String
showsPrec :: Int -> CancelStepsInfo -> ShowS
$cshowsPrec :: Int -> CancelStepsInfo -> ShowS
Prelude.Show, (forall x. CancelStepsInfo -> Rep CancelStepsInfo x)
-> (forall x. Rep CancelStepsInfo x -> CancelStepsInfo)
-> Generic CancelStepsInfo
forall x. Rep CancelStepsInfo x -> CancelStepsInfo
forall x. CancelStepsInfo -> Rep CancelStepsInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CancelStepsInfo x -> CancelStepsInfo
$cfrom :: forall x. CancelStepsInfo -> Rep CancelStepsInfo x
Prelude.Generic)

-- |
-- Create a value of 'CancelStepsInfo' 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', 'cancelStepsInfo_status' - The status of a CancelSteps Request. The value may be SUBMITTED or
-- FAILED.
--
-- 'stepId', 'cancelStepsInfo_stepId' - The encrypted StepId of a step.
--
-- 'reason', 'cancelStepsInfo_reason' - The reason for the failure if the CancelSteps request fails.
newCancelStepsInfo ::
  CancelStepsInfo
newCancelStepsInfo :: CancelStepsInfo
newCancelStepsInfo =
  CancelStepsInfo' :: Maybe CancelStepsRequestStatus
-> Maybe Text -> Maybe Text -> CancelStepsInfo
CancelStepsInfo'
    { $sel:status:CancelStepsInfo' :: Maybe CancelStepsRequestStatus
status = Maybe CancelStepsRequestStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:stepId:CancelStepsInfo' :: Maybe Text
stepId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:reason:CancelStepsInfo' :: Maybe Text
reason = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of a CancelSteps Request. The value may be SUBMITTED or
-- FAILED.
cancelStepsInfo_status :: Lens.Lens' CancelStepsInfo (Prelude.Maybe CancelStepsRequestStatus)
cancelStepsInfo_status :: (Maybe CancelStepsRequestStatus
 -> f (Maybe CancelStepsRequestStatus))
-> CancelStepsInfo -> f CancelStepsInfo
cancelStepsInfo_status = (CancelStepsInfo -> Maybe CancelStepsRequestStatus)
-> (CancelStepsInfo
    -> Maybe CancelStepsRequestStatus -> CancelStepsInfo)
-> Lens
     CancelStepsInfo
     CancelStepsInfo
     (Maybe CancelStepsRequestStatus)
     (Maybe CancelStepsRequestStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelStepsInfo' {Maybe CancelStepsRequestStatus
status :: Maybe CancelStepsRequestStatus
$sel:status:CancelStepsInfo' :: CancelStepsInfo -> Maybe CancelStepsRequestStatus
status} -> Maybe CancelStepsRequestStatus
status) (\s :: CancelStepsInfo
s@CancelStepsInfo' {} Maybe CancelStepsRequestStatus
a -> CancelStepsInfo
s {$sel:status:CancelStepsInfo' :: Maybe CancelStepsRequestStatus
status = Maybe CancelStepsRequestStatus
a} :: CancelStepsInfo)

-- | The encrypted StepId of a step.
cancelStepsInfo_stepId :: Lens.Lens' CancelStepsInfo (Prelude.Maybe Prelude.Text)
cancelStepsInfo_stepId :: (Maybe Text -> f (Maybe Text))
-> CancelStepsInfo -> f CancelStepsInfo
cancelStepsInfo_stepId = (CancelStepsInfo -> Maybe Text)
-> (CancelStepsInfo -> Maybe Text -> CancelStepsInfo)
-> Lens CancelStepsInfo CancelStepsInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelStepsInfo' {Maybe Text
stepId :: Maybe Text
$sel:stepId:CancelStepsInfo' :: CancelStepsInfo -> Maybe Text
stepId} -> Maybe Text
stepId) (\s :: CancelStepsInfo
s@CancelStepsInfo' {} Maybe Text
a -> CancelStepsInfo
s {$sel:stepId:CancelStepsInfo' :: Maybe Text
stepId = Maybe Text
a} :: CancelStepsInfo)

-- | The reason for the failure if the CancelSteps request fails.
cancelStepsInfo_reason :: Lens.Lens' CancelStepsInfo (Prelude.Maybe Prelude.Text)
cancelStepsInfo_reason :: (Maybe Text -> f (Maybe Text))
-> CancelStepsInfo -> f CancelStepsInfo
cancelStepsInfo_reason = (CancelStepsInfo -> Maybe Text)
-> (CancelStepsInfo -> Maybe Text -> CancelStepsInfo)
-> Lens CancelStepsInfo CancelStepsInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelStepsInfo' {Maybe Text
reason :: Maybe Text
$sel:reason:CancelStepsInfo' :: CancelStepsInfo -> Maybe Text
reason} -> Maybe Text
reason) (\s :: CancelStepsInfo
s@CancelStepsInfo' {} Maybe Text
a -> CancelStepsInfo
s {$sel:reason:CancelStepsInfo' :: Maybe Text
reason = Maybe Text
a} :: CancelStepsInfo)

instance Core.FromJSON CancelStepsInfo where
  parseJSON :: Value -> Parser CancelStepsInfo
parseJSON =
    String
-> (Object -> Parser CancelStepsInfo)
-> Value
-> Parser CancelStepsInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CancelStepsInfo"
      ( \Object
x ->
          Maybe CancelStepsRequestStatus
-> Maybe Text -> Maybe Text -> CancelStepsInfo
CancelStepsInfo'
            (Maybe CancelStepsRequestStatus
 -> Maybe Text -> Maybe Text -> CancelStepsInfo)
-> Parser (Maybe CancelStepsRequestStatus)
-> Parser (Maybe Text -> Maybe Text -> CancelStepsInfo)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CancelStepsRequestStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser (Maybe Text -> Maybe Text -> CancelStepsInfo)
-> Parser (Maybe Text) -> Parser (Maybe Text -> CancelStepsInfo)
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
"StepId")
            Parser (Maybe Text -> CancelStepsInfo)
-> Parser (Maybe Text) -> Parser CancelStepsInfo
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
"Reason")
      )

instance Prelude.Hashable CancelStepsInfo

instance Prelude.NFData CancelStepsInfo