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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.KafkaConnect.Types.ScaleInPolicyUpdate
import Amazonka.KafkaConnect.Types.ScaleOutPolicyUpdate
import qualified Amazonka.Prelude as Prelude

-- | The updates to the auto scaling parameters for the connector.
--
-- /See:/ 'newAutoScalingUpdate' smart constructor.
data AutoScalingUpdate = AutoScalingUpdate'
  { -- | The target maximum number of workers allocated to the connector.
    AutoScalingUpdate -> Natural
maxWorkerCount :: Prelude.Natural,
    -- | The target number of microcontroller units (MCUs) allocated to each
    -- connector worker. The valid values are 1,2,4,8.
    AutoScalingUpdate -> Natural
mcuCount :: Prelude.Natural,
    -- | The target minimum number of workers allocated to the connector.
    AutoScalingUpdate -> Natural
minWorkerCount :: Prelude.Natural,
    -- | The target sacle-in policy for the connector.
    AutoScalingUpdate -> ScaleInPolicyUpdate
scaleInPolicy :: ScaleInPolicyUpdate,
    -- | The target sacle-out policy for the connector.
    AutoScalingUpdate -> ScaleOutPolicyUpdate
scaleOutPolicy :: ScaleOutPolicyUpdate
  }
  deriving (AutoScalingUpdate -> AutoScalingUpdate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoScalingUpdate -> AutoScalingUpdate -> Bool
$c/= :: AutoScalingUpdate -> AutoScalingUpdate -> Bool
== :: AutoScalingUpdate -> AutoScalingUpdate -> Bool
$c== :: AutoScalingUpdate -> AutoScalingUpdate -> Bool
Prelude.Eq, ReadPrec [AutoScalingUpdate]
ReadPrec AutoScalingUpdate
Int -> ReadS AutoScalingUpdate
ReadS [AutoScalingUpdate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoScalingUpdate]
$creadListPrec :: ReadPrec [AutoScalingUpdate]
readPrec :: ReadPrec AutoScalingUpdate
$creadPrec :: ReadPrec AutoScalingUpdate
readList :: ReadS [AutoScalingUpdate]
$creadList :: ReadS [AutoScalingUpdate]
readsPrec :: Int -> ReadS AutoScalingUpdate
$creadsPrec :: Int -> ReadS AutoScalingUpdate
Prelude.Read, Int -> AutoScalingUpdate -> ShowS
[AutoScalingUpdate] -> ShowS
AutoScalingUpdate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoScalingUpdate] -> ShowS
$cshowList :: [AutoScalingUpdate] -> ShowS
show :: AutoScalingUpdate -> String
$cshow :: AutoScalingUpdate -> String
showsPrec :: Int -> AutoScalingUpdate -> ShowS
$cshowsPrec :: Int -> AutoScalingUpdate -> ShowS
Prelude.Show, forall x. Rep AutoScalingUpdate x -> AutoScalingUpdate
forall x. AutoScalingUpdate -> Rep AutoScalingUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AutoScalingUpdate x -> AutoScalingUpdate
$cfrom :: forall x. AutoScalingUpdate -> Rep AutoScalingUpdate x
Prelude.Generic)

-- |
-- Create a value of 'AutoScalingUpdate' 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:
--
-- 'maxWorkerCount', 'autoScalingUpdate_maxWorkerCount' - The target maximum number of workers allocated to the connector.
--
-- 'mcuCount', 'autoScalingUpdate_mcuCount' - The target number of microcontroller units (MCUs) allocated to each
-- connector worker. The valid values are 1,2,4,8.
--
-- 'minWorkerCount', 'autoScalingUpdate_minWorkerCount' - The target minimum number of workers allocated to the connector.
--
-- 'scaleInPolicy', 'autoScalingUpdate_scaleInPolicy' - The target sacle-in policy for the connector.
--
-- 'scaleOutPolicy', 'autoScalingUpdate_scaleOutPolicy' - The target sacle-out policy for the connector.
newAutoScalingUpdate ::
  -- | 'maxWorkerCount'
  Prelude.Natural ->
  -- | 'mcuCount'
  Prelude.Natural ->
  -- | 'minWorkerCount'
  Prelude.Natural ->
  -- | 'scaleInPolicy'
  ScaleInPolicyUpdate ->
  -- | 'scaleOutPolicy'
  ScaleOutPolicyUpdate ->
  AutoScalingUpdate
newAutoScalingUpdate :: Natural
-> Natural
-> Natural
-> ScaleInPolicyUpdate
-> ScaleOutPolicyUpdate
-> AutoScalingUpdate
newAutoScalingUpdate
  Natural
pMaxWorkerCount_
  Natural
pMcuCount_
  Natural
pMinWorkerCount_
  ScaleInPolicyUpdate
pScaleInPolicy_
  ScaleOutPolicyUpdate
pScaleOutPolicy_ =
    AutoScalingUpdate'
      { $sel:maxWorkerCount:AutoScalingUpdate' :: Natural
maxWorkerCount =
          Natural
pMaxWorkerCount_,
        $sel:mcuCount:AutoScalingUpdate' :: Natural
mcuCount = Natural
pMcuCount_,
        $sel:minWorkerCount:AutoScalingUpdate' :: Natural
minWorkerCount = Natural
pMinWorkerCount_,
        $sel:scaleInPolicy:AutoScalingUpdate' :: ScaleInPolicyUpdate
scaleInPolicy = ScaleInPolicyUpdate
pScaleInPolicy_,
        $sel:scaleOutPolicy:AutoScalingUpdate' :: ScaleOutPolicyUpdate
scaleOutPolicy = ScaleOutPolicyUpdate
pScaleOutPolicy_
      }

-- | The target maximum number of workers allocated to the connector.
autoScalingUpdate_maxWorkerCount :: Lens.Lens' AutoScalingUpdate Prelude.Natural
autoScalingUpdate_maxWorkerCount :: Lens' AutoScalingUpdate Natural
autoScalingUpdate_maxWorkerCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingUpdate' {Natural
maxWorkerCount :: Natural
$sel:maxWorkerCount:AutoScalingUpdate' :: AutoScalingUpdate -> Natural
maxWorkerCount} -> Natural
maxWorkerCount) (\s :: AutoScalingUpdate
s@AutoScalingUpdate' {} Natural
a -> AutoScalingUpdate
s {$sel:maxWorkerCount:AutoScalingUpdate' :: Natural
maxWorkerCount = Natural
a} :: AutoScalingUpdate)

-- | The target number of microcontroller units (MCUs) allocated to each
-- connector worker. The valid values are 1,2,4,8.
autoScalingUpdate_mcuCount :: Lens.Lens' AutoScalingUpdate Prelude.Natural
autoScalingUpdate_mcuCount :: Lens' AutoScalingUpdate Natural
autoScalingUpdate_mcuCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingUpdate' {Natural
mcuCount :: Natural
$sel:mcuCount:AutoScalingUpdate' :: AutoScalingUpdate -> Natural
mcuCount} -> Natural
mcuCount) (\s :: AutoScalingUpdate
s@AutoScalingUpdate' {} Natural
a -> AutoScalingUpdate
s {$sel:mcuCount:AutoScalingUpdate' :: Natural
mcuCount = Natural
a} :: AutoScalingUpdate)

-- | The target minimum number of workers allocated to the connector.
autoScalingUpdate_minWorkerCount :: Lens.Lens' AutoScalingUpdate Prelude.Natural
autoScalingUpdate_minWorkerCount :: Lens' AutoScalingUpdate Natural
autoScalingUpdate_minWorkerCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingUpdate' {Natural
minWorkerCount :: Natural
$sel:minWorkerCount:AutoScalingUpdate' :: AutoScalingUpdate -> Natural
minWorkerCount} -> Natural
minWorkerCount) (\s :: AutoScalingUpdate
s@AutoScalingUpdate' {} Natural
a -> AutoScalingUpdate
s {$sel:minWorkerCount:AutoScalingUpdate' :: Natural
minWorkerCount = Natural
a} :: AutoScalingUpdate)

-- | The target sacle-in policy for the connector.
autoScalingUpdate_scaleInPolicy :: Lens.Lens' AutoScalingUpdate ScaleInPolicyUpdate
autoScalingUpdate_scaleInPolicy :: Lens' AutoScalingUpdate ScaleInPolicyUpdate
autoScalingUpdate_scaleInPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingUpdate' {ScaleInPolicyUpdate
scaleInPolicy :: ScaleInPolicyUpdate
$sel:scaleInPolicy:AutoScalingUpdate' :: AutoScalingUpdate -> ScaleInPolicyUpdate
scaleInPolicy} -> ScaleInPolicyUpdate
scaleInPolicy) (\s :: AutoScalingUpdate
s@AutoScalingUpdate' {} ScaleInPolicyUpdate
a -> AutoScalingUpdate
s {$sel:scaleInPolicy:AutoScalingUpdate' :: ScaleInPolicyUpdate
scaleInPolicy = ScaleInPolicyUpdate
a} :: AutoScalingUpdate)

-- | The target sacle-out policy for the connector.
autoScalingUpdate_scaleOutPolicy :: Lens.Lens' AutoScalingUpdate ScaleOutPolicyUpdate
autoScalingUpdate_scaleOutPolicy :: Lens' AutoScalingUpdate ScaleOutPolicyUpdate
autoScalingUpdate_scaleOutPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingUpdate' {ScaleOutPolicyUpdate
scaleOutPolicy :: ScaleOutPolicyUpdate
$sel:scaleOutPolicy:AutoScalingUpdate' :: AutoScalingUpdate -> ScaleOutPolicyUpdate
scaleOutPolicy} -> ScaleOutPolicyUpdate
scaleOutPolicy) (\s :: AutoScalingUpdate
s@AutoScalingUpdate' {} ScaleOutPolicyUpdate
a -> AutoScalingUpdate
s {$sel:scaleOutPolicy:AutoScalingUpdate' :: ScaleOutPolicyUpdate
scaleOutPolicy = ScaleOutPolicyUpdate
a} :: AutoScalingUpdate)

instance Prelude.Hashable AutoScalingUpdate where
  hashWithSalt :: Int -> AutoScalingUpdate -> Int
hashWithSalt Int
_salt AutoScalingUpdate' {Natural
ScaleInPolicyUpdate
ScaleOutPolicyUpdate
scaleOutPolicy :: ScaleOutPolicyUpdate
scaleInPolicy :: ScaleInPolicyUpdate
minWorkerCount :: Natural
mcuCount :: Natural
maxWorkerCount :: Natural
$sel:scaleOutPolicy:AutoScalingUpdate' :: AutoScalingUpdate -> ScaleOutPolicyUpdate
$sel:scaleInPolicy:AutoScalingUpdate' :: AutoScalingUpdate -> ScaleInPolicyUpdate
$sel:minWorkerCount:AutoScalingUpdate' :: AutoScalingUpdate -> Natural
$sel:mcuCount:AutoScalingUpdate' :: AutoScalingUpdate -> Natural
$sel:maxWorkerCount:AutoScalingUpdate' :: AutoScalingUpdate -> Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
maxWorkerCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
mcuCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
minWorkerCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ScaleInPolicyUpdate
scaleInPolicy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ScaleOutPolicyUpdate
scaleOutPolicy

instance Prelude.NFData AutoScalingUpdate where
  rnf :: AutoScalingUpdate -> ()
rnf AutoScalingUpdate' {Natural
ScaleInPolicyUpdate
ScaleOutPolicyUpdate
scaleOutPolicy :: ScaleOutPolicyUpdate
scaleInPolicy :: ScaleInPolicyUpdate
minWorkerCount :: Natural
mcuCount :: Natural
maxWorkerCount :: Natural
$sel:scaleOutPolicy:AutoScalingUpdate' :: AutoScalingUpdate -> ScaleOutPolicyUpdate
$sel:scaleInPolicy:AutoScalingUpdate' :: AutoScalingUpdate -> ScaleInPolicyUpdate
$sel:minWorkerCount:AutoScalingUpdate' :: AutoScalingUpdate -> Natural
$sel:mcuCount:AutoScalingUpdate' :: AutoScalingUpdate -> Natural
$sel:maxWorkerCount:AutoScalingUpdate' :: AutoScalingUpdate -> Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Natural
maxWorkerCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
mcuCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
minWorkerCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ScaleInPolicyUpdate
scaleInPolicy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ScaleOutPolicyUpdate
scaleOutPolicy

instance Data.ToJSON AutoScalingUpdate where
  toJSON :: AutoScalingUpdate -> Value
toJSON AutoScalingUpdate' {Natural
ScaleInPolicyUpdate
ScaleOutPolicyUpdate
scaleOutPolicy :: ScaleOutPolicyUpdate
scaleInPolicy :: ScaleInPolicyUpdate
minWorkerCount :: Natural
mcuCount :: Natural
maxWorkerCount :: Natural
$sel:scaleOutPolicy:AutoScalingUpdate' :: AutoScalingUpdate -> ScaleOutPolicyUpdate
$sel:scaleInPolicy:AutoScalingUpdate' :: AutoScalingUpdate -> ScaleInPolicyUpdate
$sel:minWorkerCount:AutoScalingUpdate' :: AutoScalingUpdate -> Natural
$sel:mcuCount:AutoScalingUpdate' :: AutoScalingUpdate -> Natural
$sel:maxWorkerCount:AutoScalingUpdate' :: AutoScalingUpdate -> Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"maxWorkerCount" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
maxWorkerCount),
            forall a. a -> Maybe a
Prelude.Just (Key
"mcuCount" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
mcuCount),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"minWorkerCount" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
minWorkerCount),
            forall a. a -> Maybe a
Prelude.Just (Key
"scaleInPolicy" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ScaleInPolicyUpdate
scaleInPolicy),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"scaleOutPolicy" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ScaleOutPolicyUpdate
scaleOutPolicy)
          ]
      )