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

-- |
-- Create a value of 'ScaleInPolicy' 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', 'scaleInPolicy_cpuUtilizationPercentage' - Specifies the CPU utilization percentage threshold at which you want
-- connector scale in to be triggered.
newScaleInPolicy ::
  -- | 'cpuUtilizationPercentage'
  Prelude.Natural ->
  ScaleInPolicy
newScaleInPolicy :: Natural -> ScaleInPolicy
newScaleInPolicy Natural
pCpuUtilizationPercentage_ =
  ScaleInPolicy'
    { $sel:cpuUtilizationPercentage:ScaleInPolicy' :: Natural
cpuUtilizationPercentage =
        Natural
pCpuUtilizationPercentage_
    }

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

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

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

instance Data.ToJSON ScaleInPolicy where
  toJSON :: ScaleInPolicy -> Value
toJSON ScaleInPolicy' {Natural
cpuUtilizationPercentage :: Natural
$sel:cpuUtilizationPercentage:ScaleInPolicy' :: ScaleInPolicy -> Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"cpuUtilizationPercentage"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
cpuUtilizationPercentage
              )
          ]
      )