{-# 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-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.SqlApplicationConfigurationUpdate 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.InputUpdate
import Amazonka.KinesisAnalyticsV2.Types.OutputUpdate
import Amazonka.KinesisAnalyticsV2.Types.ReferenceDataSourceUpdate
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 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],
    -- | The array of ReferenceDataSourceUpdate objects describing the new
    -- reference data sources used by the application.
    SqlApplicationConfigurationUpdate
-> Maybe [ReferenceDataSourceUpdate]
referenceDataSourceUpdates :: Prelude.Maybe [ReferenceDataSourceUpdate]
  }
  deriving (SqlApplicationConfigurationUpdate
-> SqlApplicationConfigurationUpdate -> Bool
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]
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
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.
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:
--
-- '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.
--
-- 'referenceDataSourceUpdates', 'sqlApplicationConfigurationUpdate_referenceDataSourceUpdates' - The array of ReferenceDataSourceUpdate objects describing the new
-- reference data sources used by the application.
newSqlApplicationConfigurationUpdate ::
  SqlApplicationConfigurationUpdate
newSqlApplicationConfigurationUpdate :: SqlApplicationConfigurationUpdate
newSqlApplicationConfigurationUpdate =
  SqlApplicationConfigurationUpdate'
    { $sel:inputUpdates:SqlApplicationConfigurationUpdate' :: Maybe [InputUpdate]
inputUpdates =
        forall a. Maybe a
Prelude.Nothing,
      $sel:outputUpdates:SqlApplicationConfigurationUpdate' :: Maybe [OutputUpdate]
outputUpdates = forall a. Maybe a
Prelude.Nothing,
      $sel:referenceDataSourceUpdates:SqlApplicationConfigurationUpdate' :: Maybe [ReferenceDataSourceUpdate]
referenceDataSourceUpdates =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The array of InputUpdate objects describing the new input streams used
-- by the application.
sqlApplicationConfigurationUpdate_inputUpdates :: Lens.Lens' SqlApplicationConfigurationUpdate (Prelude.Maybe [InputUpdate])
sqlApplicationConfigurationUpdate_inputUpdates :: Lens' SqlApplicationConfigurationUpdate (Maybe [InputUpdate])
sqlApplicationConfigurationUpdate_inputUpdates = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' SqlApplicationConfigurationUpdate (Maybe [OutputUpdate])
sqlApplicationConfigurationUpdate_outputUpdates = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: Lens'
  SqlApplicationConfigurationUpdate
  (Maybe [ReferenceDataSourceUpdate])
sqlApplicationConfigurationUpdate_referenceDataSourceUpdates = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.Hashable
    SqlApplicationConfigurationUpdate
  where
  hashWithSalt :: Int -> SqlApplicationConfigurationUpdate -> Int
hashWithSalt
    Int
_salt
    SqlApplicationConfigurationUpdate' {Maybe [InputUpdate]
Maybe [OutputUpdate]
Maybe [ReferenceDataSourceUpdate]
referenceDataSourceUpdates :: Maybe [ReferenceDataSourceUpdate]
outputUpdates :: Maybe [OutputUpdate]
inputUpdates :: Maybe [InputUpdate]
$sel:referenceDataSourceUpdates:SqlApplicationConfigurationUpdate' :: SqlApplicationConfigurationUpdate
-> Maybe [ReferenceDataSourceUpdate]
$sel:outputUpdates:SqlApplicationConfigurationUpdate' :: SqlApplicationConfigurationUpdate -> Maybe [OutputUpdate]
$sel:inputUpdates:SqlApplicationConfigurationUpdate' :: SqlApplicationConfigurationUpdate -> Maybe [InputUpdate]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [InputUpdate]
inputUpdates
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [OutputUpdate]
outputUpdates
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ReferenceDataSourceUpdate]
referenceDataSourceUpdates

instance
  Prelude.NFData
    SqlApplicationConfigurationUpdate
  where
  rnf :: SqlApplicationConfigurationUpdate -> ()
rnf SqlApplicationConfigurationUpdate' {Maybe [InputUpdate]
Maybe [OutputUpdate]
Maybe [ReferenceDataSourceUpdate]
referenceDataSourceUpdates :: Maybe [ReferenceDataSourceUpdate]
outputUpdates :: Maybe [OutputUpdate]
inputUpdates :: Maybe [InputUpdate]
$sel:referenceDataSourceUpdates:SqlApplicationConfigurationUpdate' :: SqlApplicationConfigurationUpdate
-> Maybe [ReferenceDataSourceUpdate]
$sel:outputUpdates:SqlApplicationConfigurationUpdate' :: SqlApplicationConfigurationUpdate -> Maybe [OutputUpdate]
$sel:inputUpdates:SqlApplicationConfigurationUpdate' :: SqlApplicationConfigurationUpdate -> Maybe [InputUpdate]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [InputUpdate]
inputUpdates
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [OutputUpdate]
outputUpdates
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ReferenceDataSourceUpdate]
referenceDataSourceUpdates

instance
  Data.ToJSON
    SqlApplicationConfigurationUpdate
  where
  toJSON :: SqlApplicationConfigurationUpdate -> Value
toJSON SqlApplicationConfigurationUpdate' {Maybe [InputUpdate]
Maybe [OutputUpdate]
Maybe [ReferenceDataSourceUpdate]
referenceDataSourceUpdates :: Maybe [ReferenceDataSourceUpdate]
outputUpdates :: Maybe [OutputUpdate]
inputUpdates :: Maybe [InputUpdate]
$sel:referenceDataSourceUpdates:SqlApplicationConfigurationUpdate' :: SqlApplicationConfigurationUpdate
-> Maybe [ReferenceDataSourceUpdate]
$sel:outputUpdates:SqlApplicationConfigurationUpdate' :: SqlApplicationConfigurationUpdate -> Maybe [OutputUpdate]
$sel:inputUpdates:SqlApplicationConfigurationUpdate' :: SqlApplicationConfigurationUpdate -> Maybe [InputUpdate]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"InputUpdates" 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 [InputUpdate]
inputUpdates,
            (Key
"OutputUpdates" 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 [OutputUpdate]
outputUpdates,
            (Key
"ReferenceDataSourceUpdates" 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 [ReferenceDataSourceUpdate]
referenceDataSourceUpdates
          ]
      )