{-# 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.ScaleInPolicyUpdate
-- 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.ScaleInPolicyUpdate 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

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

-- |
-- Create a value of 'ScaleInPolicyUpdate' 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', 'scaleInPolicyUpdate_cpuUtilizationPercentage' - The target CPU utilization percentage threshold at which you want
-- connector scale in to be triggered.
newScaleInPolicyUpdate ::
  -- | 'cpuUtilizationPercentage'
  Prelude.Natural ->
  ScaleInPolicyUpdate
newScaleInPolicyUpdate :: Natural -> ScaleInPolicyUpdate
newScaleInPolicyUpdate Natural
pCpuUtilizationPercentage_ =
  ScaleInPolicyUpdate'
    { $sel:cpuUtilizationPercentage:ScaleInPolicyUpdate' :: Natural
cpuUtilizationPercentage =
        Natural
pCpuUtilizationPercentage_
    }

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

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

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

instance Data.ToJSON ScaleInPolicyUpdate where
  toJSON :: ScaleInPolicyUpdate -> Value
toJSON ScaleInPolicyUpdate' {Natural
cpuUtilizationPercentage :: Natural
$sel:cpuUtilizationPercentage:ScaleInPolicyUpdate' :: ScaleInPolicyUpdate -> 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
              )
          ]
      )