{-# 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.CheckpointConfigurationUpdate
-- 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.CheckpointConfigurationUpdate 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 the checkpointing parameters for a Flink-based
-- Kinesis Data Analytics application.
--
-- /See:/ 'newCheckpointConfigurationUpdate' smart constructor.
data CheckpointConfigurationUpdate = CheckpointConfigurationUpdate'
  { -- | Describes updates to the interval in milliseconds between checkpoint
    -- operations.
    --
    -- If @CheckpointConfiguration.ConfigurationType@ is @DEFAULT@, the
    -- application will use a @CheckpointInterval@ value of 60000, even if this
    -- value is set to another value using this API or in application code.
    CheckpointConfigurationUpdate -> Maybe Natural
checkpointIntervalUpdate :: Prelude.Maybe Prelude.Natural,
    -- | Describes updates to whether checkpointing is enabled for an
    -- application.
    --
    -- If @CheckpointConfiguration.ConfigurationType@ is @DEFAULT@, the
    -- application will use a @CheckpointingEnabled@ value of @true@, even if
    -- this value is set to another value using this API or in application
    -- code.
    CheckpointConfigurationUpdate -> Maybe Bool
checkpointingEnabledUpdate :: Prelude.Maybe Prelude.Bool,
    -- | Describes updates to the minimum time in milliseconds after a checkpoint
    -- operation completes that a new checkpoint operation can start.
    --
    -- If @CheckpointConfiguration.ConfigurationType@ is @DEFAULT@, the
    -- application will use a @MinPauseBetweenCheckpoints@ value of 5000, even
    -- if this value is set using this API or in application code.
    CheckpointConfigurationUpdate -> Maybe Natural
minPauseBetweenCheckpointsUpdate :: Prelude.Maybe Prelude.Natural,
    -- | Describes updates to whether the application uses the default
    -- checkpointing behavior of Kinesis Data Analytics. You must set this
    -- property to @CUSTOM@ in order to set the @CheckpointingEnabled@,
    -- @CheckpointInterval@, or @MinPauseBetweenCheckpoints@ parameters.
    --
    -- If this value is set to @DEFAULT@, the application will use the
    -- following values, even if they are set to other values using APIs or
    -- application code:
    --
    -- -   __CheckpointingEnabled:__ true
    --
    -- -   __CheckpointInterval:__ 60000
    --
    -- -   __MinPauseBetweenCheckpoints:__ 5000
    CheckpointConfigurationUpdate -> Maybe ConfigurationType
configurationTypeUpdate :: Prelude.Maybe ConfigurationType
  }
  deriving (CheckpointConfigurationUpdate
-> CheckpointConfigurationUpdate -> Bool
(CheckpointConfigurationUpdate
 -> CheckpointConfigurationUpdate -> Bool)
-> (CheckpointConfigurationUpdate
    -> CheckpointConfigurationUpdate -> Bool)
-> Eq CheckpointConfigurationUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CheckpointConfigurationUpdate
-> CheckpointConfigurationUpdate -> Bool
$c/= :: CheckpointConfigurationUpdate
-> CheckpointConfigurationUpdate -> Bool
== :: CheckpointConfigurationUpdate
-> CheckpointConfigurationUpdate -> Bool
$c== :: CheckpointConfigurationUpdate
-> CheckpointConfigurationUpdate -> Bool
Prelude.Eq, ReadPrec [CheckpointConfigurationUpdate]
ReadPrec CheckpointConfigurationUpdate
Int -> ReadS CheckpointConfigurationUpdate
ReadS [CheckpointConfigurationUpdate]
(Int -> ReadS CheckpointConfigurationUpdate)
-> ReadS [CheckpointConfigurationUpdate]
-> ReadPrec CheckpointConfigurationUpdate
-> ReadPrec [CheckpointConfigurationUpdate]
-> Read CheckpointConfigurationUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CheckpointConfigurationUpdate]
$creadListPrec :: ReadPrec [CheckpointConfigurationUpdate]
readPrec :: ReadPrec CheckpointConfigurationUpdate
$creadPrec :: ReadPrec CheckpointConfigurationUpdate
readList :: ReadS [CheckpointConfigurationUpdate]
$creadList :: ReadS [CheckpointConfigurationUpdate]
readsPrec :: Int -> ReadS CheckpointConfigurationUpdate
$creadsPrec :: Int -> ReadS CheckpointConfigurationUpdate
Prelude.Read, Int -> CheckpointConfigurationUpdate -> ShowS
[CheckpointConfigurationUpdate] -> ShowS
CheckpointConfigurationUpdate -> String
(Int -> CheckpointConfigurationUpdate -> ShowS)
-> (CheckpointConfigurationUpdate -> String)
-> ([CheckpointConfigurationUpdate] -> ShowS)
-> Show CheckpointConfigurationUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CheckpointConfigurationUpdate] -> ShowS
$cshowList :: [CheckpointConfigurationUpdate] -> ShowS
show :: CheckpointConfigurationUpdate -> String
$cshow :: CheckpointConfigurationUpdate -> String
showsPrec :: Int -> CheckpointConfigurationUpdate -> ShowS
$cshowsPrec :: Int -> CheckpointConfigurationUpdate -> ShowS
Prelude.Show, (forall x.
 CheckpointConfigurationUpdate
 -> Rep CheckpointConfigurationUpdate x)
-> (forall x.
    Rep CheckpointConfigurationUpdate x
    -> CheckpointConfigurationUpdate)
-> Generic CheckpointConfigurationUpdate
forall x.
Rep CheckpointConfigurationUpdate x
-> CheckpointConfigurationUpdate
forall x.
CheckpointConfigurationUpdate
-> Rep CheckpointConfigurationUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CheckpointConfigurationUpdate x
-> CheckpointConfigurationUpdate
$cfrom :: forall x.
CheckpointConfigurationUpdate
-> Rep CheckpointConfigurationUpdate x
Prelude.Generic)

-- |
-- Create a value of 'CheckpointConfigurationUpdate' 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:
--
-- 'checkpointIntervalUpdate', 'checkpointConfigurationUpdate_checkpointIntervalUpdate' - Describes updates to the interval in milliseconds between checkpoint
-- operations.
--
-- If @CheckpointConfiguration.ConfigurationType@ is @DEFAULT@, the
-- application will use a @CheckpointInterval@ value of 60000, even if this
-- value is set to another value using this API or in application code.
--
-- 'checkpointingEnabledUpdate', 'checkpointConfigurationUpdate_checkpointingEnabledUpdate' - Describes updates to whether checkpointing is enabled for an
-- application.
--
-- If @CheckpointConfiguration.ConfigurationType@ is @DEFAULT@, the
-- application will use a @CheckpointingEnabled@ value of @true@, even if
-- this value is set to another value using this API or in application
-- code.
--
-- 'minPauseBetweenCheckpointsUpdate', 'checkpointConfigurationUpdate_minPauseBetweenCheckpointsUpdate' - Describes updates to the minimum time in milliseconds after a checkpoint
-- operation completes that a new checkpoint operation can start.
--
-- If @CheckpointConfiguration.ConfigurationType@ is @DEFAULT@, the
-- application will use a @MinPauseBetweenCheckpoints@ value of 5000, even
-- if this value is set using this API or in application code.
--
-- 'configurationTypeUpdate', 'checkpointConfigurationUpdate_configurationTypeUpdate' - Describes updates to whether the application uses the default
-- checkpointing behavior of Kinesis Data Analytics. You must set this
-- property to @CUSTOM@ in order to set the @CheckpointingEnabled@,
-- @CheckpointInterval@, or @MinPauseBetweenCheckpoints@ parameters.
--
-- If this value is set to @DEFAULT@, the application will use the
-- following values, even if they are set to other values using APIs or
-- application code:
--
-- -   __CheckpointingEnabled:__ true
--
-- -   __CheckpointInterval:__ 60000
--
-- -   __MinPauseBetweenCheckpoints:__ 5000
newCheckpointConfigurationUpdate ::
  CheckpointConfigurationUpdate
newCheckpointConfigurationUpdate :: CheckpointConfigurationUpdate
newCheckpointConfigurationUpdate =
  CheckpointConfigurationUpdate' :: Maybe Natural
-> Maybe Bool
-> Maybe Natural
-> Maybe ConfigurationType
-> CheckpointConfigurationUpdate
CheckpointConfigurationUpdate'
    { $sel:checkpointIntervalUpdate:CheckpointConfigurationUpdate' :: Maybe Natural
checkpointIntervalUpdate =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:checkpointingEnabledUpdate:CheckpointConfigurationUpdate' :: Maybe Bool
checkpointingEnabledUpdate = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:minPauseBetweenCheckpointsUpdate:CheckpointConfigurationUpdate' :: Maybe Natural
minPauseBetweenCheckpointsUpdate =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:configurationTypeUpdate:CheckpointConfigurationUpdate' :: Maybe ConfigurationType
configurationTypeUpdate = Maybe ConfigurationType
forall a. Maybe a
Prelude.Nothing
    }

-- | Describes updates to the interval in milliseconds between checkpoint
-- operations.
--
-- If @CheckpointConfiguration.ConfigurationType@ is @DEFAULT@, the
-- application will use a @CheckpointInterval@ value of 60000, even if this
-- value is set to another value using this API or in application code.
checkpointConfigurationUpdate_checkpointIntervalUpdate :: Lens.Lens' CheckpointConfigurationUpdate (Prelude.Maybe Prelude.Natural)
checkpointConfigurationUpdate_checkpointIntervalUpdate :: (Maybe Natural -> f (Maybe Natural))
-> CheckpointConfigurationUpdate -> f CheckpointConfigurationUpdate
checkpointConfigurationUpdate_checkpointIntervalUpdate = (CheckpointConfigurationUpdate -> Maybe Natural)
-> (CheckpointConfigurationUpdate
    -> Maybe Natural -> CheckpointConfigurationUpdate)
-> Lens
     CheckpointConfigurationUpdate
     CheckpointConfigurationUpdate
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckpointConfigurationUpdate' {Maybe Natural
checkpointIntervalUpdate :: Maybe Natural
$sel:checkpointIntervalUpdate:CheckpointConfigurationUpdate' :: CheckpointConfigurationUpdate -> Maybe Natural
checkpointIntervalUpdate} -> Maybe Natural
checkpointIntervalUpdate) (\s :: CheckpointConfigurationUpdate
s@CheckpointConfigurationUpdate' {} Maybe Natural
a -> CheckpointConfigurationUpdate
s {$sel:checkpointIntervalUpdate:CheckpointConfigurationUpdate' :: Maybe Natural
checkpointIntervalUpdate = Maybe Natural
a} :: CheckpointConfigurationUpdate)

-- | Describes updates to whether checkpointing is enabled for an
-- application.
--
-- If @CheckpointConfiguration.ConfigurationType@ is @DEFAULT@, the
-- application will use a @CheckpointingEnabled@ value of @true@, even if
-- this value is set to another value using this API or in application
-- code.
checkpointConfigurationUpdate_checkpointingEnabledUpdate :: Lens.Lens' CheckpointConfigurationUpdate (Prelude.Maybe Prelude.Bool)
checkpointConfigurationUpdate_checkpointingEnabledUpdate :: (Maybe Bool -> f (Maybe Bool))
-> CheckpointConfigurationUpdate -> f CheckpointConfigurationUpdate
checkpointConfigurationUpdate_checkpointingEnabledUpdate = (CheckpointConfigurationUpdate -> Maybe Bool)
-> (CheckpointConfigurationUpdate
    -> Maybe Bool -> CheckpointConfigurationUpdate)
-> Lens
     CheckpointConfigurationUpdate
     CheckpointConfigurationUpdate
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckpointConfigurationUpdate' {Maybe Bool
checkpointingEnabledUpdate :: Maybe Bool
$sel:checkpointingEnabledUpdate:CheckpointConfigurationUpdate' :: CheckpointConfigurationUpdate -> Maybe Bool
checkpointingEnabledUpdate} -> Maybe Bool
checkpointingEnabledUpdate) (\s :: CheckpointConfigurationUpdate
s@CheckpointConfigurationUpdate' {} Maybe Bool
a -> CheckpointConfigurationUpdate
s {$sel:checkpointingEnabledUpdate:CheckpointConfigurationUpdate' :: Maybe Bool
checkpointingEnabledUpdate = Maybe Bool
a} :: CheckpointConfigurationUpdate)

-- | Describes updates to the minimum time in milliseconds after a checkpoint
-- operation completes that a new checkpoint operation can start.
--
-- If @CheckpointConfiguration.ConfigurationType@ is @DEFAULT@, the
-- application will use a @MinPauseBetweenCheckpoints@ value of 5000, even
-- if this value is set using this API or in application code.
checkpointConfigurationUpdate_minPauseBetweenCheckpointsUpdate :: Lens.Lens' CheckpointConfigurationUpdate (Prelude.Maybe Prelude.Natural)
checkpointConfigurationUpdate_minPauseBetweenCheckpointsUpdate :: (Maybe Natural -> f (Maybe Natural))
-> CheckpointConfigurationUpdate -> f CheckpointConfigurationUpdate
checkpointConfigurationUpdate_minPauseBetweenCheckpointsUpdate = (CheckpointConfigurationUpdate -> Maybe Natural)
-> (CheckpointConfigurationUpdate
    -> Maybe Natural -> CheckpointConfigurationUpdate)
-> Lens
     CheckpointConfigurationUpdate
     CheckpointConfigurationUpdate
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckpointConfigurationUpdate' {Maybe Natural
minPauseBetweenCheckpointsUpdate :: Maybe Natural
$sel:minPauseBetweenCheckpointsUpdate:CheckpointConfigurationUpdate' :: CheckpointConfigurationUpdate -> Maybe Natural
minPauseBetweenCheckpointsUpdate} -> Maybe Natural
minPauseBetweenCheckpointsUpdate) (\s :: CheckpointConfigurationUpdate
s@CheckpointConfigurationUpdate' {} Maybe Natural
a -> CheckpointConfigurationUpdate
s {$sel:minPauseBetweenCheckpointsUpdate:CheckpointConfigurationUpdate' :: Maybe Natural
minPauseBetweenCheckpointsUpdate = Maybe Natural
a} :: CheckpointConfigurationUpdate)

-- | Describes updates to whether the application uses the default
-- checkpointing behavior of Kinesis Data Analytics. You must set this
-- property to @CUSTOM@ in order to set the @CheckpointingEnabled@,
-- @CheckpointInterval@, or @MinPauseBetweenCheckpoints@ parameters.
--
-- If this value is set to @DEFAULT@, the application will use the
-- following values, even if they are set to other values using APIs or
-- application code:
--
-- -   __CheckpointingEnabled:__ true
--
-- -   __CheckpointInterval:__ 60000
--
-- -   __MinPauseBetweenCheckpoints:__ 5000
checkpointConfigurationUpdate_configurationTypeUpdate :: Lens.Lens' CheckpointConfigurationUpdate (Prelude.Maybe ConfigurationType)
checkpointConfigurationUpdate_configurationTypeUpdate :: (Maybe ConfigurationType -> f (Maybe ConfigurationType))
-> CheckpointConfigurationUpdate -> f CheckpointConfigurationUpdate
checkpointConfigurationUpdate_configurationTypeUpdate = (CheckpointConfigurationUpdate -> Maybe ConfigurationType)
-> (CheckpointConfigurationUpdate
    -> Maybe ConfigurationType -> CheckpointConfigurationUpdate)
-> Lens
     CheckpointConfigurationUpdate
     CheckpointConfigurationUpdate
     (Maybe ConfigurationType)
     (Maybe ConfigurationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckpointConfigurationUpdate' {Maybe ConfigurationType
configurationTypeUpdate :: Maybe ConfigurationType
$sel:configurationTypeUpdate:CheckpointConfigurationUpdate' :: CheckpointConfigurationUpdate -> Maybe ConfigurationType
configurationTypeUpdate} -> Maybe ConfigurationType
configurationTypeUpdate) (\s :: CheckpointConfigurationUpdate
s@CheckpointConfigurationUpdate' {} Maybe ConfigurationType
a -> CheckpointConfigurationUpdate
s {$sel:configurationTypeUpdate:CheckpointConfigurationUpdate' :: Maybe ConfigurationType
configurationTypeUpdate = Maybe ConfigurationType
a} :: CheckpointConfigurationUpdate)

instance
  Prelude.Hashable
    CheckpointConfigurationUpdate

instance Prelude.NFData CheckpointConfigurationUpdate

instance Core.ToJSON CheckpointConfigurationUpdate where
  toJSON :: CheckpointConfigurationUpdate -> Value
toJSON CheckpointConfigurationUpdate' {Maybe Bool
Maybe Natural
Maybe ConfigurationType
configurationTypeUpdate :: Maybe ConfigurationType
minPauseBetweenCheckpointsUpdate :: Maybe Natural
checkpointingEnabledUpdate :: Maybe Bool
checkpointIntervalUpdate :: Maybe Natural
$sel:configurationTypeUpdate:CheckpointConfigurationUpdate' :: CheckpointConfigurationUpdate -> Maybe ConfigurationType
$sel:minPauseBetweenCheckpointsUpdate:CheckpointConfigurationUpdate' :: CheckpointConfigurationUpdate -> Maybe Natural
$sel:checkpointingEnabledUpdate:CheckpointConfigurationUpdate' :: CheckpointConfigurationUpdate -> Maybe Bool
$sel:checkpointIntervalUpdate:CheckpointConfigurationUpdate' :: CheckpointConfigurationUpdate -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"CheckpointIntervalUpdate" 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
checkpointIntervalUpdate,
            (Text
"CheckpointingEnabledUpdate" 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
checkpointingEnabledUpdate,
            (Text
"MinPauseBetweenCheckpointsUpdate" 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
minPauseBetweenCheckpointsUpdate,
            (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
          ]
      )