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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
    { $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 :: Lens' ProvisionedCapacity Natural
provisionedCapacity_mcuCount = 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 :: Lens' ProvisionedCapacity Natural
provisionedCapacity_workerCount = 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 where
  hashWithSalt :: Int -> ProvisionedCapacity -> Int
hashWithSalt Int
_salt ProvisionedCapacity' {Natural
workerCount :: Natural
mcuCount :: Natural
$sel:workerCount:ProvisionedCapacity' :: ProvisionedCapacity -> Natural
$sel:mcuCount:ProvisionedCapacity' :: ProvisionedCapacity -> Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
mcuCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
workerCount

instance Prelude.NFData ProvisionedCapacity where
  rnf :: ProvisionedCapacity -> ()
rnf ProvisionedCapacity' {Natural
workerCount :: Natural
mcuCount :: Natural
$sel:workerCount:ProvisionedCapacity' :: ProvisionedCapacity -> Natural
$sel:mcuCount:ProvisionedCapacity' :: ProvisionedCapacity -> Natural
..} =
    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
workerCount

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ 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
"workerCount" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
workerCount)
          ]
      )