{-# 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.KafkaConnect.Types.ScaleInPolicyDescription
-- 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.KafkaConnect.Types.ScaleInPolicyDescription where

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

-- | The description of the scale-in policy for the connector.
--
-- /See:/ 'newScaleInPolicyDescription' smart constructor.
data ScaleInPolicyDescription = ScaleInPolicyDescription'
  { -- | Specifies the CPU utilization percentage threshold at which you want
    -- connector scale in to be triggered.
    ScaleInPolicyDescription -> Maybe Int
cpuUtilizationPercentage :: Prelude.Maybe Prelude.Int
  }
  deriving (ScaleInPolicyDescription -> ScaleInPolicyDescription -> Bool
(ScaleInPolicyDescription -> ScaleInPolicyDescription -> Bool)
-> (ScaleInPolicyDescription -> ScaleInPolicyDescription -> Bool)
-> Eq ScaleInPolicyDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScaleInPolicyDescription -> ScaleInPolicyDescription -> Bool
$c/= :: ScaleInPolicyDescription -> ScaleInPolicyDescription -> Bool
== :: ScaleInPolicyDescription -> ScaleInPolicyDescription -> Bool
$c== :: ScaleInPolicyDescription -> ScaleInPolicyDescription -> Bool
Prelude.Eq, ReadPrec [ScaleInPolicyDescription]
ReadPrec ScaleInPolicyDescription
Int -> ReadS ScaleInPolicyDescription
ReadS [ScaleInPolicyDescription]
(Int -> ReadS ScaleInPolicyDescription)
-> ReadS [ScaleInPolicyDescription]
-> ReadPrec ScaleInPolicyDescription
-> ReadPrec [ScaleInPolicyDescription]
-> Read ScaleInPolicyDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScaleInPolicyDescription]
$creadListPrec :: ReadPrec [ScaleInPolicyDescription]
readPrec :: ReadPrec ScaleInPolicyDescription
$creadPrec :: ReadPrec ScaleInPolicyDescription
readList :: ReadS [ScaleInPolicyDescription]
$creadList :: ReadS [ScaleInPolicyDescription]
readsPrec :: Int -> ReadS ScaleInPolicyDescription
$creadsPrec :: Int -> ReadS ScaleInPolicyDescription
Prelude.Read, Int -> ScaleInPolicyDescription -> ShowS
[ScaleInPolicyDescription] -> ShowS
ScaleInPolicyDescription -> String
(Int -> ScaleInPolicyDescription -> ShowS)
-> (ScaleInPolicyDescription -> String)
-> ([ScaleInPolicyDescription] -> ShowS)
-> Show ScaleInPolicyDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScaleInPolicyDescription] -> ShowS
$cshowList :: [ScaleInPolicyDescription] -> ShowS
show :: ScaleInPolicyDescription -> String
$cshow :: ScaleInPolicyDescription -> String
showsPrec :: Int -> ScaleInPolicyDescription -> ShowS
$cshowsPrec :: Int -> ScaleInPolicyDescription -> ShowS
Prelude.Show, (forall x.
 ScaleInPolicyDescription -> Rep ScaleInPolicyDescription x)
-> (forall x.
    Rep ScaleInPolicyDescription x -> ScaleInPolicyDescription)
-> Generic ScaleInPolicyDescription
forall x.
Rep ScaleInPolicyDescription x -> ScaleInPolicyDescription
forall x.
ScaleInPolicyDescription -> Rep ScaleInPolicyDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ScaleInPolicyDescription x -> ScaleInPolicyDescription
$cfrom :: forall x.
ScaleInPolicyDescription -> Rep ScaleInPolicyDescription x
Prelude.Generic)

-- |
-- Create a value of 'ScaleInPolicyDescription' 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:
--
-- 'cpuUtilizationPercentage', 'scaleInPolicyDescription_cpuUtilizationPercentage' - Specifies the CPU utilization percentage threshold at which you want
-- connector scale in to be triggered.
newScaleInPolicyDescription ::
  ScaleInPolicyDescription
newScaleInPolicyDescription :: ScaleInPolicyDescription
newScaleInPolicyDescription =
  ScaleInPolicyDescription' :: Maybe Int -> ScaleInPolicyDescription
ScaleInPolicyDescription'
    { $sel:cpuUtilizationPercentage:ScaleInPolicyDescription' :: Maybe Int
cpuUtilizationPercentage =
        Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the CPU utilization percentage threshold at which you want
-- connector scale in to be triggered.
scaleInPolicyDescription_cpuUtilizationPercentage :: Lens.Lens' ScaleInPolicyDescription (Prelude.Maybe Prelude.Int)
scaleInPolicyDescription_cpuUtilizationPercentage :: (Maybe Int -> f (Maybe Int))
-> ScaleInPolicyDescription -> f ScaleInPolicyDescription
scaleInPolicyDescription_cpuUtilizationPercentage = (ScaleInPolicyDescription -> Maybe Int)
-> (ScaleInPolicyDescription
    -> Maybe Int -> ScaleInPolicyDescription)
-> Lens
     ScaleInPolicyDescription
     ScaleInPolicyDescription
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScaleInPolicyDescription' {Maybe Int
cpuUtilizationPercentage :: Maybe Int
$sel:cpuUtilizationPercentage:ScaleInPolicyDescription' :: ScaleInPolicyDescription -> Maybe Int
cpuUtilizationPercentage} -> Maybe Int
cpuUtilizationPercentage) (\s :: ScaleInPolicyDescription
s@ScaleInPolicyDescription' {} Maybe Int
a -> ScaleInPolicyDescription
s {$sel:cpuUtilizationPercentage:ScaleInPolicyDescription' :: Maybe Int
cpuUtilizationPercentage = Maybe Int
a} :: ScaleInPolicyDescription)

instance Core.FromJSON ScaleInPolicyDescription where
  parseJSON :: Value -> Parser ScaleInPolicyDescription
parseJSON =
    String
-> (Object -> Parser ScaleInPolicyDescription)
-> Value
-> Parser ScaleInPolicyDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ScaleInPolicyDescription"
      ( \Object
x ->
          Maybe Int -> ScaleInPolicyDescription
ScaleInPolicyDescription'
            (Maybe Int -> ScaleInPolicyDescription)
-> Parser (Maybe Int) -> Parser ScaleInPolicyDescription
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"cpuUtilizationPercentage")
      )

instance Prelude.Hashable ScaleInPolicyDescription

instance Prelude.NFData ScaleInPolicyDescription