{-# 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.ParallelismConfigurationUpdate
-- 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.ParallelismConfigurationUpdate 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 updates to parameters for how an application executes multiple
-- tasks simultaneously.
--
-- /See:/ 'newParallelismConfigurationUpdate' smart constructor.
data ParallelismConfigurationUpdate = ParallelismConfigurationUpdate'
  { -- | Describes updates to the initial number of parallel tasks an 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 will reduce
    -- @CurrentParallelism@ down to the @Parallelism@ setting.
    ParallelismConfigurationUpdate -> Maybe Natural
parallelismUpdate :: Prelude.Maybe Prelude.Natural,
    -- | Describes updates to whether the Kinesis Data Analytics service can
    -- increase the parallelism of a Flink-based Kinesis Data Analytics
    -- application in response to increased throughput.
    ParallelismConfigurationUpdate -> Maybe Bool
autoScalingEnabledUpdate :: Prelude.Maybe Prelude.Bool,
    -- | Describes updates to the number of parallel tasks an application can
    -- perform per Kinesis Processing Unit (KPU) used by the application.
    ParallelismConfigurationUpdate -> Maybe Natural
parallelismPerKPUUpdate :: Prelude.Maybe Prelude.Natural,
    -- | Describes updates to whether the application uses the default
    -- parallelism for the Kinesis Data Analytics service, or if a custom
    -- parallelism is used. You must set this property to @CUSTOM@ in order to
    -- change your application\'s @AutoScalingEnabled@, @Parallelism@, or
    -- @ParallelismPerKPU@ properties.
    ParallelismConfigurationUpdate -> Maybe ConfigurationType
configurationTypeUpdate :: Prelude.Maybe ConfigurationType
  }
  deriving (ParallelismConfigurationUpdate
-> ParallelismConfigurationUpdate -> Bool
(ParallelismConfigurationUpdate
 -> ParallelismConfigurationUpdate -> Bool)
-> (ParallelismConfigurationUpdate
    -> ParallelismConfigurationUpdate -> Bool)
-> Eq ParallelismConfigurationUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParallelismConfigurationUpdate
-> ParallelismConfigurationUpdate -> Bool
$c/= :: ParallelismConfigurationUpdate
-> ParallelismConfigurationUpdate -> Bool
== :: ParallelismConfigurationUpdate
-> ParallelismConfigurationUpdate -> Bool
$c== :: ParallelismConfigurationUpdate
-> ParallelismConfigurationUpdate -> Bool
Prelude.Eq, ReadPrec [ParallelismConfigurationUpdate]
ReadPrec ParallelismConfigurationUpdate
Int -> ReadS ParallelismConfigurationUpdate
ReadS [ParallelismConfigurationUpdate]
(Int -> ReadS ParallelismConfigurationUpdate)
-> ReadS [ParallelismConfigurationUpdate]
-> ReadPrec ParallelismConfigurationUpdate
-> ReadPrec [ParallelismConfigurationUpdate]
-> Read ParallelismConfigurationUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ParallelismConfigurationUpdate]
$creadListPrec :: ReadPrec [ParallelismConfigurationUpdate]
readPrec :: ReadPrec ParallelismConfigurationUpdate
$creadPrec :: ReadPrec ParallelismConfigurationUpdate
readList :: ReadS [ParallelismConfigurationUpdate]
$creadList :: ReadS [ParallelismConfigurationUpdate]
readsPrec :: Int -> ReadS ParallelismConfigurationUpdate
$creadsPrec :: Int -> ReadS ParallelismConfigurationUpdate
Prelude.Read, Int -> ParallelismConfigurationUpdate -> ShowS
[ParallelismConfigurationUpdate] -> ShowS
ParallelismConfigurationUpdate -> String
(Int -> ParallelismConfigurationUpdate -> ShowS)
-> (ParallelismConfigurationUpdate -> String)
-> ([ParallelismConfigurationUpdate] -> ShowS)
-> Show ParallelismConfigurationUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParallelismConfigurationUpdate] -> ShowS
$cshowList :: [ParallelismConfigurationUpdate] -> ShowS
show :: ParallelismConfigurationUpdate -> String
$cshow :: ParallelismConfigurationUpdate -> String
showsPrec :: Int -> ParallelismConfigurationUpdate -> ShowS
$cshowsPrec :: Int -> ParallelismConfigurationUpdate -> ShowS
Prelude.Show, (forall x.
 ParallelismConfigurationUpdate
 -> Rep ParallelismConfigurationUpdate x)
-> (forall x.
    Rep ParallelismConfigurationUpdate x
    -> ParallelismConfigurationUpdate)
-> Generic ParallelismConfigurationUpdate
forall x.
Rep ParallelismConfigurationUpdate x
-> ParallelismConfigurationUpdate
forall x.
ParallelismConfigurationUpdate
-> Rep ParallelismConfigurationUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ParallelismConfigurationUpdate x
-> ParallelismConfigurationUpdate
$cfrom :: forall x.
ParallelismConfigurationUpdate
-> Rep ParallelismConfigurationUpdate x
Prelude.Generic)

-- |
-- Create a value of 'ParallelismConfigurationUpdate' 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:
--
-- 'parallelismUpdate', 'parallelismConfigurationUpdate_parallelismUpdate' - Describes updates to the initial number of parallel tasks an 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 will reduce
-- @CurrentParallelism@ down to the @Parallelism@ setting.
--
-- 'autoScalingEnabledUpdate', 'parallelismConfigurationUpdate_autoScalingEnabledUpdate' - Describes updates to whether the Kinesis Data Analytics service can
-- increase the parallelism of a Flink-based Kinesis Data Analytics
-- application in response to increased throughput.
--
-- 'parallelismPerKPUUpdate', 'parallelismConfigurationUpdate_parallelismPerKPUUpdate' - Describes updates to the number of parallel tasks an application can
-- perform per Kinesis Processing Unit (KPU) used by the application.
--
-- 'configurationTypeUpdate', 'parallelismConfigurationUpdate_configurationTypeUpdate' - Describes updates to whether the application uses the default
-- parallelism for the Kinesis Data Analytics service, or if a custom
-- parallelism is used. You must set this property to @CUSTOM@ in order to
-- change your application\'s @AutoScalingEnabled@, @Parallelism@, or
-- @ParallelismPerKPU@ properties.
newParallelismConfigurationUpdate ::
  ParallelismConfigurationUpdate
newParallelismConfigurationUpdate :: ParallelismConfigurationUpdate
newParallelismConfigurationUpdate =
  ParallelismConfigurationUpdate' :: Maybe Natural
-> Maybe Bool
-> Maybe Natural
-> Maybe ConfigurationType
-> ParallelismConfigurationUpdate
ParallelismConfigurationUpdate'
    { $sel:parallelismUpdate:ParallelismConfigurationUpdate' :: Maybe Natural
parallelismUpdate =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:autoScalingEnabledUpdate:ParallelismConfigurationUpdate' :: Maybe Bool
autoScalingEnabledUpdate = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:parallelismPerKPUUpdate:ParallelismConfigurationUpdate' :: Maybe Natural
parallelismPerKPUUpdate = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:configurationTypeUpdate:ParallelismConfigurationUpdate' :: Maybe ConfigurationType
configurationTypeUpdate = Maybe ConfigurationType
forall a. Maybe a
Prelude.Nothing
    }

-- | Describes updates to the initial number of parallel tasks an 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 will reduce
-- @CurrentParallelism@ down to the @Parallelism@ setting.
parallelismConfigurationUpdate_parallelismUpdate :: Lens.Lens' ParallelismConfigurationUpdate (Prelude.Maybe Prelude.Natural)
parallelismConfigurationUpdate_parallelismUpdate :: (Maybe Natural -> f (Maybe Natural))
-> ParallelismConfigurationUpdate
-> f ParallelismConfigurationUpdate
parallelismConfigurationUpdate_parallelismUpdate = (ParallelismConfigurationUpdate -> Maybe Natural)
-> (ParallelismConfigurationUpdate
    -> Maybe Natural -> ParallelismConfigurationUpdate)
-> Lens
     ParallelismConfigurationUpdate
     ParallelismConfigurationUpdate
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParallelismConfigurationUpdate' {Maybe Natural
parallelismUpdate :: Maybe Natural
$sel:parallelismUpdate:ParallelismConfigurationUpdate' :: ParallelismConfigurationUpdate -> Maybe Natural
parallelismUpdate} -> Maybe Natural
parallelismUpdate) (\s :: ParallelismConfigurationUpdate
s@ParallelismConfigurationUpdate' {} Maybe Natural
a -> ParallelismConfigurationUpdate
s {$sel:parallelismUpdate:ParallelismConfigurationUpdate' :: Maybe Natural
parallelismUpdate = Maybe Natural
a} :: ParallelismConfigurationUpdate)

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

-- | Describes updates to the number of parallel tasks an application can
-- perform per Kinesis Processing Unit (KPU) used by the application.
parallelismConfigurationUpdate_parallelismPerKPUUpdate :: Lens.Lens' ParallelismConfigurationUpdate (Prelude.Maybe Prelude.Natural)
parallelismConfigurationUpdate_parallelismPerKPUUpdate :: (Maybe Natural -> f (Maybe Natural))
-> ParallelismConfigurationUpdate
-> f ParallelismConfigurationUpdate
parallelismConfigurationUpdate_parallelismPerKPUUpdate = (ParallelismConfigurationUpdate -> Maybe Natural)
-> (ParallelismConfigurationUpdate
    -> Maybe Natural -> ParallelismConfigurationUpdate)
-> Lens
     ParallelismConfigurationUpdate
     ParallelismConfigurationUpdate
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParallelismConfigurationUpdate' {Maybe Natural
parallelismPerKPUUpdate :: Maybe Natural
$sel:parallelismPerKPUUpdate:ParallelismConfigurationUpdate' :: ParallelismConfigurationUpdate -> Maybe Natural
parallelismPerKPUUpdate} -> Maybe Natural
parallelismPerKPUUpdate) (\s :: ParallelismConfigurationUpdate
s@ParallelismConfigurationUpdate' {} Maybe Natural
a -> ParallelismConfigurationUpdate
s {$sel:parallelismPerKPUUpdate:ParallelismConfigurationUpdate' :: Maybe Natural
parallelismPerKPUUpdate = Maybe Natural
a} :: ParallelismConfigurationUpdate)

-- | Describes updates to whether the application uses the default
-- parallelism for the Kinesis Data Analytics service, or if a custom
-- parallelism is used. You must set this property to @CUSTOM@ in order to
-- change your application\'s @AutoScalingEnabled@, @Parallelism@, or
-- @ParallelismPerKPU@ properties.
parallelismConfigurationUpdate_configurationTypeUpdate :: Lens.Lens' ParallelismConfigurationUpdate (Prelude.Maybe ConfigurationType)
parallelismConfigurationUpdate_configurationTypeUpdate :: (Maybe ConfigurationType -> f (Maybe ConfigurationType))
-> ParallelismConfigurationUpdate
-> f ParallelismConfigurationUpdate
parallelismConfigurationUpdate_configurationTypeUpdate = (ParallelismConfigurationUpdate -> Maybe ConfigurationType)
-> (ParallelismConfigurationUpdate
    -> Maybe ConfigurationType -> ParallelismConfigurationUpdate)
-> Lens
     ParallelismConfigurationUpdate
     ParallelismConfigurationUpdate
     (Maybe ConfigurationType)
     (Maybe ConfigurationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParallelismConfigurationUpdate' {Maybe ConfigurationType
configurationTypeUpdate :: Maybe ConfigurationType
$sel:configurationTypeUpdate:ParallelismConfigurationUpdate' :: ParallelismConfigurationUpdate -> Maybe ConfigurationType
configurationTypeUpdate} -> Maybe ConfigurationType
configurationTypeUpdate) (\s :: ParallelismConfigurationUpdate
s@ParallelismConfigurationUpdate' {} Maybe ConfigurationType
a -> ParallelismConfigurationUpdate
s {$sel:configurationTypeUpdate:ParallelismConfigurationUpdate' :: Maybe ConfigurationType
configurationTypeUpdate = Maybe ConfigurationType
a} :: ParallelismConfigurationUpdate)

instance
  Prelude.Hashable
    ParallelismConfigurationUpdate

instance
  Prelude.NFData
    ParallelismConfigurationUpdate

instance Core.ToJSON ParallelismConfigurationUpdate where
  toJSON :: ParallelismConfigurationUpdate -> Value
toJSON ParallelismConfigurationUpdate' {Maybe Bool
Maybe Natural
Maybe ConfigurationType
configurationTypeUpdate :: Maybe ConfigurationType
parallelismPerKPUUpdate :: Maybe Natural
autoScalingEnabledUpdate :: Maybe Bool
parallelismUpdate :: Maybe Natural
$sel:configurationTypeUpdate:ParallelismConfigurationUpdate' :: ParallelismConfigurationUpdate -> Maybe ConfigurationType
$sel:parallelismPerKPUUpdate:ParallelismConfigurationUpdate' :: ParallelismConfigurationUpdate -> Maybe Natural
$sel:autoScalingEnabledUpdate:ParallelismConfigurationUpdate' :: ParallelismConfigurationUpdate -> Maybe Bool
$sel:parallelismUpdate:ParallelismConfigurationUpdate' :: ParallelismConfigurationUpdate -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ParallelismUpdate" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
parallelismUpdate,
            (Text
"AutoScalingEnabledUpdate" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
autoScalingEnabledUpdate,
            (Text
"ParallelismPerKPUUpdate" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
parallelismPerKPUUpdate,
            (Text
"ConfigurationTypeUpdate" Text -> ConfigurationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ConfigurationType -> Pair)
-> Maybe ConfigurationType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConfigurationType
configurationTypeUpdate
          ]
      )