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

-- | 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
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]
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
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.
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'
    { $sel:cpuUtilizationPercentage:ScaleInPolicyDescription' :: Maybe Int
cpuUtilizationPercentage =
        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 :: Lens' ScaleInPolicyDescription (Maybe Int)
scaleInPolicyDescription_cpuUtilizationPercentage = 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 Data.FromJSON ScaleInPolicyDescription where
  parseJSON :: Value -> Parser ScaleInPolicyDescription
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ScaleInPolicyDescription"
      ( \Object
x ->
          Maybe Int -> ScaleInPolicyDescription
ScaleInPolicyDescription'
            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
"cpuUtilizationPercentage")
      )

instance Prelude.Hashable ScaleInPolicyDescription where
  hashWithSalt :: Int -> ScaleInPolicyDescription -> Int
hashWithSalt Int
_salt ScaleInPolicyDescription' {Maybe Int
cpuUtilizationPercentage :: Maybe Int
$sel:cpuUtilizationPercentage:ScaleInPolicyDescription' :: ScaleInPolicyDescription -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
cpuUtilizationPercentage

instance Prelude.NFData ScaleInPolicyDescription where
  rnf :: ScaleInPolicyDescription -> ()
rnf ScaleInPolicyDescription' {Maybe Int
cpuUtilizationPercentage :: Maybe Int
$sel:cpuUtilizationPercentage:ScaleInPolicyDescription' :: ScaleInPolicyDescription -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
cpuUtilizationPercentage