{-# 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.AutoScalingDescription
-- 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.AutoScalingDescription 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.ScaleInPolicyDescription
import Amazonka.KafkaConnect.Types.ScaleOutPolicyDescription
import qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'AutoScalingDescription' 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', 'autoScalingDescription_maxWorkerCount' - The maximum number of workers allocated to the connector.
--
-- 'mcuCount', 'autoScalingDescription_mcuCount' - The number of microcontroller units (MCUs) allocated to each connector
-- worker. The valid values are 1,2,4,8.
--
-- 'minWorkerCount', 'autoScalingDescription_minWorkerCount' - The minimum number of workers allocated to the connector.
--
-- 'scaleInPolicy', 'autoScalingDescription_scaleInPolicy' - The sacle-in policy for the connector.
--
-- 'scaleOutPolicy', 'autoScalingDescription_scaleOutPolicy' - The sacle-out policy for the connector.>
newAutoScalingDescription ::
  AutoScalingDescription
newAutoScalingDescription :: AutoScalingDescription
newAutoScalingDescription =
  AutoScalingDescription'
    { $sel:maxWorkerCount:AutoScalingDescription' :: Maybe Int
maxWorkerCount =
        forall a. Maybe a
Prelude.Nothing,
      $sel:mcuCount:AutoScalingDescription' :: Maybe Int
mcuCount = forall a. Maybe a
Prelude.Nothing,
      $sel:minWorkerCount:AutoScalingDescription' :: Maybe Int
minWorkerCount = forall a. Maybe a
Prelude.Nothing,
      $sel:scaleInPolicy:AutoScalingDescription' :: Maybe ScaleInPolicyDescription
scaleInPolicy = forall a. Maybe a
Prelude.Nothing,
      $sel:scaleOutPolicy:AutoScalingDescription' :: Maybe ScaleOutPolicyDescription
scaleOutPolicy = forall a. Maybe a
Prelude.Nothing
    }

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

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

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

-- | The sacle-in policy for the connector.
autoScalingDescription_scaleInPolicy :: Lens.Lens' AutoScalingDescription (Prelude.Maybe ScaleInPolicyDescription)
autoScalingDescription_scaleInPolicy :: Lens' AutoScalingDescription (Maybe ScaleInPolicyDescription)
autoScalingDescription_scaleInPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingDescription' {Maybe ScaleInPolicyDescription
scaleInPolicy :: Maybe ScaleInPolicyDescription
$sel:scaleInPolicy:AutoScalingDescription' :: AutoScalingDescription -> Maybe ScaleInPolicyDescription
scaleInPolicy} -> Maybe ScaleInPolicyDescription
scaleInPolicy) (\s :: AutoScalingDescription
s@AutoScalingDescription' {} Maybe ScaleInPolicyDescription
a -> AutoScalingDescription
s {$sel:scaleInPolicy:AutoScalingDescription' :: Maybe ScaleInPolicyDescription
scaleInPolicy = Maybe ScaleInPolicyDescription
a} :: AutoScalingDescription)

-- | The sacle-out policy for the connector.>
autoScalingDescription_scaleOutPolicy :: Lens.Lens' AutoScalingDescription (Prelude.Maybe ScaleOutPolicyDescription)
autoScalingDescription_scaleOutPolicy :: Lens' AutoScalingDescription (Maybe ScaleOutPolicyDescription)
autoScalingDescription_scaleOutPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingDescription' {Maybe ScaleOutPolicyDescription
scaleOutPolicy :: Maybe ScaleOutPolicyDescription
$sel:scaleOutPolicy:AutoScalingDescription' :: AutoScalingDescription -> Maybe ScaleOutPolicyDescription
scaleOutPolicy} -> Maybe ScaleOutPolicyDescription
scaleOutPolicy) (\s :: AutoScalingDescription
s@AutoScalingDescription' {} Maybe ScaleOutPolicyDescription
a -> AutoScalingDescription
s {$sel:scaleOutPolicy:AutoScalingDescription' :: Maybe ScaleOutPolicyDescription
scaleOutPolicy = Maybe ScaleOutPolicyDescription
a} :: AutoScalingDescription)

instance Data.FromJSON AutoScalingDescription where
  parseJSON :: Value -> Parser AutoScalingDescription
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AutoScalingDescription"
      ( \Object
x ->
          Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe ScaleInPolicyDescription
-> Maybe ScaleOutPolicyDescription
-> AutoScalingDescription
AutoScalingDescription'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"maxWorkerCount")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"mcuCount")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"minWorkerCount")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"scaleInPolicy")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"scaleOutPolicy")
      )

instance Prelude.Hashable AutoScalingDescription where
  hashWithSalt :: Int -> AutoScalingDescription -> Int
hashWithSalt Int
_salt AutoScalingDescription' {Maybe Int
Maybe ScaleInPolicyDescription
Maybe ScaleOutPolicyDescription
scaleOutPolicy :: Maybe ScaleOutPolicyDescription
scaleInPolicy :: Maybe ScaleInPolicyDescription
minWorkerCount :: Maybe Int
mcuCount :: Maybe Int
maxWorkerCount :: Maybe Int
$sel:scaleOutPolicy:AutoScalingDescription' :: AutoScalingDescription -> Maybe ScaleOutPolicyDescription
$sel:scaleInPolicy:AutoScalingDescription' :: AutoScalingDescription -> Maybe ScaleInPolicyDescription
$sel:minWorkerCount:AutoScalingDescription' :: AutoScalingDescription -> Maybe Int
$sel:mcuCount:AutoScalingDescription' :: AutoScalingDescription -> Maybe Int
$sel:maxWorkerCount:AutoScalingDescription' :: AutoScalingDescription -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxWorkerCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
mcuCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
minWorkerCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ScaleInPolicyDescription
scaleInPolicy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ScaleOutPolicyDescription
scaleOutPolicy

instance Prelude.NFData AutoScalingDescription where
  rnf :: AutoScalingDescription -> ()
rnf AutoScalingDescription' {Maybe Int
Maybe ScaleInPolicyDescription
Maybe ScaleOutPolicyDescription
scaleOutPolicy :: Maybe ScaleOutPolicyDescription
scaleInPolicy :: Maybe ScaleInPolicyDescription
minWorkerCount :: Maybe Int
mcuCount :: Maybe Int
maxWorkerCount :: Maybe Int
$sel:scaleOutPolicy:AutoScalingDescription' :: AutoScalingDescription -> Maybe ScaleOutPolicyDescription
$sel:scaleInPolicy:AutoScalingDescription' :: AutoScalingDescription -> Maybe ScaleInPolicyDescription
$sel:minWorkerCount:AutoScalingDescription' :: AutoScalingDescription -> Maybe Int
$sel:mcuCount:AutoScalingDescription' :: AutoScalingDescription -> Maybe Int
$sel:maxWorkerCount:AutoScalingDescription' :: AutoScalingDescription -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxWorkerCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
mcuCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
minWorkerCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ScaleInPolicyDescription
scaleInPolicy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ScaleOutPolicyDescription
scaleOutPolicy