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

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

instance Prelude.NFData ScaleInPolicy

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