{-# 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.OutputUpdate
-- 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.OutputUpdate 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.DestinationSchema
import Amazonka.KinesisAnalytics.Types.KinesisFirehoseOutputUpdate
import Amazonka.KinesisAnalytics.Types.KinesisStreamsOutputUpdate
import Amazonka.KinesisAnalytics.Types.LambdaOutputUpdate
import qualified Amazonka.Prelude as Prelude

-- | Describes updates to the output configuration identified by the
-- @OutputId@.
--
-- /See:/ 'newOutputUpdate' smart constructor.
data OutputUpdate = OutputUpdate'
  { -- | Describes the data format when records are written to the destination.
    -- For more information, see
    -- <https://docs.aws.amazon.com/kinesisanalytics/latest/dev/how-it-works-output.html Configuring Application Output>.
    OutputUpdate -> Maybe DestinationSchema
destinationSchemaUpdate :: Prelude.Maybe DestinationSchema,
    -- | Describes an Amazon Kinesis Firehose delivery stream as the destination
    -- for the output.
    OutputUpdate -> Maybe KinesisFirehoseOutputUpdate
kinesisFirehoseOutputUpdate :: Prelude.Maybe KinesisFirehoseOutputUpdate,
    -- | Describes an Amazon Kinesis stream as the destination for the output.
    OutputUpdate -> Maybe KinesisStreamsOutputUpdate
kinesisStreamsOutputUpdate :: Prelude.Maybe KinesisStreamsOutputUpdate,
    -- | Describes an AWS Lambda function as the destination for the output.
    OutputUpdate -> Maybe LambdaOutputUpdate
lambdaOutputUpdate :: Prelude.Maybe LambdaOutputUpdate,
    -- | If you want to specify a different in-application stream for this output
    -- configuration, use this field to specify the new in-application stream
    -- name.
    OutputUpdate -> Maybe Text
nameUpdate :: Prelude.Maybe Prelude.Text,
    -- | Identifies the specific output configuration that you want to update.
    OutputUpdate -> Text
outputId :: Prelude.Text
  }
  deriving (OutputUpdate -> OutputUpdate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputUpdate -> OutputUpdate -> Bool
$c/= :: OutputUpdate -> OutputUpdate -> Bool
== :: OutputUpdate -> OutputUpdate -> Bool
$c== :: OutputUpdate -> OutputUpdate -> Bool
Prelude.Eq, ReadPrec [OutputUpdate]
ReadPrec OutputUpdate
Int -> ReadS OutputUpdate
ReadS [OutputUpdate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutputUpdate]
$creadListPrec :: ReadPrec [OutputUpdate]
readPrec :: ReadPrec OutputUpdate
$creadPrec :: ReadPrec OutputUpdate
readList :: ReadS [OutputUpdate]
$creadList :: ReadS [OutputUpdate]
readsPrec :: Int -> ReadS OutputUpdate
$creadsPrec :: Int -> ReadS OutputUpdate
Prelude.Read, Int -> OutputUpdate -> ShowS
[OutputUpdate] -> ShowS
OutputUpdate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputUpdate] -> ShowS
$cshowList :: [OutputUpdate] -> ShowS
show :: OutputUpdate -> String
$cshow :: OutputUpdate -> String
showsPrec :: Int -> OutputUpdate -> ShowS
$cshowsPrec :: Int -> OutputUpdate -> ShowS
Prelude.Show, forall x. Rep OutputUpdate x -> OutputUpdate
forall x. OutputUpdate -> Rep OutputUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutputUpdate x -> OutputUpdate
$cfrom :: forall x. OutputUpdate -> Rep OutputUpdate x
Prelude.Generic)

-- |
-- Create a value of 'OutputUpdate' 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:
--
-- 'destinationSchemaUpdate', 'outputUpdate_destinationSchemaUpdate' - Describes the data format when records are written to the destination.
-- For more information, see
-- <https://docs.aws.amazon.com/kinesisanalytics/latest/dev/how-it-works-output.html Configuring Application Output>.
--
-- 'kinesisFirehoseOutputUpdate', 'outputUpdate_kinesisFirehoseOutputUpdate' - Describes an Amazon Kinesis Firehose delivery stream as the destination
-- for the output.
--
-- 'kinesisStreamsOutputUpdate', 'outputUpdate_kinesisStreamsOutputUpdate' - Describes an Amazon Kinesis stream as the destination for the output.
--
-- 'lambdaOutputUpdate', 'outputUpdate_lambdaOutputUpdate' - Describes an AWS Lambda function as the destination for the output.
--
-- 'nameUpdate', 'outputUpdate_nameUpdate' - If you want to specify a different in-application stream for this output
-- configuration, use this field to specify the new in-application stream
-- name.
--
-- 'outputId', 'outputUpdate_outputId' - Identifies the specific output configuration that you want to update.
newOutputUpdate ::
  -- | 'outputId'
  Prelude.Text ->
  OutputUpdate
newOutputUpdate :: Text -> OutputUpdate
newOutputUpdate Text
pOutputId_ =
  OutputUpdate'
    { $sel:destinationSchemaUpdate:OutputUpdate' :: Maybe DestinationSchema
destinationSchemaUpdate =
        forall a. Maybe a
Prelude.Nothing,
      $sel:kinesisFirehoseOutputUpdate:OutputUpdate' :: Maybe KinesisFirehoseOutputUpdate
kinesisFirehoseOutputUpdate = forall a. Maybe a
Prelude.Nothing,
      $sel:kinesisStreamsOutputUpdate:OutputUpdate' :: Maybe KinesisStreamsOutputUpdate
kinesisStreamsOutputUpdate = forall a. Maybe a
Prelude.Nothing,
      $sel:lambdaOutputUpdate:OutputUpdate' :: Maybe LambdaOutputUpdate
lambdaOutputUpdate = forall a. Maybe a
Prelude.Nothing,
      $sel:nameUpdate:OutputUpdate' :: Maybe Text
nameUpdate = forall a. Maybe a
Prelude.Nothing,
      $sel:outputId:OutputUpdate' :: Text
outputId = Text
pOutputId_
    }

-- | Describes the data format when records are written to the destination.
-- For more information, see
-- <https://docs.aws.amazon.com/kinesisanalytics/latest/dev/how-it-works-output.html Configuring Application Output>.
outputUpdate_destinationSchemaUpdate :: Lens.Lens' OutputUpdate (Prelude.Maybe DestinationSchema)
outputUpdate_destinationSchemaUpdate :: Lens' OutputUpdate (Maybe DestinationSchema)
outputUpdate_destinationSchemaUpdate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputUpdate' {Maybe DestinationSchema
destinationSchemaUpdate :: Maybe DestinationSchema
$sel:destinationSchemaUpdate:OutputUpdate' :: OutputUpdate -> Maybe DestinationSchema
destinationSchemaUpdate} -> Maybe DestinationSchema
destinationSchemaUpdate) (\s :: OutputUpdate
s@OutputUpdate' {} Maybe DestinationSchema
a -> OutputUpdate
s {$sel:destinationSchemaUpdate:OutputUpdate' :: Maybe DestinationSchema
destinationSchemaUpdate = Maybe DestinationSchema
a} :: OutputUpdate)

-- | Describes an Amazon Kinesis Firehose delivery stream as the destination
-- for the output.
outputUpdate_kinesisFirehoseOutputUpdate :: Lens.Lens' OutputUpdate (Prelude.Maybe KinesisFirehoseOutputUpdate)
outputUpdate_kinesisFirehoseOutputUpdate :: Lens' OutputUpdate (Maybe KinesisFirehoseOutputUpdate)
outputUpdate_kinesisFirehoseOutputUpdate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputUpdate' {Maybe KinesisFirehoseOutputUpdate
kinesisFirehoseOutputUpdate :: Maybe KinesisFirehoseOutputUpdate
$sel:kinesisFirehoseOutputUpdate:OutputUpdate' :: OutputUpdate -> Maybe KinesisFirehoseOutputUpdate
kinesisFirehoseOutputUpdate} -> Maybe KinesisFirehoseOutputUpdate
kinesisFirehoseOutputUpdate) (\s :: OutputUpdate
s@OutputUpdate' {} Maybe KinesisFirehoseOutputUpdate
a -> OutputUpdate
s {$sel:kinesisFirehoseOutputUpdate:OutputUpdate' :: Maybe KinesisFirehoseOutputUpdate
kinesisFirehoseOutputUpdate = Maybe KinesisFirehoseOutputUpdate
a} :: OutputUpdate)

-- | Describes an Amazon Kinesis stream as the destination for the output.
outputUpdate_kinesisStreamsOutputUpdate :: Lens.Lens' OutputUpdate (Prelude.Maybe KinesisStreamsOutputUpdate)
outputUpdate_kinesisStreamsOutputUpdate :: Lens' OutputUpdate (Maybe KinesisStreamsOutputUpdate)
outputUpdate_kinesisStreamsOutputUpdate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputUpdate' {Maybe KinesisStreamsOutputUpdate
kinesisStreamsOutputUpdate :: Maybe KinesisStreamsOutputUpdate
$sel:kinesisStreamsOutputUpdate:OutputUpdate' :: OutputUpdate -> Maybe KinesisStreamsOutputUpdate
kinesisStreamsOutputUpdate} -> Maybe KinesisStreamsOutputUpdate
kinesisStreamsOutputUpdate) (\s :: OutputUpdate
s@OutputUpdate' {} Maybe KinesisStreamsOutputUpdate
a -> OutputUpdate
s {$sel:kinesisStreamsOutputUpdate:OutputUpdate' :: Maybe KinesisStreamsOutputUpdate
kinesisStreamsOutputUpdate = Maybe KinesisStreamsOutputUpdate
a} :: OutputUpdate)

-- | Describes an AWS Lambda function as the destination for the output.
outputUpdate_lambdaOutputUpdate :: Lens.Lens' OutputUpdate (Prelude.Maybe LambdaOutputUpdate)
outputUpdate_lambdaOutputUpdate :: Lens' OutputUpdate (Maybe LambdaOutputUpdate)
outputUpdate_lambdaOutputUpdate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputUpdate' {Maybe LambdaOutputUpdate
lambdaOutputUpdate :: Maybe LambdaOutputUpdate
$sel:lambdaOutputUpdate:OutputUpdate' :: OutputUpdate -> Maybe LambdaOutputUpdate
lambdaOutputUpdate} -> Maybe LambdaOutputUpdate
lambdaOutputUpdate) (\s :: OutputUpdate
s@OutputUpdate' {} Maybe LambdaOutputUpdate
a -> OutputUpdate
s {$sel:lambdaOutputUpdate:OutputUpdate' :: Maybe LambdaOutputUpdate
lambdaOutputUpdate = Maybe LambdaOutputUpdate
a} :: OutputUpdate)

-- | If you want to specify a different in-application stream for this output
-- configuration, use this field to specify the new in-application stream
-- name.
outputUpdate_nameUpdate :: Lens.Lens' OutputUpdate (Prelude.Maybe Prelude.Text)
outputUpdate_nameUpdate :: Lens' OutputUpdate (Maybe Text)
outputUpdate_nameUpdate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputUpdate' {Maybe Text
nameUpdate :: Maybe Text
$sel:nameUpdate:OutputUpdate' :: OutputUpdate -> Maybe Text
nameUpdate} -> Maybe Text
nameUpdate) (\s :: OutputUpdate
s@OutputUpdate' {} Maybe Text
a -> OutputUpdate
s {$sel:nameUpdate:OutputUpdate' :: Maybe Text
nameUpdate = Maybe Text
a} :: OutputUpdate)

-- | Identifies the specific output configuration that you want to update.
outputUpdate_outputId :: Lens.Lens' OutputUpdate Prelude.Text
outputUpdate_outputId :: Lens' OutputUpdate Text
outputUpdate_outputId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputUpdate' {Text
outputId :: Text
$sel:outputId:OutputUpdate' :: OutputUpdate -> Text
outputId} -> Text
outputId) (\s :: OutputUpdate
s@OutputUpdate' {} Text
a -> OutputUpdate
s {$sel:outputId:OutputUpdate' :: Text
outputId = Text
a} :: OutputUpdate)

instance Prelude.Hashable OutputUpdate where
  hashWithSalt :: Int -> OutputUpdate -> Int
hashWithSalt Int
_salt OutputUpdate' {Maybe Text
Maybe KinesisFirehoseOutputUpdate
Maybe KinesisStreamsOutputUpdate
Maybe LambdaOutputUpdate
Maybe DestinationSchema
Text
outputId :: Text
nameUpdate :: Maybe Text
lambdaOutputUpdate :: Maybe LambdaOutputUpdate
kinesisStreamsOutputUpdate :: Maybe KinesisStreamsOutputUpdate
kinesisFirehoseOutputUpdate :: Maybe KinesisFirehoseOutputUpdate
destinationSchemaUpdate :: Maybe DestinationSchema
$sel:outputId:OutputUpdate' :: OutputUpdate -> Text
$sel:nameUpdate:OutputUpdate' :: OutputUpdate -> Maybe Text
$sel:lambdaOutputUpdate:OutputUpdate' :: OutputUpdate -> Maybe LambdaOutputUpdate
$sel:kinesisStreamsOutputUpdate:OutputUpdate' :: OutputUpdate -> Maybe KinesisStreamsOutputUpdate
$sel:kinesisFirehoseOutputUpdate:OutputUpdate' :: OutputUpdate -> Maybe KinesisFirehoseOutputUpdate
$sel:destinationSchemaUpdate:OutputUpdate' :: OutputUpdate -> Maybe DestinationSchema
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DestinationSchema
destinationSchemaUpdate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe KinesisFirehoseOutputUpdate
kinesisFirehoseOutputUpdate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe KinesisStreamsOutputUpdate
kinesisStreamsOutputUpdate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LambdaOutputUpdate
lambdaOutputUpdate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nameUpdate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
outputId

instance Prelude.NFData OutputUpdate where
  rnf :: OutputUpdate -> ()
rnf OutputUpdate' {Maybe Text
Maybe KinesisFirehoseOutputUpdate
Maybe KinesisStreamsOutputUpdate
Maybe LambdaOutputUpdate
Maybe DestinationSchema
Text
outputId :: Text
nameUpdate :: Maybe Text
lambdaOutputUpdate :: Maybe LambdaOutputUpdate
kinesisStreamsOutputUpdate :: Maybe KinesisStreamsOutputUpdate
kinesisFirehoseOutputUpdate :: Maybe KinesisFirehoseOutputUpdate
destinationSchemaUpdate :: Maybe DestinationSchema
$sel:outputId:OutputUpdate' :: OutputUpdate -> Text
$sel:nameUpdate:OutputUpdate' :: OutputUpdate -> Maybe Text
$sel:lambdaOutputUpdate:OutputUpdate' :: OutputUpdate -> Maybe LambdaOutputUpdate
$sel:kinesisStreamsOutputUpdate:OutputUpdate' :: OutputUpdate -> Maybe KinesisStreamsOutputUpdate
$sel:kinesisFirehoseOutputUpdate:OutputUpdate' :: OutputUpdate -> Maybe KinesisFirehoseOutputUpdate
$sel:destinationSchemaUpdate:OutputUpdate' :: OutputUpdate -> Maybe DestinationSchema
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe DestinationSchema
destinationSchemaUpdate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe KinesisFirehoseOutputUpdate
kinesisFirehoseOutputUpdate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe KinesisStreamsOutputUpdate
kinesisStreamsOutputUpdate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LambdaOutputUpdate
lambdaOutputUpdate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nameUpdate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
outputId

instance Data.ToJSON OutputUpdate where
  toJSON :: OutputUpdate -> Value
toJSON OutputUpdate' {Maybe Text
Maybe KinesisFirehoseOutputUpdate
Maybe KinesisStreamsOutputUpdate
Maybe LambdaOutputUpdate
Maybe DestinationSchema
Text
outputId :: Text
nameUpdate :: Maybe Text
lambdaOutputUpdate :: Maybe LambdaOutputUpdate
kinesisStreamsOutputUpdate :: Maybe KinesisStreamsOutputUpdate
kinesisFirehoseOutputUpdate :: Maybe KinesisFirehoseOutputUpdate
destinationSchemaUpdate :: Maybe DestinationSchema
$sel:outputId:OutputUpdate' :: OutputUpdate -> Text
$sel:nameUpdate:OutputUpdate' :: OutputUpdate -> Maybe Text
$sel:lambdaOutputUpdate:OutputUpdate' :: OutputUpdate -> Maybe LambdaOutputUpdate
$sel:kinesisStreamsOutputUpdate:OutputUpdate' :: OutputUpdate -> Maybe KinesisStreamsOutputUpdate
$sel:kinesisFirehoseOutputUpdate:OutputUpdate' :: OutputUpdate -> Maybe KinesisFirehoseOutputUpdate
$sel:destinationSchemaUpdate:OutputUpdate' :: OutputUpdate -> Maybe DestinationSchema
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"DestinationSchemaUpdate" 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 DestinationSchema
destinationSchemaUpdate,
            (Key
"KinesisFirehoseOutputUpdate" 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 KinesisFirehoseOutputUpdate
kinesisFirehoseOutputUpdate,
            (Key
"KinesisStreamsOutputUpdate" 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 KinesisStreamsOutputUpdate
kinesisStreamsOutputUpdate,
            (Key
"LambdaOutputUpdate" 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 LambdaOutputUpdate
lambdaOutputUpdate,
            (Key
"NameUpdate" 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
nameUpdate,
            forall a. a -> Maybe a
Prelude.Just (Key
"OutputId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
outputId)
          ]
      )