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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

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

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

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

instance Prelude.Hashable ScaleOutPolicy

instance Prelude.NFData ScaleOutPolicy

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