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

import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalyticsV2.Types.InputUpdate
import Amazonka.KinesisAnalyticsV2.Types.OutputUpdate
import Amazonka.KinesisAnalyticsV2.Types.ReferenceDataSourceUpdate
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes updates to the input streams, destination streams, and
-- reference data sources for a SQL-based Kinesis Data Analytics
-- application.
--
-- /See:/ 'newSqlApplicationConfigurationUpdate' smart constructor.
data SqlApplicationConfigurationUpdate = SqlApplicationConfigurationUpdate'
  { -- | The array of ReferenceDataSourceUpdate objects describing the new
    -- reference data sources used by the application.
    SqlApplicationConfigurationUpdate
-> Maybe [ReferenceDataSourceUpdate]
referenceDataSourceUpdates :: Prelude.Maybe [ReferenceDataSourceUpdate],
    -- | The array of InputUpdate objects describing the new input streams used
    -- by the application.
    SqlApplicationConfigurationUpdate -> Maybe [InputUpdate]
inputUpdates :: Prelude.Maybe [InputUpdate],
    -- | The array of OutputUpdate objects describing the new destination streams
    -- used by the application.
    SqlApplicationConfigurationUpdate -> Maybe [OutputUpdate]
outputUpdates :: Prelude.Maybe [OutputUpdate]
  }
  deriving (SqlApplicationConfigurationUpdate
-> SqlApplicationConfigurationUpdate -> Bool
(SqlApplicationConfigurationUpdate
 -> SqlApplicationConfigurationUpdate -> Bool)
-> (SqlApplicationConfigurationUpdate
    -> SqlApplicationConfigurationUpdate -> Bool)
-> Eq SqlApplicationConfigurationUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SqlApplicationConfigurationUpdate
-> SqlApplicationConfigurationUpdate -> Bool
$c/= :: SqlApplicationConfigurationUpdate
-> SqlApplicationConfigurationUpdate -> Bool
== :: SqlApplicationConfigurationUpdate
-> SqlApplicationConfigurationUpdate -> Bool
$c== :: SqlApplicationConfigurationUpdate
-> SqlApplicationConfigurationUpdate -> Bool
Prelude.Eq, ReadPrec [SqlApplicationConfigurationUpdate]
ReadPrec SqlApplicationConfigurationUpdate
Int -> ReadS SqlApplicationConfigurationUpdate
ReadS [SqlApplicationConfigurationUpdate]
(Int -> ReadS SqlApplicationConfigurationUpdate)
-> ReadS [SqlApplicationConfigurationUpdate]
-> ReadPrec SqlApplicationConfigurationUpdate
-> ReadPrec [SqlApplicationConfigurationUpdate]
-> Read SqlApplicationConfigurationUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SqlApplicationConfigurationUpdate]
$creadListPrec :: ReadPrec [SqlApplicationConfigurationUpdate]
readPrec :: ReadPrec SqlApplicationConfigurationUpdate
$creadPrec :: ReadPrec SqlApplicationConfigurationUpdate
readList :: ReadS [SqlApplicationConfigurationUpdate]
$creadList :: ReadS [SqlApplicationConfigurationUpdate]
readsPrec :: Int -> ReadS SqlApplicationConfigurationUpdate
$creadsPrec :: Int -> ReadS SqlApplicationConfigurationUpdate
Prelude.Read, Int -> SqlApplicationConfigurationUpdate -> ShowS
[SqlApplicationConfigurationUpdate] -> ShowS
SqlApplicationConfigurationUpdate -> String
(Int -> SqlApplicationConfigurationUpdate -> ShowS)
-> (SqlApplicationConfigurationUpdate -> String)
-> ([SqlApplicationConfigurationUpdate] -> ShowS)
-> Show SqlApplicationConfigurationUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SqlApplicationConfigurationUpdate] -> ShowS
$cshowList :: [SqlApplicationConfigurationUpdate] -> ShowS
show :: SqlApplicationConfigurationUpdate -> String
$cshow :: SqlApplicationConfigurationUpdate -> String
showsPrec :: Int -> SqlApplicationConfigurationUpdate -> ShowS
$cshowsPrec :: Int -> SqlApplicationConfigurationUpdate -> ShowS
Prelude.Show, (forall x.
 SqlApplicationConfigurationUpdate
 -> Rep SqlApplicationConfigurationUpdate x)
-> (forall x.
    Rep SqlApplicationConfigurationUpdate x
    -> SqlApplicationConfigurationUpdate)
-> Generic SqlApplicationConfigurationUpdate
forall x.
Rep SqlApplicationConfigurationUpdate x
-> SqlApplicationConfigurationUpdate
forall x.
SqlApplicationConfigurationUpdate
-> Rep SqlApplicationConfigurationUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SqlApplicationConfigurationUpdate x
-> SqlApplicationConfigurationUpdate
$cfrom :: forall x.
SqlApplicationConfigurationUpdate
-> Rep SqlApplicationConfigurationUpdate x
Prelude.Generic)

-- |
-- Create a value of 'SqlApplicationConfigurationUpdate' 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:
--
-- 'referenceDataSourceUpdates', 'sqlApplicationConfigurationUpdate_referenceDataSourceUpdates' - The array of ReferenceDataSourceUpdate objects describing the new
-- reference data sources used by the application.
--
-- 'inputUpdates', 'sqlApplicationConfigurationUpdate_inputUpdates' - The array of InputUpdate objects describing the new input streams used
-- by the application.
--
-- 'outputUpdates', 'sqlApplicationConfigurationUpdate_outputUpdates' - The array of OutputUpdate objects describing the new destination streams
-- used by the application.
newSqlApplicationConfigurationUpdate ::
  SqlApplicationConfigurationUpdate
newSqlApplicationConfigurationUpdate :: SqlApplicationConfigurationUpdate
newSqlApplicationConfigurationUpdate =
  SqlApplicationConfigurationUpdate' :: Maybe [ReferenceDataSourceUpdate]
-> Maybe [InputUpdate]
-> Maybe [OutputUpdate]
-> SqlApplicationConfigurationUpdate
SqlApplicationConfigurationUpdate'
    { $sel:referenceDataSourceUpdates:SqlApplicationConfigurationUpdate' :: Maybe [ReferenceDataSourceUpdate]
referenceDataSourceUpdates =
        Maybe [ReferenceDataSourceUpdate]
forall a. Maybe a
Prelude.Nothing,
      $sel:inputUpdates:SqlApplicationConfigurationUpdate' :: Maybe [InputUpdate]
inputUpdates = Maybe [InputUpdate]
forall a. Maybe a
Prelude.Nothing,
      $sel:outputUpdates:SqlApplicationConfigurationUpdate' :: Maybe [OutputUpdate]
outputUpdates = Maybe [OutputUpdate]
forall a. Maybe a
Prelude.Nothing
    }

-- | The array of ReferenceDataSourceUpdate objects describing the new
-- reference data sources used by the application.
sqlApplicationConfigurationUpdate_referenceDataSourceUpdates :: Lens.Lens' SqlApplicationConfigurationUpdate (Prelude.Maybe [ReferenceDataSourceUpdate])
sqlApplicationConfigurationUpdate_referenceDataSourceUpdates :: (Maybe [ReferenceDataSourceUpdate]
 -> f (Maybe [ReferenceDataSourceUpdate]))
-> SqlApplicationConfigurationUpdate
-> f SqlApplicationConfigurationUpdate
sqlApplicationConfigurationUpdate_referenceDataSourceUpdates = (SqlApplicationConfigurationUpdate
 -> Maybe [ReferenceDataSourceUpdate])
-> (SqlApplicationConfigurationUpdate
    -> Maybe [ReferenceDataSourceUpdate]
    -> SqlApplicationConfigurationUpdate)
-> Lens
     SqlApplicationConfigurationUpdate
     SqlApplicationConfigurationUpdate
     (Maybe [ReferenceDataSourceUpdate])
     (Maybe [ReferenceDataSourceUpdate])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SqlApplicationConfigurationUpdate' {Maybe [ReferenceDataSourceUpdate]
referenceDataSourceUpdates :: Maybe [ReferenceDataSourceUpdate]
$sel:referenceDataSourceUpdates:SqlApplicationConfigurationUpdate' :: SqlApplicationConfigurationUpdate
-> Maybe [ReferenceDataSourceUpdate]
referenceDataSourceUpdates} -> Maybe [ReferenceDataSourceUpdate]
referenceDataSourceUpdates) (\s :: SqlApplicationConfigurationUpdate
s@SqlApplicationConfigurationUpdate' {} Maybe [ReferenceDataSourceUpdate]
a -> SqlApplicationConfigurationUpdate
s {$sel:referenceDataSourceUpdates:SqlApplicationConfigurationUpdate' :: Maybe [ReferenceDataSourceUpdate]
referenceDataSourceUpdates = Maybe [ReferenceDataSourceUpdate]
a} :: SqlApplicationConfigurationUpdate) ((Maybe [ReferenceDataSourceUpdate]
  -> f (Maybe [ReferenceDataSourceUpdate]))
 -> SqlApplicationConfigurationUpdate
 -> f SqlApplicationConfigurationUpdate)
-> ((Maybe [ReferenceDataSourceUpdate]
     -> f (Maybe [ReferenceDataSourceUpdate]))
    -> Maybe [ReferenceDataSourceUpdate]
    -> f (Maybe [ReferenceDataSourceUpdate]))
-> (Maybe [ReferenceDataSourceUpdate]
    -> f (Maybe [ReferenceDataSourceUpdate]))
-> SqlApplicationConfigurationUpdate
-> f SqlApplicationConfigurationUpdate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ReferenceDataSourceUpdate]
  [ReferenceDataSourceUpdate]
  [ReferenceDataSourceUpdate]
  [ReferenceDataSourceUpdate]
-> Iso
     (Maybe [ReferenceDataSourceUpdate])
     (Maybe [ReferenceDataSourceUpdate])
     (Maybe [ReferenceDataSourceUpdate])
     (Maybe [ReferenceDataSourceUpdate])
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
  [ReferenceDataSourceUpdate]
  [ReferenceDataSourceUpdate]
  [ReferenceDataSourceUpdate]
  [ReferenceDataSourceUpdate]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The array of InputUpdate objects describing the new input streams used
-- by the application.
sqlApplicationConfigurationUpdate_inputUpdates :: Lens.Lens' SqlApplicationConfigurationUpdate (Prelude.Maybe [InputUpdate])
sqlApplicationConfigurationUpdate_inputUpdates :: (Maybe [InputUpdate] -> f (Maybe [InputUpdate]))
-> SqlApplicationConfigurationUpdate
-> f SqlApplicationConfigurationUpdate
sqlApplicationConfigurationUpdate_inputUpdates = (SqlApplicationConfigurationUpdate -> Maybe [InputUpdate])
-> (SqlApplicationConfigurationUpdate
    -> Maybe [InputUpdate] -> SqlApplicationConfigurationUpdate)
-> Lens
     SqlApplicationConfigurationUpdate
     SqlApplicationConfigurationUpdate
     (Maybe [InputUpdate])
     (Maybe [InputUpdate])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SqlApplicationConfigurationUpdate' {Maybe [InputUpdate]
inputUpdates :: Maybe [InputUpdate]
$sel:inputUpdates:SqlApplicationConfigurationUpdate' :: SqlApplicationConfigurationUpdate -> Maybe [InputUpdate]
inputUpdates} -> Maybe [InputUpdate]
inputUpdates) (\s :: SqlApplicationConfigurationUpdate
s@SqlApplicationConfigurationUpdate' {} Maybe [InputUpdate]
a -> SqlApplicationConfigurationUpdate
s {$sel:inputUpdates:SqlApplicationConfigurationUpdate' :: Maybe [InputUpdate]
inputUpdates = Maybe [InputUpdate]
a} :: SqlApplicationConfigurationUpdate) ((Maybe [InputUpdate] -> f (Maybe [InputUpdate]))
 -> SqlApplicationConfigurationUpdate
 -> f SqlApplicationConfigurationUpdate)
-> ((Maybe [InputUpdate] -> f (Maybe [InputUpdate]))
    -> Maybe [InputUpdate] -> f (Maybe [InputUpdate]))
-> (Maybe [InputUpdate] -> f (Maybe [InputUpdate]))
-> SqlApplicationConfigurationUpdate
-> f SqlApplicationConfigurationUpdate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [InputUpdate] [InputUpdate] [InputUpdate] [InputUpdate]
-> Iso
     (Maybe [InputUpdate])
     (Maybe [InputUpdate])
     (Maybe [InputUpdate])
     (Maybe [InputUpdate])
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 [InputUpdate] [InputUpdate] [InputUpdate] [InputUpdate]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The array of OutputUpdate objects describing the new destination streams
-- used by the application.
sqlApplicationConfigurationUpdate_outputUpdates :: Lens.Lens' SqlApplicationConfigurationUpdate (Prelude.Maybe [OutputUpdate])
sqlApplicationConfigurationUpdate_outputUpdates :: (Maybe [OutputUpdate] -> f (Maybe [OutputUpdate]))
-> SqlApplicationConfigurationUpdate
-> f SqlApplicationConfigurationUpdate
sqlApplicationConfigurationUpdate_outputUpdates = (SqlApplicationConfigurationUpdate -> Maybe [OutputUpdate])
-> (SqlApplicationConfigurationUpdate
    -> Maybe [OutputUpdate] -> SqlApplicationConfigurationUpdate)
-> Lens
     SqlApplicationConfigurationUpdate
     SqlApplicationConfigurationUpdate
     (Maybe [OutputUpdate])
     (Maybe [OutputUpdate])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SqlApplicationConfigurationUpdate' {Maybe [OutputUpdate]
outputUpdates :: Maybe [OutputUpdate]
$sel:outputUpdates:SqlApplicationConfigurationUpdate' :: SqlApplicationConfigurationUpdate -> Maybe [OutputUpdate]
outputUpdates} -> Maybe [OutputUpdate]
outputUpdates) (\s :: SqlApplicationConfigurationUpdate
s@SqlApplicationConfigurationUpdate' {} Maybe [OutputUpdate]
a -> SqlApplicationConfigurationUpdate
s {$sel:outputUpdates:SqlApplicationConfigurationUpdate' :: Maybe [OutputUpdate]
outputUpdates = Maybe [OutputUpdate]
a} :: SqlApplicationConfigurationUpdate) ((Maybe [OutputUpdate] -> f (Maybe [OutputUpdate]))
 -> SqlApplicationConfigurationUpdate
 -> f SqlApplicationConfigurationUpdate)
-> ((Maybe [OutputUpdate] -> f (Maybe [OutputUpdate]))
    -> Maybe [OutputUpdate] -> f (Maybe [OutputUpdate]))
-> (Maybe [OutputUpdate] -> f (Maybe [OutputUpdate]))
-> SqlApplicationConfigurationUpdate
-> f SqlApplicationConfigurationUpdate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [OutputUpdate] [OutputUpdate] [OutputUpdate] [OutputUpdate]
-> Iso
     (Maybe [OutputUpdate])
     (Maybe [OutputUpdate])
     (Maybe [OutputUpdate])
     (Maybe [OutputUpdate])
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 [OutputUpdate] [OutputUpdate] [OutputUpdate] [OutputUpdate]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.Hashable
    SqlApplicationConfigurationUpdate

instance
  Prelude.NFData
    SqlApplicationConfigurationUpdate

instance
  Core.ToJSON
    SqlApplicationConfigurationUpdate
  where
  toJSON :: SqlApplicationConfigurationUpdate -> Value
toJSON SqlApplicationConfigurationUpdate' {Maybe [InputUpdate]
Maybe [OutputUpdate]
Maybe [ReferenceDataSourceUpdate]
outputUpdates :: Maybe [OutputUpdate]
inputUpdates :: Maybe [InputUpdate]
referenceDataSourceUpdates :: Maybe [ReferenceDataSourceUpdate]
$sel:outputUpdates:SqlApplicationConfigurationUpdate' :: SqlApplicationConfigurationUpdate -> Maybe [OutputUpdate]
$sel:inputUpdates:SqlApplicationConfigurationUpdate' :: SqlApplicationConfigurationUpdate -> Maybe [InputUpdate]
$sel:referenceDataSourceUpdates:SqlApplicationConfigurationUpdate' :: SqlApplicationConfigurationUpdate
-> Maybe [ReferenceDataSourceUpdate]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ReferenceDataSourceUpdates" Text -> [ReferenceDataSourceUpdate] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([ReferenceDataSourceUpdate] -> Pair)
-> Maybe [ReferenceDataSourceUpdate] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ReferenceDataSourceUpdate]
referenceDataSourceUpdates,
            (Text
"InputUpdates" Text -> [InputUpdate] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([InputUpdate] -> Pair) -> Maybe [InputUpdate] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [InputUpdate]
inputUpdates,
            (Text
"OutputUpdates" Text -> [OutputUpdate] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([OutputUpdate] -> Pair) -> Maybe [OutputUpdate] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [OutputUpdate]
outputUpdates
          ]
      )