{-# 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.CapacityDescription
-- 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.CapacityDescription 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.AutoScalingDescription
import Amazonka.KafkaConnect.Types.ProvisionedCapacityDescription
import qualified Amazonka.Prelude as Prelude

-- | A description of the connector\'s capacity.
--
-- /See:/ 'newCapacityDescription' smart constructor.
data CapacityDescription = CapacityDescription'
  { -- | Describes the connector\'s auto scaling capacity.
    CapacityDescription -> Maybe AutoScalingDescription
autoScaling :: Prelude.Maybe AutoScalingDescription,
    -- | Describes a connector\'s provisioned capacity.
    CapacityDescription -> Maybe ProvisionedCapacityDescription
provisionedCapacity :: Prelude.Maybe ProvisionedCapacityDescription
  }
  deriving (CapacityDescription -> CapacityDescription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CapacityDescription -> CapacityDescription -> Bool
$c/= :: CapacityDescription -> CapacityDescription -> Bool
== :: CapacityDescription -> CapacityDescription -> Bool
$c== :: CapacityDescription -> CapacityDescription -> Bool
Prelude.Eq, ReadPrec [CapacityDescription]
ReadPrec CapacityDescription
Int -> ReadS CapacityDescription
ReadS [CapacityDescription]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CapacityDescription]
$creadListPrec :: ReadPrec [CapacityDescription]
readPrec :: ReadPrec CapacityDescription
$creadPrec :: ReadPrec CapacityDescription
readList :: ReadS [CapacityDescription]
$creadList :: ReadS [CapacityDescription]
readsPrec :: Int -> ReadS CapacityDescription
$creadsPrec :: Int -> ReadS CapacityDescription
Prelude.Read, Int -> CapacityDescription -> ShowS
[CapacityDescription] -> ShowS
CapacityDescription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CapacityDescription] -> ShowS
$cshowList :: [CapacityDescription] -> ShowS
show :: CapacityDescription -> String
$cshow :: CapacityDescription -> String
showsPrec :: Int -> CapacityDescription -> ShowS
$cshowsPrec :: Int -> CapacityDescription -> ShowS
Prelude.Show, forall x. Rep CapacityDescription x -> CapacityDescription
forall x. CapacityDescription -> Rep CapacityDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CapacityDescription x -> CapacityDescription
$cfrom :: forall x. CapacityDescription -> Rep CapacityDescription x
Prelude.Generic)

-- |
-- Create a value of 'CapacityDescription' 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', 'capacityDescription_autoScaling' - Describes the connector\'s auto scaling capacity.
--
-- 'provisionedCapacity', 'capacityDescription_provisionedCapacity' - Describes a connector\'s provisioned capacity.
newCapacityDescription ::
  CapacityDescription
newCapacityDescription :: CapacityDescription
newCapacityDescription =
  CapacityDescription'
    { $sel:autoScaling:CapacityDescription' :: Maybe AutoScalingDescription
autoScaling = forall a. Maybe a
Prelude.Nothing,
      $sel:provisionedCapacity:CapacityDescription' :: Maybe ProvisionedCapacityDescription
provisionedCapacity = forall a. Maybe a
Prelude.Nothing
    }

-- | Describes the connector\'s auto scaling capacity.
capacityDescription_autoScaling :: Lens.Lens' CapacityDescription (Prelude.Maybe AutoScalingDescription)
capacityDescription_autoScaling :: Lens' CapacityDescription (Maybe AutoScalingDescription)
capacityDescription_autoScaling = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CapacityDescription' {Maybe AutoScalingDescription
autoScaling :: Maybe AutoScalingDescription
$sel:autoScaling:CapacityDescription' :: CapacityDescription -> Maybe AutoScalingDescription
autoScaling} -> Maybe AutoScalingDescription
autoScaling) (\s :: CapacityDescription
s@CapacityDescription' {} Maybe AutoScalingDescription
a -> CapacityDescription
s {$sel:autoScaling:CapacityDescription' :: Maybe AutoScalingDescription
autoScaling = Maybe AutoScalingDescription
a} :: CapacityDescription)

-- | Describes a connector\'s provisioned capacity.
capacityDescription_provisionedCapacity :: Lens.Lens' CapacityDescription (Prelude.Maybe ProvisionedCapacityDescription)
capacityDescription_provisionedCapacity :: Lens' CapacityDescription (Maybe ProvisionedCapacityDescription)
capacityDescription_provisionedCapacity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CapacityDescription' {Maybe ProvisionedCapacityDescription
provisionedCapacity :: Maybe ProvisionedCapacityDescription
$sel:provisionedCapacity:CapacityDescription' :: CapacityDescription -> Maybe ProvisionedCapacityDescription
provisionedCapacity} -> Maybe ProvisionedCapacityDescription
provisionedCapacity) (\s :: CapacityDescription
s@CapacityDescription' {} Maybe ProvisionedCapacityDescription
a -> CapacityDescription
s {$sel:provisionedCapacity:CapacityDescription' :: Maybe ProvisionedCapacityDescription
provisionedCapacity = Maybe ProvisionedCapacityDescription
a} :: CapacityDescription)

instance Data.FromJSON CapacityDescription where
  parseJSON :: Value -> Parser CapacityDescription
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CapacityDescription"
      ( \Object
x ->
          Maybe AutoScalingDescription
-> Maybe ProvisionedCapacityDescription -> CapacityDescription
CapacityDescription'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"autoScaling")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"provisionedCapacity")
      )

instance Prelude.Hashable CapacityDescription where
  hashWithSalt :: Int -> CapacityDescription -> Int
hashWithSalt Int
_salt CapacityDescription' {Maybe ProvisionedCapacityDescription
Maybe AutoScalingDescription
provisionedCapacity :: Maybe ProvisionedCapacityDescription
autoScaling :: Maybe AutoScalingDescription
$sel:provisionedCapacity:CapacityDescription' :: CapacityDescription -> Maybe ProvisionedCapacityDescription
$sel:autoScaling:CapacityDescription' :: CapacityDescription -> Maybe AutoScalingDescription
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AutoScalingDescription
autoScaling
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProvisionedCapacityDescription
provisionedCapacity

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