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

import qualified Amazonka.Core as Core
import Amazonka.KafkaConnect.Types.ScaleInPolicyDescription
import Amazonka.KafkaConnect.Types.ScaleOutPolicyDescription
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the auto scaling parameters for the connector.
--
-- /See:/ 'newAutoScalingDescription' smart constructor.
data AutoScalingDescription = AutoScalingDescription'
  { -- | The sacle-in policy for the connector.
    AutoScalingDescription -> Maybe ScaleInPolicyDescription
scaleInPolicy :: Prelude.Maybe ScaleInPolicyDescription,
    -- | 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 sacle-out policy for the connector.>
    AutoScalingDescription -> Maybe ScaleOutPolicyDescription
scaleOutPolicy :: Prelude.Maybe ScaleOutPolicyDescription,
    -- | The maximum number of workers allocated to the connector.
    AutoScalingDescription -> Maybe Int
maxWorkerCount :: Prelude.Maybe Prelude.Int,
    -- | The minimum number of workers allocated to the connector.
    AutoScalingDescription -> Maybe Int
minWorkerCount :: Prelude.Maybe Prelude.Int
  }
  deriving (AutoScalingDescription -> AutoScalingDescription -> Bool
(AutoScalingDescription -> AutoScalingDescription -> Bool)
-> (AutoScalingDescription -> AutoScalingDescription -> Bool)
-> Eq AutoScalingDescription
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]
(Int -> ReadS AutoScalingDescription)
-> ReadS [AutoScalingDescription]
-> ReadPrec AutoScalingDescription
-> ReadPrec [AutoScalingDescription]
-> Read 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
(Int -> AutoScalingDescription -> ShowS)
-> (AutoScalingDescription -> String)
-> ([AutoScalingDescription] -> ShowS)
-> Show AutoScalingDescription
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. AutoScalingDescription -> Rep AutoScalingDescription x)
-> (forall x.
    Rep AutoScalingDescription x -> AutoScalingDescription)
-> Generic AutoScalingDescription
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:
--
-- 'scaleInPolicy', 'autoScalingDescription_scaleInPolicy' - The sacle-in policy for the connector.
--
-- 'mcuCount', 'autoScalingDescription_mcuCount' - The number of microcontroller units (MCUs) allocated to each connector
-- worker. The valid values are 1,2,4,8.
--
-- 'scaleOutPolicy', 'autoScalingDescription_scaleOutPolicy' - The sacle-out policy for the connector.>
--
-- 'maxWorkerCount', 'autoScalingDescription_maxWorkerCount' - The maximum number of workers allocated to the connector.
--
-- 'minWorkerCount', 'autoScalingDescription_minWorkerCount' - The minimum number of workers allocated to the connector.
newAutoScalingDescription ::
  AutoScalingDescription
newAutoScalingDescription :: AutoScalingDescription
newAutoScalingDescription =
  AutoScalingDescription' :: Maybe ScaleInPolicyDescription
-> Maybe Int
-> Maybe ScaleOutPolicyDescription
-> Maybe Int
-> Maybe Int
-> AutoScalingDescription
AutoScalingDescription'
    { $sel:scaleInPolicy:AutoScalingDescription' :: Maybe ScaleInPolicyDescription
scaleInPolicy =
        Maybe ScaleInPolicyDescription
forall a. Maybe a
Prelude.Nothing,
      $sel:mcuCount:AutoScalingDescription' :: Maybe Int
mcuCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:scaleOutPolicy:AutoScalingDescription' :: Maybe ScaleOutPolicyDescription
scaleOutPolicy = Maybe ScaleOutPolicyDescription
forall a. Maybe a
Prelude.Nothing,
      $sel:maxWorkerCount:AutoScalingDescription' :: Maybe Int
maxWorkerCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:minWorkerCount:AutoScalingDescription' :: Maybe Int
minWorkerCount = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The sacle-in policy for the connector.
autoScalingDescription_scaleInPolicy :: Lens.Lens' AutoScalingDescription (Prelude.Maybe ScaleInPolicyDescription)
autoScalingDescription_scaleInPolicy :: (Maybe ScaleInPolicyDescription
 -> f (Maybe ScaleInPolicyDescription))
-> AutoScalingDescription -> f AutoScalingDescription
autoScalingDescription_scaleInPolicy = (AutoScalingDescription -> Maybe ScaleInPolicyDescription)
-> (AutoScalingDescription
    -> Maybe ScaleInPolicyDescription -> AutoScalingDescription)
-> Lens
     AutoScalingDescription
     AutoScalingDescription
     (Maybe ScaleInPolicyDescription)
     (Maybe ScaleInPolicyDescription)
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 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 :: (Maybe Int -> f (Maybe Int))
-> AutoScalingDescription -> f AutoScalingDescription
autoScalingDescription_mcuCount = (AutoScalingDescription -> Maybe Int)
-> (AutoScalingDescription -> Maybe Int -> AutoScalingDescription)
-> Lens
     AutoScalingDescription
     AutoScalingDescription
     (Maybe Int)
     (Maybe Int)
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 sacle-out policy for the connector.>
autoScalingDescription_scaleOutPolicy :: Lens.Lens' AutoScalingDescription (Prelude.Maybe ScaleOutPolicyDescription)
autoScalingDescription_scaleOutPolicy :: (Maybe ScaleOutPolicyDescription
 -> f (Maybe ScaleOutPolicyDescription))
-> AutoScalingDescription -> f AutoScalingDescription
autoScalingDescription_scaleOutPolicy = (AutoScalingDescription -> Maybe ScaleOutPolicyDescription)
-> (AutoScalingDescription
    -> Maybe ScaleOutPolicyDescription -> AutoScalingDescription)
-> Lens
     AutoScalingDescription
     AutoScalingDescription
     (Maybe ScaleOutPolicyDescription)
     (Maybe ScaleOutPolicyDescription)
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)

-- | The maximum number of workers allocated to the connector.
autoScalingDescription_maxWorkerCount :: Lens.Lens' AutoScalingDescription (Prelude.Maybe Prelude.Int)
autoScalingDescription_maxWorkerCount :: (Maybe Int -> f (Maybe Int))
-> AutoScalingDescription -> f AutoScalingDescription
autoScalingDescription_maxWorkerCount = (AutoScalingDescription -> Maybe Int)
-> (AutoScalingDescription -> Maybe Int -> AutoScalingDescription)
-> Lens
     AutoScalingDescription
     AutoScalingDescription
     (Maybe Int)
     (Maybe Int)
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 minimum number of workers allocated to the connector.
autoScalingDescription_minWorkerCount :: Lens.Lens' AutoScalingDescription (Prelude.Maybe Prelude.Int)
autoScalingDescription_minWorkerCount :: (Maybe Int -> f (Maybe Int))
-> AutoScalingDescription -> f AutoScalingDescription
autoScalingDescription_minWorkerCount = (AutoScalingDescription -> Maybe Int)
-> (AutoScalingDescription -> Maybe Int -> AutoScalingDescription)
-> Lens
     AutoScalingDescription
     AutoScalingDescription
     (Maybe Int)
     (Maybe Int)
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)

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

instance Prelude.Hashable AutoScalingDescription

instance Prelude.NFData AutoScalingDescription