{-# 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.ApplicationAutoScaling.Types.SuspendedState
-- 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.ApplicationAutoScaling.Types.SuspendedState where

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

-- | Specifies whether the scaling activities for a scalable target are in a
-- suspended state.
--
-- /See:/ 'newSuspendedState' smart constructor.
data SuspendedState = SuspendedState'
  { -- | Whether scale in by a target tracking scaling policy or a step scaling
    -- policy is suspended. Set the value to @true@ if you don\'t want
    -- Application Auto Scaling to remove capacity when a scaling policy is
    -- triggered. The default is @false@.
    SuspendedState -> Maybe Bool
dynamicScalingInSuspended :: Prelude.Maybe Prelude.Bool,
    -- | Whether scale out by a target tracking scaling policy or a step scaling
    -- policy is suspended. Set the value to @true@ if you don\'t want
    -- Application Auto Scaling to add capacity when a scaling policy is
    -- triggered. The default is @false@.
    SuspendedState -> Maybe Bool
dynamicScalingOutSuspended :: Prelude.Maybe Prelude.Bool,
    -- | Whether scheduled scaling is suspended. Set the value to @true@ if you
    -- don\'t want Application Auto Scaling to add or remove capacity by
    -- initiating scheduled actions. The default is @false@.
    SuspendedState -> Maybe Bool
scheduledScalingSuspended :: Prelude.Maybe Prelude.Bool
  }
  deriving (SuspendedState -> SuspendedState -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SuspendedState -> SuspendedState -> Bool
$c/= :: SuspendedState -> SuspendedState -> Bool
== :: SuspendedState -> SuspendedState -> Bool
$c== :: SuspendedState -> SuspendedState -> Bool
Prelude.Eq, ReadPrec [SuspendedState]
ReadPrec SuspendedState
Int -> ReadS SuspendedState
ReadS [SuspendedState]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SuspendedState]
$creadListPrec :: ReadPrec [SuspendedState]
readPrec :: ReadPrec SuspendedState
$creadPrec :: ReadPrec SuspendedState
readList :: ReadS [SuspendedState]
$creadList :: ReadS [SuspendedState]
readsPrec :: Int -> ReadS SuspendedState
$creadsPrec :: Int -> ReadS SuspendedState
Prelude.Read, Int -> SuspendedState -> ShowS
[SuspendedState] -> ShowS
SuspendedState -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SuspendedState] -> ShowS
$cshowList :: [SuspendedState] -> ShowS
show :: SuspendedState -> String
$cshow :: SuspendedState -> String
showsPrec :: Int -> SuspendedState -> ShowS
$cshowsPrec :: Int -> SuspendedState -> ShowS
Prelude.Show, forall x. Rep SuspendedState x -> SuspendedState
forall x. SuspendedState -> Rep SuspendedState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SuspendedState x -> SuspendedState
$cfrom :: forall x. SuspendedState -> Rep SuspendedState x
Prelude.Generic)

-- |
-- Create a value of 'SuspendedState' 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:
--
-- 'dynamicScalingInSuspended', 'suspendedState_dynamicScalingInSuspended' - Whether scale in by a target tracking scaling policy or a step scaling
-- policy is suspended. Set the value to @true@ if you don\'t want
-- Application Auto Scaling to remove capacity when a scaling policy is
-- triggered. The default is @false@.
--
-- 'dynamicScalingOutSuspended', 'suspendedState_dynamicScalingOutSuspended' - Whether scale out by a target tracking scaling policy or a step scaling
-- policy is suspended. Set the value to @true@ if you don\'t want
-- Application Auto Scaling to add capacity when a scaling policy is
-- triggered. The default is @false@.
--
-- 'scheduledScalingSuspended', 'suspendedState_scheduledScalingSuspended' - Whether scheduled scaling is suspended. Set the value to @true@ if you
-- don\'t want Application Auto Scaling to add or remove capacity by
-- initiating scheduled actions. The default is @false@.
newSuspendedState ::
  SuspendedState
newSuspendedState :: SuspendedState
newSuspendedState =
  SuspendedState'
    { $sel:dynamicScalingInSuspended:SuspendedState' :: Maybe Bool
dynamicScalingInSuspended =
        forall a. Maybe a
Prelude.Nothing,
      $sel:dynamicScalingOutSuspended:SuspendedState' :: Maybe Bool
dynamicScalingOutSuspended = forall a. Maybe a
Prelude.Nothing,
      $sel:scheduledScalingSuspended:SuspendedState' :: Maybe Bool
scheduledScalingSuspended = forall a. Maybe a
Prelude.Nothing
    }

-- | Whether scale in by a target tracking scaling policy or a step scaling
-- policy is suspended. Set the value to @true@ if you don\'t want
-- Application Auto Scaling to remove capacity when a scaling policy is
-- triggered. The default is @false@.
suspendedState_dynamicScalingInSuspended :: Lens.Lens' SuspendedState (Prelude.Maybe Prelude.Bool)
suspendedState_dynamicScalingInSuspended :: Lens' SuspendedState (Maybe Bool)
suspendedState_dynamicScalingInSuspended = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuspendedState' {Maybe Bool
dynamicScalingInSuspended :: Maybe Bool
$sel:dynamicScalingInSuspended:SuspendedState' :: SuspendedState -> Maybe Bool
dynamicScalingInSuspended} -> Maybe Bool
dynamicScalingInSuspended) (\s :: SuspendedState
s@SuspendedState' {} Maybe Bool
a -> SuspendedState
s {$sel:dynamicScalingInSuspended:SuspendedState' :: Maybe Bool
dynamicScalingInSuspended = Maybe Bool
a} :: SuspendedState)

-- | Whether scale out by a target tracking scaling policy or a step scaling
-- policy is suspended. Set the value to @true@ if you don\'t want
-- Application Auto Scaling to add capacity when a scaling policy is
-- triggered. The default is @false@.
suspendedState_dynamicScalingOutSuspended :: Lens.Lens' SuspendedState (Prelude.Maybe Prelude.Bool)
suspendedState_dynamicScalingOutSuspended :: Lens' SuspendedState (Maybe Bool)
suspendedState_dynamicScalingOutSuspended = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuspendedState' {Maybe Bool
dynamicScalingOutSuspended :: Maybe Bool
$sel:dynamicScalingOutSuspended:SuspendedState' :: SuspendedState -> Maybe Bool
dynamicScalingOutSuspended} -> Maybe Bool
dynamicScalingOutSuspended) (\s :: SuspendedState
s@SuspendedState' {} Maybe Bool
a -> SuspendedState
s {$sel:dynamicScalingOutSuspended:SuspendedState' :: Maybe Bool
dynamicScalingOutSuspended = Maybe Bool
a} :: SuspendedState)

-- | Whether scheduled scaling is suspended. Set the value to @true@ if you
-- don\'t want Application Auto Scaling to add or remove capacity by
-- initiating scheduled actions. The default is @false@.
suspendedState_scheduledScalingSuspended :: Lens.Lens' SuspendedState (Prelude.Maybe Prelude.Bool)
suspendedState_scheduledScalingSuspended :: Lens' SuspendedState (Maybe Bool)
suspendedState_scheduledScalingSuspended = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuspendedState' {Maybe Bool
scheduledScalingSuspended :: Maybe Bool
$sel:scheduledScalingSuspended:SuspendedState' :: SuspendedState -> Maybe Bool
scheduledScalingSuspended} -> Maybe Bool
scheduledScalingSuspended) (\s :: SuspendedState
s@SuspendedState' {} Maybe Bool
a -> SuspendedState
s {$sel:scheduledScalingSuspended:SuspendedState' :: Maybe Bool
scheduledScalingSuspended = Maybe Bool
a} :: SuspendedState)

instance Data.FromJSON SuspendedState where
  parseJSON :: Value -> Parser SuspendedState
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SuspendedState"
      ( \Object
x ->
          Maybe Bool -> Maybe Bool -> Maybe Bool -> SuspendedState
SuspendedState'
            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
"DynamicScalingInSuspended")
            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
"DynamicScalingOutSuspended")
            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
"ScheduledScalingSuspended")
      )

instance Prelude.Hashable SuspendedState where
  hashWithSalt :: Int -> SuspendedState -> Int
hashWithSalt Int
_salt SuspendedState' {Maybe Bool
scheduledScalingSuspended :: Maybe Bool
dynamicScalingOutSuspended :: Maybe Bool
dynamicScalingInSuspended :: Maybe Bool
$sel:scheduledScalingSuspended:SuspendedState' :: SuspendedState -> Maybe Bool
$sel:dynamicScalingOutSuspended:SuspendedState' :: SuspendedState -> Maybe Bool
$sel:dynamicScalingInSuspended:SuspendedState' :: SuspendedState -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dynamicScalingInSuspended
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dynamicScalingOutSuspended
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
scheduledScalingSuspended

instance Prelude.NFData SuspendedState where
  rnf :: SuspendedState -> ()
rnf SuspendedState' {Maybe Bool
scheduledScalingSuspended :: Maybe Bool
dynamicScalingOutSuspended :: Maybe Bool
dynamicScalingInSuspended :: Maybe Bool
$sel:scheduledScalingSuspended:SuspendedState' :: SuspendedState -> Maybe Bool
$sel:dynamicScalingOutSuspended:SuspendedState' :: SuspendedState -> Maybe Bool
$sel:dynamicScalingInSuspended:SuspendedState' :: SuspendedState -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
dynamicScalingInSuspended
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
dynamicScalingOutSuspended
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
scheduledScalingSuspended

instance Data.ToJSON SuspendedState where
  toJSON :: SuspendedState -> Value
toJSON SuspendedState' {Maybe Bool
scheduledScalingSuspended :: Maybe Bool
dynamicScalingOutSuspended :: Maybe Bool
dynamicScalingInSuspended :: Maybe Bool
$sel:scheduledScalingSuspended:SuspendedState' :: SuspendedState -> Maybe Bool
$sel:dynamicScalingOutSuspended:SuspendedState' :: SuspendedState -> Maybe Bool
$sel:dynamicScalingInSuspended:SuspendedState' :: SuspendedState -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"DynamicScalingInSuspended" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
dynamicScalingInSuspended,
            (Key
"DynamicScalingOutSuspended" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
dynamicScalingOutSuspended,
            (Key
"ScheduledScalingSuspended" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
scheduledScalingSuspended
          ]
      )