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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 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,
    -- | 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
  }
  deriving (SuspendedState -> SuspendedState -> Bool
(SuspendedState -> SuspendedState -> Bool)
-> (SuspendedState -> SuspendedState -> Bool) -> Eq SuspendedState
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]
(Int -> ReadS SuspendedState)
-> ReadS [SuspendedState]
-> ReadPrec SuspendedState
-> ReadPrec [SuspendedState]
-> Read 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
(Int -> SuspendedState -> ShowS)
-> (SuspendedState -> String)
-> ([SuspendedState] -> ShowS)
-> Show SuspendedState
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. SuspendedState -> Rep SuspendedState x)
-> (forall x. Rep SuspendedState x -> SuspendedState)
-> Generic SuspendedState
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@.
--
-- '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@.
--
-- '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@.
newSuspendedState ::
  SuspendedState
newSuspendedState :: SuspendedState
newSuspendedState =
  SuspendedState' :: Maybe Bool -> Maybe Bool -> Maybe Bool -> SuspendedState
SuspendedState'
    { $sel:dynamicScalingInSuspended:SuspendedState' :: Maybe Bool
dynamicScalingInSuspended =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:scheduledScalingSuspended:SuspendedState' :: Maybe Bool
scheduledScalingSuspended = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:dynamicScalingOutSuspended:SuspendedState' :: Maybe Bool
dynamicScalingOutSuspended = Maybe Bool
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 :: (Maybe Bool -> f (Maybe Bool))
-> SuspendedState -> f SuspendedState
suspendedState_dynamicScalingInSuspended = (SuspendedState -> Maybe Bool)
-> (SuspendedState -> Maybe Bool -> SuspendedState)
-> Lens SuspendedState SuspendedState (Maybe Bool) (Maybe Bool)
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 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 :: (Maybe Bool -> f (Maybe Bool))
-> SuspendedState -> f SuspendedState
suspendedState_scheduledScalingSuspended = (SuspendedState -> Maybe Bool)
-> (SuspendedState -> Maybe Bool -> SuspendedState)
-> Lens SuspendedState SuspendedState (Maybe Bool) (Maybe Bool)
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)

-- | 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 :: (Maybe Bool -> f (Maybe Bool))
-> SuspendedState -> f SuspendedState
suspendedState_dynamicScalingOutSuspended = (SuspendedState -> Maybe Bool)
-> (SuspendedState -> Maybe Bool -> SuspendedState)
-> Lens SuspendedState SuspendedState (Maybe Bool) (Maybe Bool)
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)

instance Core.FromJSON SuspendedState where
  parseJSON :: Value -> Parser SuspendedState
parseJSON =
    String
-> (Object -> Parser SuspendedState)
-> Value
-> Parser SuspendedState
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SuspendedState"
      ( \Object
x ->
          Maybe Bool -> Maybe Bool -> Maybe Bool -> SuspendedState
SuspendedState'
            (Maybe Bool -> Maybe Bool -> Maybe Bool -> SuspendedState)
-> Parser (Maybe Bool)
-> Parser (Maybe Bool -> Maybe Bool -> SuspendedState)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DynamicScalingInSuspended")
            Parser (Maybe Bool -> Maybe Bool -> SuspendedState)
-> Parser (Maybe Bool) -> Parser (Maybe Bool -> SuspendedState)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ScheduledScalingSuspended")
            Parser (Maybe Bool -> SuspendedState)
-> Parser (Maybe Bool) -> Parser SuspendedState
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DynamicScalingOutSuspended")
      )

instance Prelude.Hashable SuspendedState

instance Prelude.NFData SuspendedState

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