{-# 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.AutoScaling.Types.SuspendedProcess
-- 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.AutoScaling.Types.SuspendedProcess where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes an auto scaling process that has been suspended.
--
-- For more information, see
-- <https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html#process-types Scaling processes>
-- in the /Amazon EC2 Auto Scaling User Guide/.
--
-- /See:/ 'newSuspendedProcess' smart constructor.
data SuspendedProcess = SuspendedProcess'
  { -- | The name of the suspended process.
    SuspendedProcess -> Maybe Text
processName :: Prelude.Maybe Prelude.Text,
    -- | The reason that the process was suspended.
    SuspendedProcess -> Maybe Text
suspensionReason :: Prelude.Maybe Prelude.Text
  }
  deriving (SuspendedProcess -> SuspendedProcess -> Bool
(SuspendedProcess -> SuspendedProcess -> Bool)
-> (SuspendedProcess -> SuspendedProcess -> Bool)
-> Eq SuspendedProcess
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SuspendedProcess -> SuspendedProcess -> Bool
$c/= :: SuspendedProcess -> SuspendedProcess -> Bool
== :: SuspendedProcess -> SuspendedProcess -> Bool
$c== :: SuspendedProcess -> SuspendedProcess -> Bool
Prelude.Eq, ReadPrec [SuspendedProcess]
ReadPrec SuspendedProcess
Int -> ReadS SuspendedProcess
ReadS [SuspendedProcess]
(Int -> ReadS SuspendedProcess)
-> ReadS [SuspendedProcess]
-> ReadPrec SuspendedProcess
-> ReadPrec [SuspendedProcess]
-> Read SuspendedProcess
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SuspendedProcess]
$creadListPrec :: ReadPrec [SuspendedProcess]
readPrec :: ReadPrec SuspendedProcess
$creadPrec :: ReadPrec SuspendedProcess
readList :: ReadS [SuspendedProcess]
$creadList :: ReadS [SuspendedProcess]
readsPrec :: Int -> ReadS SuspendedProcess
$creadsPrec :: Int -> ReadS SuspendedProcess
Prelude.Read, Int -> SuspendedProcess -> ShowS
[SuspendedProcess] -> ShowS
SuspendedProcess -> String
(Int -> SuspendedProcess -> ShowS)
-> (SuspendedProcess -> String)
-> ([SuspendedProcess] -> ShowS)
-> Show SuspendedProcess
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SuspendedProcess] -> ShowS
$cshowList :: [SuspendedProcess] -> ShowS
show :: SuspendedProcess -> String
$cshow :: SuspendedProcess -> String
showsPrec :: Int -> SuspendedProcess -> ShowS
$cshowsPrec :: Int -> SuspendedProcess -> ShowS
Prelude.Show, (forall x. SuspendedProcess -> Rep SuspendedProcess x)
-> (forall x. Rep SuspendedProcess x -> SuspendedProcess)
-> Generic SuspendedProcess
forall x. Rep SuspendedProcess x -> SuspendedProcess
forall x. SuspendedProcess -> Rep SuspendedProcess x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SuspendedProcess x -> SuspendedProcess
$cfrom :: forall x. SuspendedProcess -> Rep SuspendedProcess x
Prelude.Generic)

-- |
-- Create a value of 'SuspendedProcess' 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:
--
-- 'processName', 'suspendedProcess_processName' - The name of the suspended process.
--
-- 'suspensionReason', 'suspendedProcess_suspensionReason' - The reason that the process was suspended.
newSuspendedProcess ::
  SuspendedProcess
newSuspendedProcess :: SuspendedProcess
newSuspendedProcess =
  SuspendedProcess' :: Maybe Text -> Maybe Text -> SuspendedProcess
SuspendedProcess'
    { $sel:processName:SuspendedProcess' :: Maybe Text
processName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:suspensionReason:SuspendedProcess' :: Maybe Text
suspensionReason = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the suspended process.
suspendedProcess_processName :: Lens.Lens' SuspendedProcess (Prelude.Maybe Prelude.Text)
suspendedProcess_processName :: (Maybe Text -> f (Maybe Text))
-> SuspendedProcess -> f SuspendedProcess
suspendedProcess_processName = (SuspendedProcess -> Maybe Text)
-> (SuspendedProcess -> Maybe Text -> SuspendedProcess)
-> Lens SuspendedProcess SuspendedProcess (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuspendedProcess' {Maybe Text
processName :: Maybe Text
$sel:processName:SuspendedProcess' :: SuspendedProcess -> Maybe Text
processName} -> Maybe Text
processName) (\s :: SuspendedProcess
s@SuspendedProcess' {} Maybe Text
a -> SuspendedProcess
s {$sel:processName:SuspendedProcess' :: Maybe Text
processName = Maybe Text
a} :: SuspendedProcess)

-- | The reason that the process was suspended.
suspendedProcess_suspensionReason :: Lens.Lens' SuspendedProcess (Prelude.Maybe Prelude.Text)
suspendedProcess_suspensionReason :: (Maybe Text -> f (Maybe Text))
-> SuspendedProcess -> f SuspendedProcess
suspendedProcess_suspensionReason = (SuspendedProcess -> Maybe Text)
-> (SuspendedProcess -> Maybe Text -> SuspendedProcess)
-> Lens SuspendedProcess SuspendedProcess (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuspendedProcess' {Maybe Text
suspensionReason :: Maybe Text
$sel:suspensionReason:SuspendedProcess' :: SuspendedProcess -> Maybe Text
suspensionReason} -> Maybe Text
suspensionReason) (\s :: SuspendedProcess
s@SuspendedProcess' {} Maybe Text
a -> SuspendedProcess
s {$sel:suspensionReason:SuspendedProcess' :: Maybe Text
suspensionReason = Maybe Text
a} :: SuspendedProcess)

instance Core.FromXML SuspendedProcess where
  parseXML :: [Node] -> Either String SuspendedProcess
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> SuspendedProcess
SuspendedProcess'
      (Maybe Text -> Maybe Text -> SuspendedProcess)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> SuspendedProcess)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ProcessName")
      Either String (Maybe Text -> SuspendedProcess)
-> Either String (Maybe Text) -> Either String SuspendedProcess
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SuspensionReason")

instance Prelude.Hashable SuspendedProcess

instance Prelude.NFData SuspendedProcess