{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.KinesisAnalyticsV2.Types.CheckpointConfigurationUpdate where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.KinesisAnalyticsV2.Types.ConfigurationType
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 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,
    -- | 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
  }
  deriving (CheckpointConfigurationUpdate
-> CheckpointConfigurationUpdate -> Bool
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]
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
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.
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.
--
-- '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
--
-- '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.
newCheckpointConfigurationUpdate ::
  CheckpointConfigurationUpdate
newCheckpointConfigurationUpdate :: CheckpointConfigurationUpdate
newCheckpointConfigurationUpdate =
  CheckpointConfigurationUpdate'
    { $sel:checkpointIntervalUpdate:CheckpointConfigurationUpdate' :: Maybe Natural
checkpointIntervalUpdate =
        forall a. Maybe a
Prelude.Nothing,
      $sel:checkpointingEnabledUpdate:CheckpointConfigurationUpdate' :: Maybe Bool
checkpointingEnabledUpdate = forall a. Maybe a
Prelude.Nothing,
      $sel:configurationTypeUpdate:CheckpointConfigurationUpdate' :: Maybe ConfigurationType
configurationTypeUpdate = forall a. Maybe a
Prelude.Nothing,
      $sel:minPauseBetweenCheckpointsUpdate:CheckpointConfigurationUpdate' :: Maybe Natural
minPauseBetweenCheckpointsUpdate =
        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 :: Lens' CheckpointConfigurationUpdate (Maybe Natural)
checkpointConfigurationUpdate_checkpointIntervalUpdate = 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 :: Lens' CheckpointConfigurationUpdate (Maybe Bool)
checkpointConfigurationUpdate_checkpointingEnabledUpdate = 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 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 :: Lens' CheckpointConfigurationUpdate (Maybe ConfigurationType)
checkpointConfigurationUpdate_configurationTypeUpdate = 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)

-- | 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 :: Lens' CheckpointConfigurationUpdate (Maybe Natural)
checkpointConfigurationUpdate_minPauseBetweenCheckpointsUpdate = 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)

instance
  Prelude.Hashable
    CheckpointConfigurationUpdate
  where
  hashWithSalt :: Int -> CheckpointConfigurationUpdate -> Int
hashWithSalt Int
_salt CheckpointConfigurationUpdate' {Maybe Bool
Maybe Natural
Maybe ConfigurationType
minPauseBetweenCheckpointsUpdate :: Maybe Natural
configurationTypeUpdate :: Maybe ConfigurationType
checkpointingEnabledUpdate :: Maybe Bool
checkpointIntervalUpdate :: Maybe Natural
$sel:minPauseBetweenCheckpointsUpdate:CheckpointConfigurationUpdate' :: CheckpointConfigurationUpdate -> Maybe Natural
$sel:configurationTypeUpdate:CheckpointConfigurationUpdate' :: CheckpointConfigurationUpdate -> Maybe ConfigurationType
$sel:checkpointingEnabledUpdate:CheckpointConfigurationUpdate' :: CheckpointConfigurationUpdate -> Maybe Bool
$sel:checkpointIntervalUpdate:CheckpointConfigurationUpdate' :: CheckpointConfigurationUpdate -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
checkpointIntervalUpdate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
checkpointingEnabledUpdate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConfigurationType
configurationTypeUpdate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
minPauseBetweenCheckpointsUpdate

instance Prelude.NFData CheckpointConfigurationUpdate where
  rnf :: CheckpointConfigurationUpdate -> ()
rnf CheckpointConfigurationUpdate' {Maybe Bool
Maybe Natural
Maybe ConfigurationType
minPauseBetweenCheckpointsUpdate :: Maybe Natural
configurationTypeUpdate :: Maybe ConfigurationType
checkpointingEnabledUpdate :: Maybe Bool
checkpointIntervalUpdate :: Maybe Natural
$sel:minPauseBetweenCheckpointsUpdate:CheckpointConfigurationUpdate' :: CheckpointConfigurationUpdate -> Maybe Natural
$sel:configurationTypeUpdate:CheckpointConfigurationUpdate' :: CheckpointConfigurationUpdate -> Maybe ConfigurationType
$sel:checkpointingEnabledUpdate:CheckpointConfigurationUpdate' :: CheckpointConfigurationUpdate -> Maybe Bool
$sel:checkpointIntervalUpdate:CheckpointConfigurationUpdate' :: CheckpointConfigurationUpdate -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
checkpointIntervalUpdate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
checkpointingEnabledUpdate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConfigurationType
configurationTypeUpdate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
minPauseBetweenCheckpointsUpdate

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