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

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

-- | An update to a connector\'s fixed capacity.
--
-- /See:/ 'newProvisionedCapacityUpdate' smart constructor.
data ProvisionedCapacityUpdate = ProvisionedCapacityUpdate'
  { -- | The number of microcontroller units (MCUs) allocated to each connector
    -- worker. The valid values are 1,2,4,8.
    ProvisionedCapacityUpdate -> Natural
mcuCount :: Prelude.Natural,
    -- | The number of workers that are allocated to the connector.
    ProvisionedCapacityUpdate -> Natural
workerCount :: Prelude.Natural
  }
  deriving (ProvisionedCapacityUpdate -> ProvisionedCapacityUpdate -> Bool
(ProvisionedCapacityUpdate -> ProvisionedCapacityUpdate -> Bool)
-> (ProvisionedCapacityUpdate -> ProvisionedCapacityUpdate -> Bool)
-> Eq ProvisionedCapacityUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProvisionedCapacityUpdate -> ProvisionedCapacityUpdate -> Bool
$c/= :: ProvisionedCapacityUpdate -> ProvisionedCapacityUpdate -> Bool
== :: ProvisionedCapacityUpdate -> ProvisionedCapacityUpdate -> Bool
$c== :: ProvisionedCapacityUpdate -> ProvisionedCapacityUpdate -> Bool
Prelude.Eq, ReadPrec [ProvisionedCapacityUpdate]
ReadPrec ProvisionedCapacityUpdate
Int -> ReadS ProvisionedCapacityUpdate
ReadS [ProvisionedCapacityUpdate]
(Int -> ReadS ProvisionedCapacityUpdate)
-> ReadS [ProvisionedCapacityUpdate]
-> ReadPrec ProvisionedCapacityUpdate
-> ReadPrec [ProvisionedCapacityUpdate]
-> Read ProvisionedCapacityUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProvisionedCapacityUpdate]
$creadListPrec :: ReadPrec [ProvisionedCapacityUpdate]
readPrec :: ReadPrec ProvisionedCapacityUpdate
$creadPrec :: ReadPrec ProvisionedCapacityUpdate
readList :: ReadS [ProvisionedCapacityUpdate]
$creadList :: ReadS [ProvisionedCapacityUpdate]
readsPrec :: Int -> ReadS ProvisionedCapacityUpdate
$creadsPrec :: Int -> ReadS ProvisionedCapacityUpdate
Prelude.Read, Int -> ProvisionedCapacityUpdate -> ShowS
[ProvisionedCapacityUpdate] -> ShowS
ProvisionedCapacityUpdate -> String
(Int -> ProvisionedCapacityUpdate -> ShowS)
-> (ProvisionedCapacityUpdate -> String)
-> ([ProvisionedCapacityUpdate] -> ShowS)
-> Show ProvisionedCapacityUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProvisionedCapacityUpdate] -> ShowS
$cshowList :: [ProvisionedCapacityUpdate] -> ShowS
show :: ProvisionedCapacityUpdate -> String
$cshow :: ProvisionedCapacityUpdate -> String
showsPrec :: Int -> ProvisionedCapacityUpdate -> ShowS
$cshowsPrec :: Int -> ProvisionedCapacityUpdate -> ShowS
Prelude.Show, (forall x.
 ProvisionedCapacityUpdate -> Rep ProvisionedCapacityUpdate x)
-> (forall x.
    Rep ProvisionedCapacityUpdate x -> ProvisionedCapacityUpdate)
-> Generic ProvisionedCapacityUpdate
forall x.
Rep ProvisionedCapacityUpdate x -> ProvisionedCapacityUpdate
forall x.
ProvisionedCapacityUpdate -> Rep ProvisionedCapacityUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ProvisionedCapacityUpdate x -> ProvisionedCapacityUpdate
$cfrom :: forall x.
ProvisionedCapacityUpdate -> Rep ProvisionedCapacityUpdate x
Prelude.Generic)

-- |
-- Create a value of 'ProvisionedCapacityUpdate' 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:
--
-- 'mcuCount', 'provisionedCapacityUpdate_mcuCount' - The number of microcontroller units (MCUs) allocated to each connector
-- worker. The valid values are 1,2,4,8.
--
-- 'workerCount', 'provisionedCapacityUpdate_workerCount' - The number of workers that are allocated to the connector.
newProvisionedCapacityUpdate ::
  -- | 'mcuCount'
  Prelude.Natural ->
  -- | 'workerCount'
  Prelude.Natural ->
  ProvisionedCapacityUpdate
newProvisionedCapacityUpdate :: Natural -> Natural -> ProvisionedCapacityUpdate
newProvisionedCapacityUpdate Natural
pMcuCount_ Natural
pWorkerCount_ =
  ProvisionedCapacityUpdate' :: Natural -> Natural -> ProvisionedCapacityUpdate
ProvisionedCapacityUpdate'
    { $sel:mcuCount:ProvisionedCapacityUpdate' :: Natural
mcuCount = Natural
pMcuCount_,
      $sel:workerCount:ProvisionedCapacityUpdate' :: Natural
workerCount = Natural
pWorkerCount_
    }

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

-- | The number of workers that are allocated to the connector.
provisionedCapacityUpdate_workerCount :: Lens.Lens' ProvisionedCapacityUpdate Prelude.Natural
provisionedCapacityUpdate_workerCount :: (Natural -> f Natural)
-> ProvisionedCapacityUpdate -> f ProvisionedCapacityUpdate
provisionedCapacityUpdate_workerCount = (ProvisionedCapacityUpdate -> Natural)
-> (ProvisionedCapacityUpdate
    -> Natural -> ProvisionedCapacityUpdate)
-> Lens
     ProvisionedCapacityUpdate ProvisionedCapacityUpdate Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisionedCapacityUpdate' {Natural
workerCount :: Natural
$sel:workerCount:ProvisionedCapacityUpdate' :: ProvisionedCapacityUpdate -> Natural
workerCount} -> Natural
workerCount) (\s :: ProvisionedCapacityUpdate
s@ProvisionedCapacityUpdate' {} Natural
a -> ProvisionedCapacityUpdate
s {$sel:workerCount:ProvisionedCapacityUpdate' :: Natural
workerCount = Natural
a} :: ProvisionedCapacityUpdate)

instance Prelude.Hashable ProvisionedCapacityUpdate

instance Prelude.NFData ProvisionedCapacityUpdate

instance Core.ToJSON ProvisionedCapacityUpdate where
  toJSON :: ProvisionedCapacityUpdate -> Value
toJSON ProvisionedCapacityUpdate' {Natural
workerCount :: Natural
mcuCount :: Natural
$sel:workerCount:ProvisionedCapacityUpdate' :: ProvisionedCapacityUpdate -> Natural
$sel:mcuCount:ProvisionedCapacityUpdate' :: ProvisionedCapacityUpdate -> 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
"mcuCount" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
mcuCount),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"workerCount" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
workerCount)
          ]
      )