{-# 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.Capacity
-- 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.Capacity 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.AutoScaling
import Amazonka.KafkaConnect.Types.ProvisionedCapacity
import qualified Amazonka.Prelude as Prelude

-- | Information about the capacity of the connector, whether it is auto
-- scaled or provisioned.
--
-- /See:/ 'newCapacity' smart constructor.
data Capacity = Capacity'
  { -- | Information about the auto scaling parameters for the connector.
    Capacity -> Maybe AutoScaling
autoScaling :: Prelude.Maybe AutoScaling,
    -- | Details about a fixed capacity allocated to a connector.
    Capacity -> Maybe ProvisionedCapacity
provisionedCapacity :: Prelude.Maybe ProvisionedCapacity
  }
  deriving (Capacity -> Capacity -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Capacity -> Capacity -> Bool
$c/= :: Capacity -> Capacity -> Bool
== :: Capacity -> Capacity -> Bool
$c== :: Capacity -> Capacity -> Bool
Prelude.Eq, ReadPrec [Capacity]
ReadPrec Capacity
Int -> ReadS Capacity
ReadS [Capacity]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Capacity]
$creadListPrec :: ReadPrec [Capacity]
readPrec :: ReadPrec Capacity
$creadPrec :: ReadPrec Capacity
readList :: ReadS [Capacity]
$creadList :: ReadS [Capacity]
readsPrec :: Int -> ReadS Capacity
$creadsPrec :: Int -> ReadS Capacity
Prelude.Read, Int -> Capacity -> ShowS
[Capacity] -> ShowS
Capacity -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Capacity] -> ShowS
$cshowList :: [Capacity] -> ShowS
show :: Capacity -> String
$cshow :: Capacity -> String
showsPrec :: Int -> Capacity -> ShowS
$cshowsPrec :: Int -> Capacity -> ShowS
Prelude.Show, forall x. Rep Capacity x -> Capacity
forall x. Capacity -> Rep Capacity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Capacity x -> Capacity
$cfrom :: forall x. Capacity -> Rep Capacity x
Prelude.Generic)

-- |
-- Create a value of 'Capacity' 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:
--
-- 'autoScaling', 'capacity_autoScaling' - Information about the auto scaling parameters for the connector.
--
-- 'provisionedCapacity', 'capacity_provisionedCapacity' - Details about a fixed capacity allocated to a connector.
newCapacity ::
  Capacity
newCapacity :: Capacity
newCapacity =
  Capacity'
    { $sel:autoScaling:Capacity' :: Maybe AutoScaling
autoScaling = forall a. Maybe a
Prelude.Nothing,
      $sel:provisionedCapacity:Capacity' :: Maybe ProvisionedCapacity
provisionedCapacity = forall a. Maybe a
Prelude.Nothing
    }

-- | Information about the auto scaling parameters for the connector.
capacity_autoScaling :: Lens.Lens' Capacity (Prelude.Maybe AutoScaling)
capacity_autoScaling :: Lens' Capacity (Maybe AutoScaling)
capacity_autoScaling = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Capacity' {Maybe AutoScaling
autoScaling :: Maybe AutoScaling
$sel:autoScaling:Capacity' :: Capacity -> Maybe AutoScaling
autoScaling} -> Maybe AutoScaling
autoScaling) (\s :: Capacity
s@Capacity' {} Maybe AutoScaling
a -> Capacity
s {$sel:autoScaling:Capacity' :: Maybe AutoScaling
autoScaling = Maybe AutoScaling
a} :: Capacity)

-- | Details about a fixed capacity allocated to a connector.
capacity_provisionedCapacity :: Lens.Lens' Capacity (Prelude.Maybe ProvisionedCapacity)
capacity_provisionedCapacity :: Lens' Capacity (Maybe ProvisionedCapacity)
capacity_provisionedCapacity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Capacity' {Maybe ProvisionedCapacity
provisionedCapacity :: Maybe ProvisionedCapacity
$sel:provisionedCapacity:Capacity' :: Capacity -> Maybe ProvisionedCapacity
provisionedCapacity} -> Maybe ProvisionedCapacity
provisionedCapacity) (\s :: Capacity
s@Capacity' {} Maybe ProvisionedCapacity
a -> Capacity
s {$sel:provisionedCapacity:Capacity' :: Maybe ProvisionedCapacity
provisionedCapacity = Maybe ProvisionedCapacity
a} :: Capacity)

instance Prelude.Hashable Capacity where
  hashWithSalt :: Int -> Capacity -> Int
hashWithSalt Int
_salt Capacity' {Maybe ProvisionedCapacity
Maybe AutoScaling
provisionedCapacity :: Maybe ProvisionedCapacity
autoScaling :: Maybe AutoScaling
$sel:provisionedCapacity:Capacity' :: Capacity -> Maybe ProvisionedCapacity
$sel:autoScaling:Capacity' :: Capacity -> Maybe AutoScaling
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AutoScaling
autoScaling
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProvisionedCapacity
provisionedCapacity

instance Prelude.NFData Capacity where
  rnf :: Capacity -> ()
rnf Capacity' {Maybe ProvisionedCapacity
Maybe AutoScaling
provisionedCapacity :: Maybe ProvisionedCapacity
autoScaling :: Maybe AutoScaling
$sel:provisionedCapacity:Capacity' :: Capacity -> Maybe ProvisionedCapacity
$sel:autoScaling:Capacity' :: Capacity -> Maybe AutoScaling
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AutoScaling
autoScaling
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ProvisionedCapacity
provisionedCapacity

instance Data.ToJSON Capacity where
  toJSON :: Capacity -> Value
toJSON Capacity' {Maybe ProvisionedCapacity
Maybe AutoScaling
provisionedCapacity :: Maybe ProvisionedCapacity
autoScaling :: Maybe AutoScaling
$sel:provisionedCapacity:Capacity' :: Capacity -> Maybe ProvisionedCapacity
$sel:autoScaling:Capacity' :: Capacity -> Maybe AutoScaling
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"autoScaling" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AutoScaling
autoScaling,
            (Key
"provisionedCapacity" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ProvisionedCapacity
provisionedCapacity
          ]
      )