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

import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalyticsV2.Types.ApplicationRestoreConfiguration
import Amazonka.KinesisAnalyticsV2.Types.FlinkRunConfiguration
import Amazonka.KinesisAnalyticsV2.Types.SqlRunConfiguration
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes the starting parameters for an Kinesis Data Analytics
-- application.
--
-- /See:/ 'newRunConfiguration' smart constructor.
data RunConfiguration = RunConfiguration'
  { -- | Describes the starting parameters for a SQL-based Kinesis Data Analytics
    -- application application.
    RunConfiguration -> Maybe [SqlRunConfiguration]
sqlRunConfigurations :: Prelude.Maybe [SqlRunConfiguration],
    -- | Describes the starting parameters for a Flink-based Kinesis Data
    -- Analytics application.
    RunConfiguration -> Maybe FlinkRunConfiguration
flinkRunConfiguration :: Prelude.Maybe FlinkRunConfiguration,
    -- | Describes the restore behavior of a restarting application.
    RunConfiguration -> Maybe ApplicationRestoreConfiguration
applicationRestoreConfiguration :: Prelude.Maybe ApplicationRestoreConfiguration
  }
  deriving (RunConfiguration -> RunConfiguration -> Bool
(RunConfiguration -> RunConfiguration -> Bool)
-> (RunConfiguration -> RunConfiguration -> Bool)
-> Eq RunConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RunConfiguration -> RunConfiguration -> Bool
$c/= :: RunConfiguration -> RunConfiguration -> Bool
== :: RunConfiguration -> RunConfiguration -> Bool
$c== :: RunConfiguration -> RunConfiguration -> Bool
Prelude.Eq, ReadPrec [RunConfiguration]
ReadPrec RunConfiguration
Int -> ReadS RunConfiguration
ReadS [RunConfiguration]
(Int -> ReadS RunConfiguration)
-> ReadS [RunConfiguration]
-> ReadPrec RunConfiguration
-> ReadPrec [RunConfiguration]
-> Read RunConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RunConfiguration]
$creadListPrec :: ReadPrec [RunConfiguration]
readPrec :: ReadPrec RunConfiguration
$creadPrec :: ReadPrec RunConfiguration
readList :: ReadS [RunConfiguration]
$creadList :: ReadS [RunConfiguration]
readsPrec :: Int -> ReadS RunConfiguration
$creadsPrec :: Int -> ReadS RunConfiguration
Prelude.Read, Int -> RunConfiguration -> ShowS
[RunConfiguration] -> ShowS
RunConfiguration -> String
(Int -> RunConfiguration -> ShowS)
-> (RunConfiguration -> String)
-> ([RunConfiguration] -> ShowS)
-> Show RunConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RunConfiguration] -> ShowS
$cshowList :: [RunConfiguration] -> ShowS
show :: RunConfiguration -> String
$cshow :: RunConfiguration -> String
showsPrec :: Int -> RunConfiguration -> ShowS
$cshowsPrec :: Int -> RunConfiguration -> ShowS
Prelude.Show, (forall x. RunConfiguration -> Rep RunConfiguration x)
-> (forall x. Rep RunConfiguration x -> RunConfiguration)
-> Generic RunConfiguration
forall x. Rep RunConfiguration x -> RunConfiguration
forall x. RunConfiguration -> Rep RunConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RunConfiguration x -> RunConfiguration
$cfrom :: forall x. RunConfiguration -> Rep RunConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'RunConfiguration' 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:
--
-- 'sqlRunConfigurations', 'runConfiguration_sqlRunConfigurations' - Describes the starting parameters for a SQL-based Kinesis Data Analytics
-- application application.
--
-- 'flinkRunConfiguration', 'runConfiguration_flinkRunConfiguration' - Describes the starting parameters for a Flink-based Kinesis Data
-- Analytics application.
--
-- 'applicationRestoreConfiguration', 'runConfiguration_applicationRestoreConfiguration' - Describes the restore behavior of a restarting application.
newRunConfiguration ::
  RunConfiguration
newRunConfiguration :: RunConfiguration
newRunConfiguration =
  RunConfiguration' :: Maybe [SqlRunConfiguration]
-> Maybe FlinkRunConfiguration
-> Maybe ApplicationRestoreConfiguration
-> RunConfiguration
RunConfiguration'
    { $sel:sqlRunConfigurations:RunConfiguration' :: Maybe [SqlRunConfiguration]
sqlRunConfigurations =
        Maybe [SqlRunConfiguration]
forall a. Maybe a
Prelude.Nothing,
      $sel:flinkRunConfiguration:RunConfiguration' :: Maybe FlinkRunConfiguration
flinkRunConfiguration = Maybe FlinkRunConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:applicationRestoreConfiguration:RunConfiguration' :: Maybe ApplicationRestoreConfiguration
applicationRestoreConfiguration = Maybe ApplicationRestoreConfiguration
forall a. Maybe a
Prelude.Nothing
    }

-- | Describes the starting parameters for a SQL-based Kinesis Data Analytics
-- application application.
runConfiguration_sqlRunConfigurations :: Lens.Lens' RunConfiguration (Prelude.Maybe [SqlRunConfiguration])
runConfiguration_sqlRunConfigurations :: (Maybe [SqlRunConfiguration] -> f (Maybe [SqlRunConfiguration]))
-> RunConfiguration -> f RunConfiguration
runConfiguration_sqlRunConfigurations = (RunConfiguration -> Maybe [SqlRunConfiguration])
-> (RunConfiguration
    -> Maybe [SqlRunConfiguration] -> RunConfiguration)
-> Lens
     RunConfiguration
     RunConfiguration
     (Maybe [SqlRunConfiguration])
     (Maybe [SqlRunConfiguration])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RunConfiguration' {Maybe [SqlRunConfiguration]
sqlRunConfigurations :: Maybe [SqlRunConfiguration]
$sel:sqlRunConfigurations:RunConfiguration' :: RunConfiguration -> Maybe [SqlRunConfiguration]
sqlRunConfigurations} -> Maybe [SqlRunConfiguration]
sqlRunConfigurations) (\s :: RunConfiguration
s@RunConfiguration' {} Maybe [SqlRunConfiguration]
a -> RunConfiguration
s {$sel:sqlRunConfigurations:RunConfiguration' :: Maybe [SqlRunConfiguration]
sqlRunConfigurations = Maybe [SqlRunConfiguration]
a} :: RunConfiguration) ((Maybe [SqlRunConfiguration] -> f (Maybe [SqlRunConfiguration]))
 -> RunConfiguration -> f RunConfiguration)
-> ((Maybe [SqlRunConfiguration]
     -> f (Maybe [SqlRunConfiguration]))
    -> Maybe [SqlRunConfiguration] -> f (Maybe [SqlRunConfiguration]))
-> (Maybe [SqlRunConfiguration] -> f (Maybe [SqlRunConfiguration]))
-> RunConfiguration
-> f RunConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SqlRunConfiguration]
  [SqlRunConfiguration]
  [SqlRunConfiguration]
  [SqlRunConfiguration]
-> Iso
     (Maybe [SqlRunConfiguration])
     (Maybe [SqlRunConfiguration])
     (Maybe [SqlRunConfiguration])
     (Maybe [SqlRunConfiguration])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [SqlRunConfiguration]
  [SqlRunConfiguration]
  [SqlRunConfiguration]
  [SqlRunConfiguration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Describes the starting parameters for a Flink-based Kinesis Data
-- Analytics application.
runConfiguration_flinkRunConfiguration :: Lens.Lens' RunConfiguration (Prelude.Maybe FlinkRunConfiguration)
runConfiguration_flinkRunConfiguration :: (Maybe FlinkRunConfiguration -> f (Maybe FlinkRunConfiguration))
-> RunConfiguration -> f RunConfiguration
runConfiguration_flinkRunConfiguration = (RunConfiguration -> Maybe FlinkRunConfiguration)
-> (RunConfiguration
    -> Maybe FlinkRunConfiguration -> RunConfiguration)
-> Lens
     RunConfiguration
     RunConfiguration
     (Maybe FlinkRunConfiguration)
     (Maybe FlinkRunConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RunConfiguration' {Maybe FlinkRunConfiguration
flinkRunConfiguration :: Maybe FlinkRunConfiguration
$sel:flinkRunConfiguration:RunConfiguration' :: RunConfiguration -> Maybe FlinkRunConfiguration
flinkRunConfiguration} -> Maybe FlinkRunConfiguration
flinkRunConfiguration) (\s :: RunConfiguration
s@RunConfiguration' {} Maybe FlinkRunConfiguration
a -> RunConfiguration
s {$sel:flinkRunConfiguration:RunConfiguration' :: Maybe FlinkRunConfiguration
flinkRunConfiguration = Maybe FlinkRunConfiguration
a} :: RunConfiguration)

-- | Describes the restore behavior of a restarting application.
runConfiguration_applicationRestoreConfiguration :: Lens.Lens' RunConfiguration (Prelude.Maybe ApplicationRestoreConfiguration)
runConfiguration_applicationRestoreConfiguration :: (Maybe ApplicationRestoreConfiguration
 -> f (Maybe ApplicationRestoreConfiguration))
-> RunConfiguration -> f RunConfiguration
runConfiguration_applicationRestoreConfiguration = (RunConfiguration -> Maybe ApplicationRestoreConfiguration)
-> (RunConfiguration
    -> Maybe ApplicationRestoreConfiguration -> RunConfiguration)
-> Lens
     RunConfiguration
     RunConfiguration
     (Maybe ApplicationRestoreConfiguration)
     (Maybe ApplicationRestoreConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RunConfiguration' {Maybe ApplicationRestoreConfiguration
applicationRestoreConfiguration :: Maybe ApplicationRestoreConfiguration
$sel:applicationRestoreConfiguration:RunConfiguration' :: RunConfiguration -> Maybe ApplicationRestoreConfiguration
applicationRestoreConfiguration} -> Maybe ApplicationRestoreConfiguration
applicationRestoreConfiguration) (\s :: RunConfiguration
s@RunConfiguration' {} Maybe ApplicationRestoreConfiguration
a -> RunConfiguration
s {$sel:applicationRestoreConfiguration:RunConfiguration' :: Maybe ApplicationRestoreConfiguration
applicationRestoreConfiguration = Maybe ApplicationRestoreConfiguration
a} :: RunConfiguration)

instance Prelude.Hashable RunConfiguration

instance Prelude.NFData RunConfiguration

instance Core.ToJSON RunConfiguration where
  toJSON :: RunConfiguration -> Value
toJSON RunConfiguration' {Maybe [SqlRunConfiguration]
Maybe ApplicationRestoreConfiguration
Maybe FlinkRunConfiguration
applicationRestoreConfiguration :: Maybe ApplicationRestoreConfiguration
flinkRunConfiguration :: Maybe FlinkRunConfiguration
sqlRunConfigurations :: Maybe [SqlRunConfiguration]
$sel:applicationRestoreConfiguration:RunConfiguration' :: RunConfiguration -> Maybe ApplicationRestoreConfiguration
$sel:flinkRunConfiguration:RunConfiguration' :: RunConfiguration -> Maybe FlinkRunConfiguration
$sel:sqlRunConfigurations:RunConfiguration' :: RunConfiguration -> Maybe [SqlRunConfiguration]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SqlRunConfigurations" Text -> [SqlRunConfiguration] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([SqlRunConfiguration] -> Pair)
-> Maybe [SqlRunConfiguration] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [SqlRunConfiguration]
sqlRunConfigurations,
            (Text
"FlinkRunConfiguration" Text -> FlinkRunConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (FlinkRunConfiguration -> Pair)
-> Maybe FlinkRunConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FlinkRunConfiguration
flinkRunConfiguration,
            (Text
"ApplicationRestoreConfiguration" Text -> ApplicationRestoreConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ApplicationRestoreConfiguration -> Pair)
-> Maybe ApplicationRestoreConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ApplicationRestoreConfiguration
applicationRestoreConfiguration
          ]
      )