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

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

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

instance Prelude.Hashable ScaleOutPolicyUpdate

instance Prelude.NFData ScaleOutPolicyUpdate

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