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

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

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

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

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

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

instance Prelude.Hashable ProvisionedCapacity

instance Prelude.NFData ProvisionedCapacity

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