{-# 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.FlinkApplicationConfiguration
-- 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.FlinkApplicationConfiguration where

import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalyticsV2.Types.CheckpointConfiguration
import Amazonka.KinesisAnalyticsV2.Types.MonitoringConfiguration
import Amazonka.KinesisAnalyticsV2.Types.ParallelismConfiguration
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes configuration parameters for a Flink-based Kinesis Data
-- Analytics application or a Studio notebook.
--
-- /See:/ 'newFlinkApplicationConfiguration' smart constructor.
data FlinkApplicationConfiguration = FlinkApplicationConfiguration'
  { -- | Describes configuration parameters for Amazon CloudWatch logging for an
    -- application.
    FlinkApplicationConfiguration -> Maybe MonitoringConfiguration
monitoringConfiguration :: Prelude.Maybe MonitoringConfiguration,
    -- | Describes parameters for how an application executes multiple tasks
    -- simultaneously.
    FlinkApplicationConfiguration -> Maybe ParallelismConfiguration
parallelismConfiguration :: Prelude.Maybe ParallelismConfiguration,
    -- | Describes an application\'s checkpointing configuration. Checkpointing
    -- is the process of persisting application state for fault tolerance. For
    -- more information, see
    -- <https://ci.apache.org/projects/flink/flink-docs-release-1.8/concepts/programming-model.html#checkpoints-for-fault-tolerance Checkpoints for Fault Tolerance>
    -- in the
    -- <https://ci.apache.org/projects/flink/flink-docs-release-1.8/ Apache Flink Documentation>.
    FlinkApplicationConfiguration -> Maybe CheckpointConfiguration
checkpointConfiguration :: Prelude.Maybe CheckpointConfiguration
  }
  deriving (FlinkApplicationConfiguration
-> FlinkApplicationConfiguration -> Bool
(FlinkApplicationConfiguration
 -> FlinkApplicationConfiguration -> Bool)
-> (FlinkApplicationConfiguration
    -> FlinkApplicationConfiguration -> Bool)
-> Eq FlinkApplicationConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FlinkApplicationConfiguration
-> FlinkApplicationConfiguration -> Bool
$c/= :: FlinkApplicationConfiguration
-> FlinkApplicationConfiguration -> Bool
== :: FlinkApplicationConfiguration
-> FlinkApplicationConfiguration -> Bool
$c== :: FlinkApplicationConfiguration
-> FlinkApplicationConfiguration -> Bool
Prelude.Eq, ReadPrec [FlinkApplicationConfiguration]
ReadPrec FlinkApplicationConfiguration
Int -> ReadS FlinkApplicationConfiguration
ReadS [FlinkApplicationConfiguration]
(Int -> ReadS FlinkApplicationConfiguration)
-> ReadS [FlinkApplicationConfiguration]
-> ReadPrec FlinkApplicationConfiguration
-> ReadPrec [FlinkApplicationConfiguration]
-> Read FlinkApplicationConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FlinkApplicationConfiguration]
$creadListPrec :: ReadPrec [FlinkApplicationConfiguration]
readPrec :: ReadPrec FlinkApplicationConfiguration
$creadPrec :: ReadPrec FlinkApplicationConfiguration
readList :: ReadS [FlinkApplicationConfiguration]
$creadList :: ReadS [FlinkApplicationConfiguration]
readsPrec :: Int -> ReadS FlinkApplicationConfiguration
$creadsPrec :: Int -> ReadS FlinkApplicationConfiguration
Prelude.Read, Int -> FlinkApplicationConfiguration -> ShowS
[FlinkApplicationConfiguration] -> ShowS
FlinkApplicationConfiguration -> String
(Int -> FlinkApplicationConfiguration -> ShowS)
-> (FlinkApplicationConfiguration -> String)
-> ([FlinkApplicationConfiguration] -> ShowS)
-> Show FlinkApplicationConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FlinkApplicationConfiguration] -> ShowS
$cshowList :: [FlinkApplicationConfiguration] -> ShowS
show :: FlinkApplicationConfiguration -> String
$cshow :: FlinkApplicationConfiguration -> String
showsPrec :: Int -> FlinkApplicationConfiguration -> ShowS
$cshowsPrec :: Int -> FlinkApplicationConfiguration -> ShowS
Prelude.Show, (forall x.
 FlinkApplicationConfiguration
 -> Rep FlinkApplicationConfiguration x)
-> (forall x.
    Rep FlinkApplicationConfiguration x
    -> FlinkApplicationConfiguration)
-> Generic FlinkApplicationConfiguration
forall x.
Rep FlinkApplicationConfiguration x
-> FlinkApplicationConfiguration
forall x.
FlinkApplicationConfiguration
-> Rep FlinkApplicationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FlinkApplicationConfiguration x
-> FlinkApplicationConfiguration
$cfrom :: forall x.
FlinkApplicationConfiguration
-> Rep FlinkApplicationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'FlinkApplicationConfiguration' 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:
--
-- 'monitoringConfiguration', 'flinkApplicationConfiguration_monitoringConfiguration' - Describes configuration parameters for Amazon CloudWatch logging for an
-- application.
--
-- 'parallelismConfiguration', 'flinkApplicationConfiguration_parallelismConfiguration' - Describes parameters for how an application executes multiple tasks
-- simultaneously.
--
-- 'checkpointConfiguration', 'flinkApplicationConfiguration_checkpointConfiguration' - Describes an application\'s checkpointing configuration. Checkpointing
-- is the process of persisting application state for fault tolerance. For
-- more information, see
-- <https://ci.apache.org/projects/flink/flink-docs-release-1.8/concepts/programming-model.html#checkpoints-for-fault-tolerance Checkpoints for Fault Tolerance>
-- in the
-- <https://ci.apache.org/projects/flink/flink-docs-release-1.8/ Apache Flink Documentation>.
newFlinkApplicationConfiguration ::
  FlinkApplicationConfiguration
newFlinkApplicationConfiguration :: FlinkApplicationConfiguration
newFlinkApplicationConfiguration =
  FlinkApplicationConfiguration' :: Maybe MonitoringConfiguration
-> Maybe ParallelismConfiguration
-> Maybe CheckpointConfiguration
-> FlinkApplicationConfiguration
FlinkApplicationConfiguration'
    { $sel:monitoringConfiguration:FlinkApplicationConfiguration' :: Maybe MonitoringConfiguration
monitoringConfiguration =
        Maybe MonitoringConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:parallelismConfiguration:FlinkApplicationConfiguration' :: Maybe ParallelismConfiguration
parallelismConfiguration = Maybe ParallelismConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:checkpointConfiguration:FlinkApplicationConfiguration' :: Maybe CheckpointConfiguration
checkpointConfiguration = Maybe CheckpointConfiguration
forall a. Maybe a
Prelude.Nothing
    }

-- | Describes configuration parameters for Amazon CloudWatch logging for an
-- application.
flinkApplicationConfiguration_monitoringConfiguration :: Lens.Lens' FlinkApplicationConfiguration (Prelude.Maybe MonitoringConfiguration)
flinkApplicationConfiguration_monitoringConfiguration :: (Maybe MonitoringConfiguration
 -> f (Maybe MonitoringConfiguration))
-> FlinkApplicationConfiguration -> f FlinkApplicationConfiguration
flinkApplicationConfiguration_monitoringConfiguration = (FlinkApplicationConfiguration -> Maybe MonitoringConfiguration)
-> (FlinkApplicationConfiguration
    -> Maybe MonitoringConfiguration -> FlinkApplicationConfiguration)
-> Lens
     FlinkApplicationConfiguration
     FlinkApplicationConfiguration
     (Maybe MonitoringConfiguration)
     (Maybe MonitoringConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlinkApplicationConfiguration' {Maybe MonitoringConfiguration
monitoringConfiguration :: Maybe MonitoringConfiguration
$sel:monitoringConfiguration:FlinkApplicationConfiguration' :: FlinkApplicationConfiguration -> Maybe MonitoringConfiguration
monitoringConfiguration} -> Maybe MonitoringConfiguration
monitoringConfiguration) (\s :: FlinkApplicationConfiguration
s@FlinkApplicationConfiguration' {} Maybe MonitoringConfiguration
a -> FlinkApplicationConfiguration
s {$sel:monitoringConfiguration:FlinkApplicationConfiguration' :: Maybe MonitoringConfiguration
monitoringConfiguration = Maybe MonitoringConfiguration
a} :: FlinkApplicationConfiguration)

-- | Describes parameters for how an application executes multiple tasks
-- simultaneously.
flinkApplicationConfiguration_parallelismConfiguration :: Lens.Lens' FlinkApplicationConfiguration (Prelude.Maybe ParallelismConfiguration)
flinkApplicationConfiguration_parallelismConfiguration :: (Maybe ParallelismConfiguration
 -> f (Maybe ParallelismConfiguration))
-> FlinkApplicationConfiguration -> f FlinkApplicationConfiguration
flinkApplicationConfiguration_parallelismConfiguration = (FlinkApplicationConfiguration -> Maybe ParallelismConfiguration)
-> (FlinkApplicationConfiguration
    -> Maybe ParallelismConfiguration -> FlinkApplicationConfiguration)
-> Lens
     FlinkApplicationConfiguration
     FlinkApplicationConfiguration
     (Maybe ParallelismConfiguration)
     (Maybe ParallelismConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlinkApplicationConfiguration' {Maybe ParallelismConfiguration
parallelismConfiguration :: Maybe ParallelismConfiguration
$sel:parallelismConfiguration:FlinkApplicationConfiguration' :: FlinkApplicationConfiguration -> Maybe ParallelismConfiguration
parallelismConfiguration} -> Maybe ParallelismConfiguration
parallelismConfiguration) (\s :: FlinkApplicationConfiguration
s@FlinkApplicationConfiguration' {} Maybe ParallelismConfiguration
a -> FlinkApplicationConfiguration
s {$sel:parallelismConfiguration:FlinkApplicationConfiguration' :: Maybe ParallelismConfiguration
parallelismConfiguration = Maybe ParallelismConfiguration
a} :: FlinkApplicationConfiguration)

-- | Describes an application\'s checkpointing configuration. Checkpointing
-- is the process of persisting application state for fault tolerance. For
-- more information, see
-- <https://ci.apache.org/projects/flink/flink-docs-release-1.8/concepts/programming-model.html#checkpoints-for-fault-tolerance Checkpoints for Fault Tolerance>
-- in the
-- <https://ci.apache.org/projects/flink/flink-docs-release-1.8/ Apache Flink Documentation>.
flinkApplicationConfiguration_checkpointConfiguration :: Lens.Lens' FlinkApplicationConfiguration (Prelude.Maybe CheckpointConfiguration)
flinkApplicationConfiguration_checkpointConfiguration :: (Maybe CheckpointConfiguration
 -> f (Maybe CheckpointConfiguration))
-> FlinkApplicationConfiguration -> f FlinkApplicationConfiguration
flinkApplicationConfiguration_checkpointConfiguration = (FlinkApplicationConfiguration -> Maybe CheckpointConfiguration)
-> (FlinkApplicationConfiguration
    -> Maybe CheckpointConfiguration -> FlinkApplicationConfiguration)
-> Lens
     FlinkApplicationConfiguration
     FlinkApplicationConfiguration
     (Maybe CheckpointConfiguration)
     (Maybe CheckpointConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlinkApplicationConfiguration' {Maybe CheckpointConfiguration
checkpointConfiguration :: Maybe CheckpointConfiguration
$sel:checkpointConfiguration:FlinkApplicationConfiguration' :: FlinkApplicationConfiguration -> Maybe CheckpointConfiguration
checkpointConfiguration} -> Maybe CheckpointConfiguration
checkpointConfiguration) (\s :: FlinkApplicationConfiguration
s@FlinkApplicationConfiguration' {} Maybe CheckpointConfiguration
a -> FlinkApplicationConfiguration
s {$sel:checkpointConfiguration:FlinkApplicationConfiguration' :: Maybe CheckpointConfiguration
checkpointConfiguration = Maybe CheckpointConfiguration
a} :: FlinkApplicationConfiguration)

instance
  Prelude.Hashable
    FlinkApplicationConfiguration

instance Prelude.NFData FlinkApplicationConfiguration

instance Core.ToJSON FlinkApplicationConfiguration where
  toJSON :: FlinkApplicationConfiguration -> Value
toJSON FlinkApplicationConfiguration' {Maybe CheckpointConfiguration
Maybe MonitoringConfiguration
Maybe ParallelismConfiguration
checkpointConfiguration :: Maybe CheckpointConfiguration
parallelismConfiguration :: Maybe ParallelismConfiguration
monitoringConfiguration :: Maybe MonitoringConfiguration
$sel:checkpointConfiguration:FlinkApplicationConfiguration' :: FlinkApplicationConfiguration -> Maybe CheckpointConfiguration
$sel:parallelismConfiguration:FlinkApplicationConfiguration' :: FlinkApplicationConfiguration -> Maybe ParallelismConfiguration
$sel:monitoringConfiguration:FlinkApplicationConfiguration' :: FlinkApplicationConfiguration -> Maybe MonitoringConfiguration
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"MonitoringConfiguration" Text -> MonitoringConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (MonitoringConfiguration -> Pair)
-> Maybe MonitoringConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MonitoringConfiguration
monitoringConfiguration,
            (Text
"ParallelismConfiguration" Text -> ParallelismConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ParallelismConfiguration -> Pair)
-> Maybe ParallelismConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ParallelismConfiguration
parallelismConfiguration,
            (Text
"CheckpointConfiguration" Text -> CheckpointConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CheckpointConfiguration -> Pair)
-> Maybe CheckpointConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CheckpointConfiguration
checkpointConfiguration
          ]
      )