{-# 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.KinesisAnalytics.Types.ApplicationUpdate
-- 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.KinesisAnalytics.Types.ApplicationUpdate where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.KinesisAnalytics.Types.CloudWatchLoggingOptionUpdate
import Amazonka.KinesisAnalytics.Types.InputUpdate
import Amazonka.KinesisAnalytics.Types.OutputUpdate
import Amazonka.KinesisAnalytics.Types.ReferenceDataSourceUpdate
import qualified Amazonka.Prelude as Prelude

-- | Describes updates to apply to an existing Amazon Kinesis Analytics
-- application.
--
-- /See:/ 'newApplicationUpdate' smart constructor.
data ApplicationUpdate = ApplicationUpdate'
  { -- | Describes application code updates.
    ApplicationUpdate -> Maybe Text
applicationCodeUpdate :: Prelude.Maybe Prelude.Text,
    -- | Describes application CloudWatch logging option updates.
    ApplicationUpdate -> Maybe [CloudWatchLoggingOptionUpdate]
cloudWatchLoggingOptionUpdates :: Prelude.Maybe [CloudWatchLoggingOptionUpdate],
    -- | Describes application input configuration updates.
    ApplicationUpdate -> Maybe [InputUpdate]
inputUpdates :: Prelude.Maybe [InputUpdate],
    -- | Describes application output configuration updates.
    ApplicationUpdate -> Maybe [OutputUpdate]
outputUpdates :: Prelude.Maybe [OutputUpdate],
    -- | Describes application reference data source updates.
    ApplicationUpdate -> Maybe [ReferenceDataSourceUpdate]
referenceDataSourceUpdates :: Prelude.Maybe [ReferenceDataSourceUpdate]
  }
  deriving (ApplicationUpdate -> ApplicationUpdate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApplicationUpdate -> ApplicationUpdate -> Bool
$c/= :: ApplicationUpdate -> ApplicationUpdate -> Bool
== :: ApplicationUpdate -> ApplicationUpdate -> Bool
$c== :: ApplicationUpdate -> ApplicationUpdate -> Bool
Prelude.Eq, ReadPrec [ApplicationUpdate]
ReadPrec ApplicationUpdate
Int -> ReadS ApplicationUpdate
ReadS [ApplicationUpdate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApplicationUpdate]
$creadListPrec :: ReadPrec [ApplicationUpdate]
readPrec :: ReadPrec ApplicationUpdate
$creadPrec :: ReadPrec ApplicationUpdate
readList :: ReadS [ApplicationUpdate]
$creadList :: ReadS [ApplicationUpdate]
readsPrec :: Int -> ReadS ApplicationUpdate
$creadsPrec :: Int -> ReadS ApplicationUpdate
Prelude.Read, Int -> ApplicationUpdate -> ShowS
[ApplicationUpdate] -> ShowS
ApplicationUpdate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApplicationUpdate] -> ShowS
$cshowList :: [ApplicationUpdate] -> ShowS
show :: ApplicationUpdate -> String
$cshow :: ApplicationUpdate -> String
showsPrec :: Int -> ApplicationUpdate -> ShowS
$cshowsPrec :: Int -> ApplicationUpdate -> ShowS
Prelude.Show, forall x. Rep ApplicationUpdate x -> ApplicationUpdate
forall x. ApplicationUpdate -> Rep ApplicationUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ApplicationUpdate x -> ApplicationUpdate
$cfrom :: forall x. ApplicationUpdate -> Rep ApplicationUpdate x
Prelude.Generic)

-- |
-- Create a value of 'ApplicationUpdate' 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:
--
-- 'applicationCodeUpdate', 'applicationUpdate_applicationCodeUpdate' - Describes application code updates.
--
-- 'cloudWatchLoggingOptionUpdates', 'applicationUpdate_cloudWatchLoggingOptionUpdates' - Describes application CloudWatch logging option updates.
--
-- 'inputUpdates', 'applicationUpdate_inputUpdates' - Describes application input configuration updates.
--
-- 'outputUpdates', 'applicationUpdate_outputUpdates' - Describes application output configuration updates.
--
-- 'referenceDataSourceUpdates', 'applicationUpdate_referenceDataSourceUpdates' - Describes application reference data source updates.
newApplicationUpdate ::
  ApplicationUpdate
newApplicationUpdate :: ApplicationUpdate
newApplicationUpdate =
  ApplicationUpdate'
    { $sel:applicationCodeUpdate:ApplicationUpdate' :: Maybe Text
applicationCodeUpdate =
        forall a. Maybe a
Prelude.Nothing,
      $sel:cloudWatchLoggingOptionUpdates:ApplicationUpdate' :: Maybe [CloudWatchLoggingOptionUpdate]
cloudWatchLoggingOptionUpdates = forall a. Maybe a
Prelude.Nothing,
      $sel:inputUpdates:ApplicationUpdate' :: Maybe [InputUpdate]
inputUpdates = forall a. Maybe a
Prelude.Nothing,
      $sel:outputUpdates:ApplicationUpdate' :: Maybe [OutputUpdate]
outputUpdates = forall a. Maybe a
Prelude.Nothing,
      $sel:referenceDataSourceUpdates:ApplicationUpdate' :: Maybe [ReferenceDataSourceUpdate]
referenceDataSourceUpdates = forall a. Maybe a
Prelude.Nothing
    }

-- | Describes application code updates.
applicationUpdate_applicationCodeUpdate :: Lens.Lens' ApplicationUpdate (Prelude.Maybe Prelude.Text)
applicationUpdate_applicationCodeUpdate :: Lens' ApplicationUpdate (Maybe Text)
applicationUpdate_applicationCodeUpdate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationUpdate' {Maybe Text
applicationCodeUpdate :: Maybe Text
$sel:applicationCodeUpdate:ApplicationUpdate' :: ApplicationUpdate -> Maybe Text
applicationCodeUpdate} -> Maybe Text
applicationCodeUpdate) (\s :: ApplicationUpdate
s@ApplicationUpdate' {} Maybe Text
a -> ApplicationUpdate
s {$sel:applicationCodeUpdate:ApplicationUpdate' :: Maybe Text
applicationCodeUpdate = Maybe Text
a} :: ApplicationUpdate)

-- | Describes application CloudWatch logging option updates.
applicationUpdate_cloudWatchLoggingOptionUpdates :: Lens.Lens' ApplicationUpdate (Prelude.Maybe [CloudWatchLoggingOptionUpdate])
applicationUpdate_cloudWatchLoggingOptionUpdates :: Lens' ApplicationUpdate (Maybe [CloudWatchLoggingOptionUpdate])
applicationUpdate_cloudWatchLoggingOptionUpdates = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationUpdate' {Maybe [CloudWatchLoggingOptionUpdate]
cloudWatchLoggingOptionUpdates :: Maybe [CloudWatchLoggingOptionUpdate]
$sel:cloudWatchLoggingOptionUpdates:ApplicationUpdate' :: ApplicationUpdate -> Maybe [CloudWatchLoggingOptionUpdate]
cloudWatchLoggingOptionUpdates} -> Maybe [CloudWatchLoggingOptionUpdate]
cloudWatchLoggingOptionUpdates) (\s :: ApplicationUpdate
s@ApplicationUpdate' {} Maybe [CloudWatchLoggingOptionUpdate]
a -> ApplicationUpdate
s {$sel:cloudWatchLoggingOptionUpdates:ApplicationUpdate' :: Maybe [CloudWatchLoggingOptionUpdate]
cloudWatchLoggingOptionUpdates = Maybe [CloudWatchLoggingOptionUpdate]
a} :: ApplicationUpdate) 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

-- | Describes application input configuration updates.
applicationUpdate_inputUpdates :: Lens.Lens' ApplicationUpdate (Prelude.Maybe [InputUpdate])
applicationUpdate_inputUpdates :: Lens' ApplicationUpdate (Maybe [InputUpdate])
applicationUpdate_inputUpdates = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationUpdate' {Maybe [InputUpdate]
inputUpdates :: Maybe [InputUpdate]
$sel:inputUpdates:ApplicationUpdate' :: ApplicationUpdate -> Maybe [InputUpdate]
inputUpdates} -> Maybe [InputUpdate]
inputUpdates) (\s :: ApplicationUpdate
s@ApplicationUpdate' {} Maybe [InputUpdate]
a -> ApplicationUpdate
s {$sel:inputUpdates:ApplicationUpdate' :: Maybe [InputUpdate]
inputUpdates = Maybe [InputUpdate]
a} :: ApplicationUpdate) 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

-- | Describes application output configuration updates.
applicationUpdate_outputUpdates :: Lens.Lens' ApplicationUpdate (Prelude.Maybe [OutputUpdate])
applicationUpdate_outputUpdates :: Lens' ApplicationUpdate (Maybe [OutputUpdate])
applicationUpdate_outputUpdates = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationUpdate' {Maybe [OutputUpdate]
outputUpdates :: Maybe [OutputUpdate]
$sel:outputUpdates:ApplicationUpdate' :: ApplicationUpdate -> Maybe [OutputUpdate]
outputUpdates} -> Maybe [OutputUpdate]
outputUpdates) (\s :: ApplicationUpdate
s@ApplicationUpdate' {} Maybe [OutputUpdate]
a -> ApplicationUpdate
s {$sel:outputUpdates:ApplicationUpdate' :: Maybe [OutputUpdate]
outputUpdates = Maybe [OutputUpdate]
a} :: ApplicationUpdate) 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

-- | Describes application reference data source updates.
applicationUpdate_referenceDataSourceUpdates :: Lens.Lens' ApplicationUpdate (Prelude.Maybe [ReferenceDataSourceUpdate])
applicationUpdate_referenceDataSourceUpdates :: Lens' ApplicationUpdate (Maybe [ReferenceDataSourceUpdate])
applicationUpdate_referenceDataSourceUpdates = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationUpdate' {Maybe [ReferenceDataSourceUpdate]
referenceDataSourceUpdates :: Maybe [ReferenceDataSourceUpdate]
$sel:referenceDataSourceUpdates:ApplicationUpdate' :: ApplicationUpdate -> Maybe [ReferenceDataSourceUpdate]
referenceDataSourceUpdates} -> Maybe [ReferenceDataSourceUpdate]
referenceDataSourceUpdates) (\s :: ApplicationUpdate
s@ApplicationUpdate' {} Maybe [ReferenceDataSourceUpdate]
a -> ApplicationUpdate
s {$sel:referenceDataSourceUpdates:ApplicationUpdate' :: Maybe [ReferenceDataSourceUpdate]
referenceDataSourceUpdates = Maybe [ReferenceDataSourceUpdate]
a} :: ApplicationUpdate) 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 ApplicationUpdate where
  hashWithSalt :: Int -> ApplicationUpdate -> Int
hashWithSalt Int
_salt ApplicationUpdate' {Maybe [CloudWatchLoggingOptionUpdate]
Maybe [InputUpdate]
Maybe [OutputUpdate]
Maybe [ReferenceDataSourceUpdate]
Maybe Text
referenceDataSourceUpdates :: Maybe [ReferenceDataSourceUpdate]
outputUpdates :: Maybe [OutputUpdate]
inputUpdates :: Maybe [InputUpdate]
cloudWatchLoggingOptionUpdates :: Maybe [CloudWatchLoggingOptionUpdate]
applicationCodeUpdate :: Maybe Text
$sel:referenceDataSourceUpdates:ApplicationUpdate' :: ApplicationUpdate -> Maybe [ReferenceDataSourceUpdate]
$sel:outputUpdates:ApplicationUpdate' :: ApplicationUpdate -> Maybe [OutputUpdate]
$sel:inputUpdates:ApplicationUpdate' :: ApplicationUpdate -> Maybe [InputUpdate]
$sel:cloudWatchLoggingOptionUpdates:ApplicationUpdate' :: ApplicationUpdate -> Maybe [CloudWatchLoggingOptionUpdate]
$sel:applicationCodeUpdate:ApplicationUpdate' :: ApplicationUpdate -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
applicationCodeUpdate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [CloudWatchLoggingOptionUpdate]
cloudWatchLoggingOptionUpdates
      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 ApplicationUpdate where
  rnf :: ApplicationUpdate -> ()
rnf ApplicationUpdate' {Maybe [CloudWatchLoggingOptionUpdate]
Maybe [InputUpdate]
Maybe [OutputUpdate]
Maybe [ReferenceDataSourceUpdate]
Maybe Text
referenceDataSourceUpdates :: Maybe [ReferenceDataSourceUpdate]
outputUpdates :: Maybe [OutputUpdate]
inputUpdates :: Maybe [InputUpdate]
cloudWatchLoggingOptionUpdates :: Maybe [CloudWatchLoggingOptionUpdate]
applicationCodeUpdate :: Maybe Text
$sel:referenceDataSourceUpdates:ApplicationUpdate' :: ApplicationUpdate -> Maybe [ReferenceDataSourceUpdate]
$sel:outputUpdates:ApplicationUpdate' :: ApplicationUpdate -> Maybe [OutputUpdate]
$sel:inputUpdates:ApplicationUpdate' :: ApplicationUpdate -> Maybe [InputUpdate]
$sel:cloudWatchLoggingOptionUpdates:ApplicationUpdate' :: ApplicationUpdate -> Maybe [CloudWatchLoggingOptionUpdate]
$sel:applicationCodeUpdate:ApplicationUpdate' :: ApplicationUpdate -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
applicationCodeUpdate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [CloudWatchLoggingOptionUpdate]
cloudWatchLoggingOptionUpdates
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 ApplicationUpdate where
  toJSON :: ApplicationUpdate -> Value
toJSON ApplicationUpdate' {Maybe [CloudWatchLoggingOptionUpdate]
Maybe [InputUpdate]
Maybe [OutputUpdate]
Maybe [ReferenceDataSourceUpdate]
Maybe Text
referenceDataSourceUpdates :: Maybe [ReferenceDataSourceUpdate]
outputUpdates :: Maybe [OutputUpdate]
inputUpdates :: Maybe [InputUpdate]
cloudWatchLoggingOptionUpdates :: Maybe [CloudWatchLoggingOptionUpdate]
applicationCodeUpdate :: Maybe Text
$sel:referenceDataSourceUpdates:ApplicationUpdate' :: ApplicationUpdate -> Maybe [ReferenceDataSourceUpdate]
$sel:outputUpdates:ApplicationUpdate' :: ApplicationUpdate -> Maybe [OutputUpdate]
$sel:inputUpdates:ApplicationUpdate' :: ApplicationUpdate -> Maybe [InputUpdate]
$sel:cloudWatchLoggingOptionUpdates:ApplicationUpdate' :: ApplicationUpdate -> Maybe [CloudWatchLoggingOptionUpdate]
$sel:applicationCodeUpdate:ApplicationUpdate' :: ApplicationUpdate -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ApplicationCodeUpdate" 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 Text
applicationCodeUpdate,
            (Key
"CloudWatchLoggingOptionUpdates" 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 [CloudWatchLoggingOptionUpdate]
cloudWatchLoggingOptionUpdates,
            (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
          ]
      )