{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.EMR.Types.CancelStepsInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EMR.Types.CancelStepsRequestStatus
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 reason for the failure if the CancelSteps request fails.
    CancelStepsInfo -> Maybe Text
reason :: Prelude.Maybe Prelude.Text,
    -- | 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
  }
  deriving (CancelStepsInfo -> CancelStepsInfo -> Bool
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]
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
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. 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:
--
-- 'reason', 'cancelStepsInfo_reason' - The reason for the failure if the CancelSteps request fails.
--
-- '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.
newCancelStepsInfo ::
  CancelStepsInfo
newCancelStepsInfo :: CancelStepsInfo
newCancelStepsInfo =
  CancelStepsInfo'
    { $sel:reason:CancelStepsInfo' :: Maybe Text
reason = forall a. Maybe a
Prelude.Nothing,
      $sel:status:CancelStepsInfo' :: Maybe CancelStepsRequestStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:stepId:CancelStepsInfo' :: Maybe Text
stepId = forall a. Maybe a
Prelude.Nothing
    }

-- | The reason for the failure if the CancelSteps request fails.
cancelStepsInfo_reason :: Lens.Lens' CancelStepsInfo (Prelude.Maybe Prelude.Text)
cancelStepsInfo_reason :: Lens' CancelStepsInfo (Maybe Text)
cancelStepsInfo_reason = 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)

-- | The status of a CancelSteps Request. The value may be SUBMITTED or
-- FAILED.
cancelStepsInfo_status :: Lens.Lens' CancelStepsInfo (Prelude.Maybe CancelStepsRequestStatus)
cancelStepsInfo_status :: Lens' CancelStepsInfo (Maybe CancelStepsRequestStatus)
cancelStepsInfo_status = 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 :: Lens' CancelStepsInfo (Maybe Text)
cancelStepsInfo_stepId = 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)

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

instance Prelude.Hashable CancelStepsInfo where
  hashWithSalt :: Int -> CancelStepsInfo -> Int
hashWithSalt Int
_salt CancelStepsInfo' {Maybe Text
Maybe CancelStepsRequestStatus
stepId :: Maybe Text
status :: Maybe CancelStepsRequestStatus
reason :: Maybe Text
$sel:stepId:CancelStepsInfo' :: CancelStepsInfo -> Maybe Text
$sel:status:CancelStepsInfo' :: CancelStepsInfo -> Maybe CancelStepsRequestStatus
$sel:reason:CancelStepsInfo' :: CancelStepsInfo -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
reason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CancelStepsRequestStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
stepId

instance Prelude.NFData CancelStepsInfo where
  rnf :: CancelStepsInfo -> ()
rnf CancelStepsInfo' {Maybe Text
Maybe CancelStepsRequestStatus
stepId :: Maybe Text
status :: Maybe CancelStepsRequestStatus
reason :: Maybe Text
$sel:stepId:CancelStepsInfo' :: CancelStepsInfo -> Maybe Text
$sel:status:CancelStepsInfo' :: CancelStepsInfo -> Maybe CancelStepsRequestStatus
$sel:reason:CancelStepsInfo' :: CancelStepsInfo -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
reason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CancelStepsRequestStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
stepId