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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(ScaleInPolicyUpdate -> ScaleInPolicyUpdate -> Bool)
-> (ScaleInPolicyUpdate -> ScaleInPolicyUpdate -> Bool)
-> Eq ScaleInPolicyUpdate
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]
(Int -> ReadS ScaleInPolicyUpdate)
-> ReadS [ScaleInPolicyUpdate]
-> ReadPrec ScaleInPolicyUpdate
-> ReadPrec [ScaleInPolicyUpdate]
-> Read 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
(Int -> ScaleInPolicyUpdate -> ShowS)
-> (ScaleInPolicyUpdate -> String)
-> ([ScaleInPolicyUpdate] -> ShowS)
-> Show ScaleInPolicyUpdate
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. ScaleInPolicyUpdate -> Rep ScaleInPolicyUpdate x)
-> (forall x. Rep ScaleInPolicyUpdate x -> ScaleInPolicyUpdate)
-> Generic ScaleInPolicyUpdate
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' :: Natural -> ScaleInPolicyUpdate
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 :: (Natural -> f Natural)
-> ScaleInPolicyUpdate -> f ScaleInPolicyUpdate
scaleInPolicyUpdate_cpuUtilizationPercentage = (ScaleInPolicyUpdate -> Natural)
-> (ScaleInPolicyUpdate -> Natural -> ScaleInPolicyUpdate)
-> Lens ScaleInPolicyUpdate ScaleInPolicyUpdate Natural Natural
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

instance Prelude.NFData ScaleInPolicyUpdate

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