{-# 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.KinesisAnalyticsV2.Types.ParallelismConfigurationDescription
-- 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.KinesisAnalyticsV2.Types.ParallelismConfigurationDescription where

import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalyticsV2.Types.ConfigurationType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes parameters for how a Flink-based Kinesis Data Analytics
-- application executes multiple tasks simultaneously.
--
-- /See:/ 'newParallelismConfigurationDescription' smart constructor.
data ParallelismConfigurationDescription = ParallelismConfigurationDescription'
  { -- | Describes whether the Kinesis Data Analytics service can increase the
    -- parallelism of the application in response to increased throughput.
    ParallelismConfigurationDescription -> Maybe Bool
autoScalingEnabled :: Prelude.Maybe Prelude.Bool,
    -- | Describes the current number of parallel tasks that a Flink-based
    -- Kinesis Data Analytics application can perform. If @AutoScalingEnabled@
    -- is set to True, Kinesis Data Analytics can increase this value in
    -- response to application load. The service can increase this value up to
    -- the maximum parallelism, which is @ParalellismPerKPU@ times the maximum
    -- KPUs for the application. The maximum KPUs for an application is 32 by
    -- default, and can be increased by requesting a limit increase. If
    -- application load is reduced, the service can reduce the
    -- @CurrentParallelism@ value down to the @Parallelism@ setting.
    ParallelismConfigurationDescription -> Maybe Natural
currentParallelism :: Prelude.Maybe Prelude.Natural,
    -- | Describes the number of parallel tasks that a Flink-based Kinesis Data
    -- Analytics application can perform per Kinesis Processing Unit (KPU) used
    -- by the application.
    ParallelismConfigurationDescription -> Maybe Natural
parallelismPerKPU :: Prelude.Maybe Prelude.Natural,
    -- | Describes whether the application uses the default parallelism for the
    -- Kinesis Data Analytics service.
    ParallelismConfigurationDescription -> Maybe ConfigurationType
configurationType :: Prelude.Maybe ConfigurationType,
    -- | Describes the initial number of parallel tasks that a Flink-based
    -- Kinesis Data Analytics application can perform. If @AutoScalingEnabled@
    -- is set to True, then Kinesis Data Analytics can increase the
    -- @CurrentParallelism@ value in response to application load. The service
    -- can increase @CurrentParallelism@ up to the maximum parallelism, which
    -- is @ParalellismPerKPU@ times the maximum KPUs for the application. The
    -- maximum KPUs for an application is 32 by default, and can be increased
    -- by requesting a limit increase. If application load is reduced, the
    -- service can reduce the @CurrentParallelism@ value down to the
    -- @Parallelism@ setting.
    ParallelismConfigurationDescription -> Maybe Natural
parallelism :: Prelude.Maybe Prelude.Natural
  }
  deriving (ParallelismConfigurationDescription
-> ParallelismConfigurationDescription -> Bool
(ParallelismConfigurationDescription
 -> ParallelismConfigurationDescription -> Bool)
-> (ParallelismConfigurationDescription
    -> ParallelismConfigurationDescription -> Bool)
-> Eq ParallelismConfigurationDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParallelismConfigurationDescription
-> ParallelismConfigurationDescription -> Bool
$c/= :: ParallelismConfigurationDescription
-> ParallelismConfigurationDescription -> Bool
== :: ParallelismConfigurationDescription
-> ParallelismConfigurationDescription -> Bool
$c== :: ParallelismConfigurationDescription
-> ParallelismConfigurationDescription -> Bool
Prelude.Eq, ReadPrec [ParallelismConfigurationDescription]
ReadPrec ParallelismConfigurationDescription
Int -> ReadS ParallelismConfigurationDescription
ReadS [ParallelismConfigurationDescription]
(Int -> ReadS ParallelismConfigurationDescription)
-> ReadS [ParallelismConfigurationDescription]
-> ReadPrec ParallelismConfigurationDescription
-> ReadPrec [ParallelismConfigurationDescription]
-> Read ParallelismConfigurationDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ParallelismConfigurationDescription]
$creadListPrec :: ReadPrec [ParallelismConfigurationDescription]
readPrec :: ReadPrec ParallelismConfigurationDescription
$creadPrec :: ReadPrec ParallelismConfigurationDescription
readList :: ReadS [ParallelismConfigurationDescription]
$creadList :: ReadS [ParallelismConfigurationDescription]
readsPrec :: Int -> ReadS ParallelismConfigurationDescription
$creadsPrec :: Int -> ReadS ParallelismConfigurationDescription
Prelude.Read, Int -> ParallelismConfigurationDescription -> ShowS
[ParallelismConfigurationDescription] -> ShowS
ParallelismConfigurationDescription -> String
(Int -> ParallelismConfigurationDescription -> ShowS)
-> (ParallelismConfigurationDescription -> String)
-> ([ParallelismConfigurationDescription] -> ShowS)
-> Show ParallelismConfigurationDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParallelismConfigurationDescription] -> ShowS
$cshowList :: [ParallelismConfigurationDescription] -> ShowS
show :: ParallelismConfigurationDescription -> String
$cshow :: ParallelismConfigurationDescription -> String
showsPrec :: Int -> ParallelismConfigurationDescription -> ShowS
$cshowsPrec :: Int -> ParallelismConfigurationDescription -> ShowS
Prelude.Show, (forall x.
 ParallelismConfigurationDescription
 -> Rep ParallelismConfigurationDescription x)
-> (forall x.
    Rep ParallelismConfigurationDescription x
    -> ParallelismConfigurationDescription)
-> Generic ParallelismConfigurationDescription
forall x.
Rep ParallelismConfigurationDescription x
-> ParallelismConfigurationDescription
forall x.
ParallelismConfigurationDescription
-> Rep ParallelismConfigurationDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ParallelismConfigurationDescription x
-> ParallelismConfigurationDescription
$cfrom :: forall x.
ParallelismConfigurationDescription
-> Rep ParallelismConfigurationDescription x
Prelude.Generic)

-- |
-- Create a value of 'ParallelismConfigurationDescription' 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:
--
-- 'autoScalingEnabled', 'parallelismConfigurationDescription_autoScalingEnabled' - Describes whether the Kinesis Data Analytics service can increase the
-- parallelism of the application in response to increased throughput.
--
-- 'currentParallelism', 'parallelismConfigurationDescription_currentParallelism' - Describes the current number of parallel tasks that a Flink-based
-- Kinesis Data Analytics application can perform. If @AutoScalingEnabled@
-- is set to True, Kinesis Data Analytics can increase this value in
-- response to application load. The service can increase this value up to
-- the maximum parallelism, which is @ParalellismPerKPU@ times the maximum
-- KPUs for the application. The maximum KPUs for an application is 32 by
-- default, and can be increased by requesting a limit increase. If
-- application load is reduced, the service can reduce the
-- @CurrentParallelism@ value down to the @Parallelism@ setting.
--
-- 'parallelismPerKPU', 'parallelismConfigurationDescription_parallelismPerKPU' - Describes the number of parallel tasks that a Flink-based Kinesis Data
-- Analytics application can perform per Kinesis Processing Unit (KPU) used
-- by the application.
--
-- 'configurationType', 'parallelismConfigurationDescription_configurationType' - Describes whether the application uses the default parallelism for the
-- Kinesis Data Analytics service.
--
-- 'parallelism', 'parallelismConfigurationDescription_parallelism' - Describes the initial number of parallel tasks that a Flink-based
-- Kinesis Data Analytics application can perform. If @AutoScalingEnabled@
-- is set to True, then Kinesis Data Analytics can increase the
-- @CurrentParallelism@ value in response to application load. The service
-- can increase @CurrentParallelism@ up to the maximum parallelism, which
-- is @ParalellismPerKPU@ times the maximum KPUs for the application. The
-- maximum KPUs for an application is 32 by default, and can be increased
-- by requesting a limit increase. If application load is reduced, the
-- service can reduce the @CurrentParallelism@ value down to the
-- @Parallelism@ setting.
newParallelismConfigurationDescription ::
  ParallelismConfigurationDescription
newParallelismConfigurationDescription :: ParallelismConfigurationDescription
newParallelismConfigurationDescription =
  ParallelismConfigurationDescription' :: Maybe Bool
-> Maybe Natural
-> Maybe Natural
-> Maybe ConfigurationType
-> Maybe Natural
-> ParallelismConfigurationDescription
ParallelismConfigurationDescription'
    { $sel:autoScalingEnabled:ParallelismConfigurationDescription' :: Maybe Bool
autoScalingEnabled =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:currentParallelism:ParallelismConfigurationDescription' :: Maybe Natural
currentParallelism = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:parallelismPerKPU:ParallelismConfigurationDescription' :: Maybe Natural
parallelismPerKPU = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:configurationType:ParallelismConfigurationDescription' :: Maybe ConfigurationType
configurationType = Maybe ConfigurationType
forall a. Maybe a
Prelude.Nothing,
      $sel:parallelism:ParallelismConfigurationDescription' :: Maybe Natural
parallelism = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Describes whether the Kinesis Data Analytics service can increase the
-- parallelism of the application in response to increased throughput.
parallelismConfigurationDescription_autoScalingEnabled :: Lens.Lens' ParallelismConfigurationDescription (Prelude.Maybe Prelude.Bool)
parallelismConfigurationDescription_autoScalingEnabled :: (Maybe Bool -> f (Maybe Bool))
-> ParallelismConfigurationDescription
-> f ParallelismConfigurationDescription
parallelismConfigurationDescription_autoScalingEnabled = (ParallelismConfigurationDescription -> Maybe Bool)
-> (ParallelismConfigurationDescription
    -> Maybe Bool -> ParallelismConfigurationDescription)
-> Lens
     ParallelismConfigurationDescription
     ParallelismConfigurationDescription
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParallelismConfigurationDescription' {Maybe Bool
autoScalingEnabled :: Maybe Bool
$sel:autoScalingEnabled:ParallelismConfigurationDescription' :: ParallelismConfigurationDescription -> Maybe Bool
autoScalingEnabled} -> Maybe Bool
autoScalingEnabled) (\s :: ParallelismConfigurationDescription
s@ParallelismConfigurationDescription' {} Maybe Bool
a -> ParallelismConfigurationDescription
s {$sel:autoScalingEnabled:ParallelismConfigurationDescription' :: Maybe Bool
autoScalingEnabled = Maybe Bool
a} :: ParallelismConfigurationDescription)

-- | Describes the current number of parallel tasks that a Flink-based
-- Kinesis Data Analytics application can perform. If @AutoScalingEnabled@
-- is set to True, Kinesis Data Analytics can increase this value in
-- response to application load. The service can increase this value up to
-- the maximum parallelism, which is @ParalellismPerKPU@ times the maximum
-- KPUs for the application. The maximum KPUs for an application is 32 by
-- default, and can be increased by requesting a limit increase. If
-- application load is reduced, the service can reduce the
-- @CurrentParallelism@ value down to the @Parallelism@ setting.
parallelismConfigurationDescription_currentParallelism :: Lens.Lens' ParallelismConfigurationDescription (Prelude.Maybe Prelude.Natural)
parallelismConfigurationDescription_currentParallelism :: (Maybe Natural -> f (Maybe Natural))
-> ParallelismConfigurationDescription
-> f ParallelismConfigurationDescription
parallelismConfigurationDescription_currentParallelism = (ParallelismConfigurationDescription -> Maybe Natural)
-> (ParallelismConfigurationDescription
    -> Maybe Natural -> ParallelismConfigurationDescription)
-> Lens
     ParallelismConfigurationDescription
     ParallelismConfigurationDescription
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParallelismConfigurationDescription' {Maybe Natural
currentParallelism :: Maybe Natural
$sel:currentParallelism:ParallelismConfigurationDescription' :: ParallelismConfigurationDescription -> Maybe Natural
currentParallelism} -> Maybe Natural
currentParallelism) (\s :: ParallelismConfigurationDescription
s@ParallelismConfigurationDescription' {} Maybe Natural
a -> ParallelismConfigurationDescription
s {$sel:currentParallelism:ParallelismConfigurationDescription' :: Maybe Natural
currentParallelism = Maybe Natural
a} :: ParallelismConfigurationDescription)

-- | Describes the number of parallel tasks that a Flink-based Kinesis Data
-- Analytics application can perform per Kinesis Processing Unit (KPU) used
-- by the application.
parallelismConfigurationDescription_parallelismPerKPU :: Lens.Lens' ParallelismConfigurationDescription (Prelude.Maybe Prelude.Natural)
parallelismConfigurationDescription_parallelismPerKPU :: (Maybe Natural -> f (Maybe Natural))
-> ParallelismConfigurationDescription
-> f ParallelismConfigurationDescription
parallelismConfigurationDescription_parallelismPerKPU = (ParallelismConfigurationDescription -> Maybe Natural)
-> (ParallelismConfigurationDescription
    -> Maybe Natural -> ParallelismConfigurationDescription)
-> Lens
     ParallelismConfigurationDescription
     ParallelismConfigurationDescription
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParallelismConfigurationDescription' {Maybe Natural
parallelismPerKPU :: Maybe Natural
$sel:parallelismPerKPU:ParallelismConfigurationDescription' :: ParallelismConfigurationDescription -> Maybe Natural
parallelismPerKPU} -> Maybe Natural
parallelismPerKPU) (\s :: ParallelismConfigurationDescription
s@ParallelismConfigurationDescription' {} Maybe Natural
a -> ParallelismConfigurationDescription
s {$sel:parallelismPerKPU:ParallelismConfigurationDescription' :: Maybe Natural
parallelismPerKPU = Maybe Natural
a} :: ParallelismConfigurationDescription)

-- | Describes whether the application uses the default parallelism for the
-- Kinesis Data Analytics service.
parallelismConfigurationDescription_configurationType :: Lens.Lens' ParallelismConfigurationDescription (Prelude.Maybe ConfigurationType)
parallelismConfigurationDescription_configurationType :: (Maybe ConfigurationType -> f (Maybe ConfigurationType))
-> ParallelismConfigurationDescription
-> f ParallelismConfigurationDescription
parallelismConfigurationDescription_configurationType = (ParallelismConfigurationDescription -> Maybe ConfigurationType)
-> (ParallelismConfigurationDescription
    -> Maybe ConfigurationType -> ParallelismConfigurationDescription)
-> Lens
     ParallelismConfigurationDescription
     ParallelismConfigurationDescription
     (Maybe ConfigurationType)
     (Maybe ConfigurationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParallelismConfigurationDescription' {Maybe ConfigurationType
configurationType :: Maybe ConfigurationType
$sel:configurationType:ParallelismConfigurationDescription' :: ParallelismConfigurationDescription -> Maybe ConfigurationType
configurationType} -> Maybe ConfigurationType
configurationType) (\s :: ParallelismConfigurationDescription
s@ParallelismConfigurationDescription' {} Maybe ConfigurationType
a -> ParallelismConfigurationDescription
s {$sel:configurationType:ParallelismConfigurationDescription' :: Maybe ConfigurationType
configurationType = Maybe ConfigurationType
a} :: ParallelismConfigurationDescription)

-- | Describes the initial number of parallel tasks that a Flink-based
-- Kinesis Data Analytics application can perform. If @AutoScalingEnabled@
-- is set to True, then Kinesis Data Analytics can increase the
-- @CurrentParallelism@ value in response to application load. The service
-- can increase @CurrentParallelism@ up to the maximum parallelism, which
-- is @ParalellismPerKPU@ times the maximum KPUs for the application. The
-- maximum KPUs for an application is 32 by default, and can be increased
-- by requesting a limit increase. If application load is reduced, the
-- service can reduce the @CurrentParallelism@ value down to the
-- @Parallelism@ setting.
parallelismConfigurationDescription_parallelism :: Lens.Lens' ParallelismConfigurationDescription (Prelude.Maybe Prelude.Natural)
parallelismConfigurationDescription_parallelism :: (Maybe Natural -> f (Maybe Natural))
-> ParallelismConfigurationDescription
-> f ParallelismConfigurationDescription
parallelismConfigurationDescription_parallelism = (ParallelismConfigurationDescription -> Maybe Natural)
-> (ParallelismConfigurationDescription
    -> Maybe Natural -> ParallelismConfigurationDescription)
-> Lens
     ParallelismConfigurationDescription
     ParallelismConfigurationDescription
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParallelismConfigurationDescription' {Maybe Natural
parallelism :: Maybe Natural
$sel:parallelism:ParallelismConfigurationDescription' :: ParallelismConfigurationDescription -> Maybe Natural
parallelism} -> Maybe Natural
parallelism) (\s :: ParallelismConfigurationDescription
s@ParallelismConfigurationDescription' {} Maybe Natural
a -> ParallelismConfigurationDescription
s {$sel:parallelism:ParallelismConfigurationDescription' :: Maybe Natural
parallelism = Maybe Natural
a} :: ParallelismConfigurationDescription)

instance
  Core.FromJSON
    ParallelismConfigurationDescription
  where
  parseJSON :: Value -> Parser ParallelismConfigurationDescription
parseJSON =
    String
-> (Object -> Parser ParallelismConfigurationDescription)
-> Value
-> Parser ParallelismConfigurationDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ParallelismConfigurationDescription"
      ( \Object
x ->
          Maybe Bool
-> Maybe Natural
-> Maybe Natural
-> Maybe ConfigurationType
-> Maybe Natural
-> ParallelismConfigurationDescription
ParallelismConfigurationDescription'
            (Maybe Bool
 -> Maybe Natural
 -> Maybe Natural
 -> Maybe ConfigurationType
 -> Maybe Natural
 -> ParallelismConfigurationDescription)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Natural
      -> Maybe Natural
      -> Maybe ConfigurationType
      -> Maybe Natural
      -> ParallelismConfigurationDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AutoScalingEnabled")
            Parser
  (Maybe Natural
   -> Maybe Natural
   -> Maybe ConfigurationType
   -> Maybe Natural
   -> ParallelismConfigurationDescription)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Natural
      -> Maybe ConfigurationType
      -> Maybe Natural
      -> ParallelismConfigurationDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CurrentParallelism")
            Parser
  (Maybe Natural
   -> Maybe ConfigurationType
   -> Maybe Natural
   -> ParallelismConfigurationDescription)
-> Parser (Maybe Natural)
-> Parser
     (Maybe ConfigurationType
      -> Maybe Natural -> ParallelismConfigurationDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ParallelismPerKPU")
            Parser
  (Maybe ConfigurationType
   -> Maybe Natural -> ParallelismConfigurationDescription)
-> Parser (Maybe ConfigurationType)
-> Parser (Maybe Natural -> ParallelismConfigurationDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ConfigurationType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ConfigurationType")
            Parser (Maybe Natural -> ParallelismConfigurationDescription)
-> Parser (Maybe Natural)
-> Parser ParallelismConfigurationDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Parallelism")
      )

instance
  Prelude.Hashable
    ParallelismConfigurationDescription

instance
  Prelude.NFData
    ParallelismConfigurationDescription