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

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

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

-- |
-- Create a value of 'RunConfigurationUpdate' 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:
--
-- 'flinkRunConfiguration', 'runConfigurationUpdate_flinkRunConfiguration' - Describes the starting parameters for a Flink-based Kinesis Data
-- Analytics application.
--
-- 'applicationRestoreConfiguration', 'runConfigurationUpdate_applicationRestoreConfiguration' - Describes updates to the restore behavior of a restarting application.
newRunConfigurationUpdate ::
  RunConfigurationUpdate
newRunConfigurationUpdate :: RunConfigurationUpdate
newRunConfigurationUpdate =
  RunConfigurationUpdate' :: Maybe FlinkRunConfiguration
-> Maybe ApplicationRestoreConfiguration -> RunConfigurationUpdate
RunConfigurationUpdate'
    { $sel:flinkRunConfiguration:RunConfigurationUpdate' :: Maybe FlinkRunConfiguration
flinkRunConfiguration =
        Maybe FlinkRunConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:applicationRestoreConfiguration:RunConfigurationUpdate' :: Maybe ApplicationRestoreConfiguration
applicationRestoreConfiguration = Maybe ApplicationRestoreConfiguration
forall a. Maybe a
Prelude.Nothing
    }

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

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

instance Prelude.Hashable RunConfigurationUpdate

instance Prelude.NFData RunConfigurationUpdate

instance Core.ToJSON RunConfigurationUpdate where
  toJSON :: RunConfigurationUpdate -> Value
toJSON RunConfigurationUpdate' {Maybe ApplicationRestoreConfiguration
Maybe FlinkRunConfiguration
applicationRestoreConfiguration :: Maybe ApplicationRestoreConfiguration
flinkRunConfiguration :: Maybe FlinkRunConfiguration
$sel:applicationRestoreConfiguration:RunConfigurationUpdate' :: RunConfigurationUpdate -> Maybe ApplicationRestoreConfiguration
$sel:flinkRunConfiguration:RunConfigurationUpdate' :: RunConfigurationUpdate -> Maybe FlinkRunConfiguration
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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
          ]
      )