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

import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalytics.Types.DestinationSchema
import Amazonka.KinesisAnalytics.Types.KinesisFirehoseOutputDescription
import Amazonka.KinesisAnalytics.Types.KinesisStreamsOutputDescription
import Amazonka.KinesisAnalytics.Types.LambdaOutputDescription
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes the application output configuration, which includes the
-- in-application stream name and the destination where the stream data is
-- written. The destination can be an Amazon Kinesis stream or an Amazon
-- Kinesis Firehose delivery stream.
--
-- /See:/ 'newOutputDescription' smart constructor.
data OutputDescription = OutputDescription'
  { -- | A unique identifier for the output configuration.
    OutputDescription -> Maybe Text
outputId :: Prelude.Maybe Prelude.Text,
    -- | Data format used for writing data to the destination.
    OutputDescription -> Maybe DestinationSchema
destinationSchema :: Prelude.Maybe DestinationSchema,
    -- | Describes the Amazon Kinesis Firehose delivery stream configured as the
    -- destination where output is written.
    OutputDescription -> Maybe KinesisFirehoseOutputDescription
kinesisFirehoseOutputDescription :: Prelude.Maybe KinesisFirehoseOutputDescription,
    -- | Describes Amazon Kinesis stream configured as the destination where
    -- output is written.
    OutputDescription -> Maybe KinesisStreamsOutputDescription
kinesisStreamsOutputDescription :: Prelude.Maybe KinesisStreamsOutputDescription,
    -- | Name of the in-application stream configured as output.
    OutputDescription -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Describes the AWS Lambda function configured as the destination where
    -- output is written.
    OutputDescription -> Maybe LambdaOutputDescription
lambdaOutputDescription :: Prelude.Maybe LambdaOutputDescription
  }
  deriving (OutputDescription -> OutputDescription -> Bool
(OutputDescription -> OutputDescription -> Bool)
-> (OutputDescription -> OutputDescription -> Bool)
-> Eq OutputDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputDescription -> OutputDescription -> Bool
$c/= :: OutputDescription -> OutputDescription -> Bool
== :: OutputDescription -> OutputDescription -> Bool
$c== :: OutputDescription -> OutputDescription -> Bool
Prelude.Eq, ReadPrec [OutputDescription]
ReadPrec OutputDescription
Int -> ReadS OutputDescription
ReadS [OutputDescription]
(Int -> ReadS OutputDescription)
-> ReadS [OutputDescription]
-> ReadPrec OutputDescription
-> ReadPrec [OutputDescription]
-> Read OutputDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutputDescription]
$creadListPrec :: ReadPrec [OutputDescription]
readPrec :: ReadPrec OutputDescription
$creadPrec :: ReadPrec OutputDescription
readList :: ReadS [OutputDescription]
$creadList :: ReadS [OutputDescription]
readsPrec :: Int -> ReadS OutputDescription
$creadsPrec :: Int -> ReadS OutputDescription
Prelude.Read, Int -> OutputDescription -> ShowS
[OutputDescription] -> ShowS
OutputDescription -> String
(Int -> OutputDescription -> ShowS)
-> (OutputDescription -> String)
-> ([OutputDescription] -> ShowS)
-> Show OutputDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputDescription] -> ShowS
$cshowList :: [OutputDescription] -> ShowS
show :: OutputDescription -> String
$cshow :: OutputDescription -> String
showsPrec :: Int -> OutputDescription -> ShowS
$cshowsPrec :: Int -> OutputDescription -> ShowS
Prelude.Show, (forall x. OutputDescription -> Rep OutputDescription x)
-> (forall x. Rep OutputDescription x -> OutputDescription)
-> Generic OutputDescription
forall x. Rep OutputDescription x -> OutputDescription
forall x. OutputDescription -> Rep OutputDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutputDescription x -> OutputDescription
$cfrom :: forall x. OutputDescription -> Rep OutputDescription x
Prelude.Generic)

-- |
-- Create a value of 'OutputDescription' 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:
--
-- 'outputId', 'outputDescription_outputId' - A unique identifier for the output configuration.
--
-- 'destinationSchema', 'outputDescription_destinationSchema' - Data format used for writing data to the destination.
--
-- 'kinesisFirehoseOutputDescription', 'outputDescription_kinesisFirehoseOutputDescription' - Describes the Amazon Kinesis Firehose delivery stream configured as the
-- destination where output is written.
--
-- 'kinesisStreamsOutputDescription', 'outputDescription_kinesisStreamsOutputDescription' - Describes Amazon Kinesis stream configured as the destination where
-- output is written.
--
-- 'name', 'outputDescription_name' - Name of the in-application stream configured as output.
--
-- 'lambdaOutputDescription', 'outputDescription_lambdaOutputDescription' - Describes the AWS Lambda function configured as the destination where
-- output is written.
newOutputDescription ::
  OutputDescription
newOutputDescription :: OutputDescription
newOutputDescription =
  OutputDescription' :: Maybe Text
-> Maybe DestinationSchema
-> Maybe KinesisFirehoseOutputDescription
-> Maybe KinesisStreamsOutputDescription
-> Maybe Text
-> Maybe LambdaOutputDescription
-> OutputDescription
OutputDescription'
    { $sel:outputId:OutputDescription' :: Maybe Text
outputId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationSchema:OutputDescription' :: Maybe DestinationSchema
destinationSchema = Maybe DestinationSchema
forall a. Maybe a
Prelude.Nothing,
      $sel:kinesisFirehoseOutputDescription:OutputDescription' :: Maybe KinesisFirehoseOutputDescription
kinesisFirehoseOutputDescription = Maybe KinesisFirehoseOutputDescription
forall a. Maybe a
Prelude.Nothing,
      $sel:kinesisStreamsOutputDescription:OutputDescription' :: Maybe KinesisStreamsOutputDescription
kinesisStreamsOutputDescription = Maybe KinesisStreamsOutputDescription
forall a. Maybe a
Prelude.Nothing,
      $sel:name:OutputDescription' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lambdaOutputDescription:OutputDescription' :: Maybe LambdaOutputDescription
lambdaOutputDescription = Maybe LambdaOutputDescription
forall a. Maybe a
Prelude.Nothing
    }

-- | A unique identifier for the output configuration.
outputDescription_outputId :: Lens.Lens' OutputDescription (Prelude.Maybe Prelude.Text)
outputDescription_outputId :: (Maybe Text -> f (Maybe Text))
-> OutputDescription -> f OutputDescription
outputDescription_outputId = (OutputDescription -> Maybe Text)
-> (OutputDescription -> Maybe Text -> OutputDescription)
-> Lens
     OutputDescription OutputDescription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputDescription' {Maybe Text
outputId :: Maybe Text
$sel:outputId:OutputDescription' :: OutputDescription -> Maybe Text
outputId} -> Maybe Text
outputId) (\s :: OutputDescription
s@OutputDescription' {} Maybe Text
a -> OutputDescription
s {$sel:outputId:OutputDescription' :: Maybe Text
outputId = Maybe Text
a} :: OutputDescription)

-- | Data format used for writing data to the destination.
outputDescription_destinationSchema :: Lens.Lens' OutputDescription (Prelude.Maybe DestinationSchema)
outputDescription_destinationSchema :: (Maybe DestinationSchema -> f (Maybe DestinationSchema))
-> OutputDescription -> f OutputDescription
outputDescription_destinationSchema = (OutputDescription -> Maybe DestinationSchema)
-> (OutputDescription
    -> Maybe DestinationSchema -> OutputDescription)
-> Lens
     OutputDescription
     OutputDescription
     (Maybe DestinationSchema)
     (Maybe DestinationSchema)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputDescription' {Maybe DestinationSchema
destinationSchema :: Maybe DestinationSchema
$sel:destinationSchema:OutputDescription' :: OutputDescription -> Maybe DestinationSchema
destinationSchema} -> Maybe DestinationSchema
destinationSchema) (\s :: OutputDescription
s@OutputDescription' {} Maybe DestinationSchema
a -> OutputDescription
s {$sel:destinationSchema:OutputDescription' :: Maybe DestinationSchema
destinationSchema = Maybe DestinationSchema
a} :: OutputDescription)

-- | Describes the Amazon Kinesis Firehose delivery stream configured as the
-- destination where output is written.
outputDescription_kinesisFirehoseOutputDescription :: Lens.Lens' OutputDescription (Prelude.Maybe KinesisFirehoseOutputDescription)
outputDescription_kinesisFirehoseOutputDescription :: (Maybe KinesisFirehoseOutputDescription
 -> f (Maybe KinesisFirehoseOutputDescription))
-> OutputDescription -> f OutputDescription
outputDescription_kinesisFirehoseOutputDescription = (OutputDescription -> Maybe KinesisFirehoseOutputDescription)
-> (OutputDescription
    -> Maybe KinesisFirehoseOutputDescription -> OutputDescription)
-> Lens
     OutputDescription
     OutputDescription
     (Maybe KinesisFirehoseOutputDescription)
     (Maybe KinesisFirehoseOutputDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputDescription' {Maybe KinesisFirehoseOutputDescription
kinesisFirehoseOutputDescription :: Maybe KinesisFirehoseOutputDescription
$sel:kinesisFirehoseOutputDescription:OutputDescription' :: OutputDescription -> Maybe KinesisFirehoseOutputDescription
kinesisFirehoseOutputDescription} -> Maybe KinesisFirehoseOutputDescription
kinesisFirehoseOutputDescription) (\s :: OutputDescription
s@OutputDescription' {} Maybe KinesisFirehoseOutputDescription
a -> OutputDescription
s {$sel:kinesisFirehoseOutputDescription:OutputDescription' :: Maybe KinesisFirehoseOutputDescription
kinesisFirehoseOutputDescription = Maybe KinesisFirehoseOutputDescription
a} :: OutputDescription)

-- | Describes Amazon Kinesis stream configured as the destination where
-- output is written.
outputDescription_kinesisStreamsOutputDescription :: Lens.Lens' OutputDescription (Prelude.Maybe KinesisStreamsOutputDescription)
outputDescription_kinesisStreamsOutputDescription :: (Maybe KinesisStreamsOutputDescription
 -> f (Maybe KinesisStreamsOutputDescription))
-> OutputDescription -> f OutputDescription
outputDescription_kinesisStreamsOutputDescription = (OutputDescription -> Maybe KinesisStreamsOutputDescription)
-> (OutputDescription
    -> Maybe KinesisStreamsOutputDescription -> OutputDescription)
-> Lens
     OutputDescription
     OutputDescription
     (Maybe KinesisStreamsOutputDescription)
     (Maybe KinesisStreamsOutputDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputDescription' {Maybe KinesisStreamsOutputDescription
kinesisStreamsOutputDescription :: Maybe KinesisStreamsOutputDescription
$sel:kinesisStreamsOutputDescription:OutputDescription' :: OutputDescription -> Maybe KinesisStreamsOutputDescription
kinesisStreamsOutputDescription} -> Maybe KinesisStreamsOutputDescription
kinesisStreamsOutputDescription) (\s :: OutputDescription
s@OutputDescription' {} Maybe KinesisStreamsOutputDescription
a -> OutputDescription
s {$sel:kinesisStreamsOutputDescription:OutputDescription' :: Maybe KinesisStreamsOutputDescription
kinesisStreamsOutputDescription = Maybe KinesisStreamsOutputDescription
a} :: OutputDescription)

-- | Name of the in-application stream configured as output.
outputDescription_name :: Lens.Lens' OutputDescription (Prelude.Maybe Prelude.Text)
outputDescription_name :: (Maybe Text -> f (Maybe Text))
-> OutputDescription -> f OutputDescription
outputDescription_name = (OutputDescription -> Maybe Text)
-> (OutputDescription -> Maybe Text -> OutputDescription)
-> Lens
     OutputDescription OutputDescription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputDescription' {Maybe Text
name :: Maybe Text
$sel:name:OutputDescription' :: OutputDescription -> Maybe Text
name} -> Maybe Text
name) (\s :: OutputDescription
s@OutputDescription' {} Maybe Text
a -> OutputDescription
s {$sel:name:OutputDescription' :: Maybe Text
name = Maybe Text
a} :: OutputDescription)

-- | Describes the AWS Lambda function configured as the destination where
-- output is written.
outputDescription_lambdaOutputDescription :: Lens.Lens' OutputDescription (Prelude.Maybe LambdaOutputDescription)
outputDescription_lambdaOutputDescription :: (Maybe LambdaOutputDescription
 -> f (Maybe LambdaOutputDescription))
-> OutputDescription -> f OutputDescription
outputDescription_lambdaOutputDescription = (OutputDescription -> Maybe LambdaOutputDescription)
-> (OutputDescription
    -> Maybe LambdaOutputDescription -> OutputDescription)
-> Lens
     OutputDescription
     OutputDescription
     (Maybe LambdaOutputDescription)
     (Maybe LambdaOutputDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputDescription' {Maybe LambdaOutputDescription
lambdaOutputDescription :: Maybe LambdaOutputDescription
$sel:lambdaOutputDescription:OutputDescription' :: OutputDescription -> Maybe LambdaOutputDescription
lambdaOutputDescription} -> Maybe LambdaOutputDescription
lambdaOutputDescription) (\s :: OutputDescription
s@OutputDescription' {} Maybe LambdaOutputDescription
a -> OutputDescription
s {$sel:lambdaOutputDescription:OutputDescription' :: Maybe LambdaOutputDescription
lambdaOutputDescription = Maybe LambdaOutputDescription
a} :: OutputDescription)

instance Core.FromJSON OutputDescription where
  parseJSON :: Value -> Parser OutputDescription
parseJSON =
    String
-> (Object -> Parser OutputDescription)
-> Value
-> Parser OutputDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OutputDescription"
      ( \Object
x ->
          Maybe Text
-> Maybe DestinationSchema
-> Maybe KinesisFirehoseOutputDescription
-> Maybe KinesisStreamsOutputDescription
-> Maybe Text
-> Maybe LambdaOutputDescription
-> OutputDescription
OutputDescription'
            (Maybe Text
 -> Maybe DestinationSchema
 -> Maybe KinesisFirehoseOutputDescription
 -> Maybe KinesisStreamsOutputDescription
 -> Maybe Text
 -> Maybe LambdaOutputDescription
 -> OutputDescription)
-> Parser (Maybe Text)
-> Parser
     (Maybe DestinationSchema
      -> Maybe KinesisFirehoseOutputDescription
      -> Maybe KinesisStreamsOutputDescription
      -> Maybe Text
      -> Maybe LambdaOutputDescription
      -> OutputDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OutputId")
            Parser
  (Maybe DestinationSchema
   -> Maybe KinesisFirehoseOutputDescription
   -> Maybe KinesisStreamsOutputDescription
   -> Maybe Text
   -> Maybe LambdaOutputDescription
   -> OutputDescription)
-> Parser (Maybe DestinationSchema)
-> Parser
     (Maybe KinesisFirehoseOutputDescription
      -> Maybe KinesisStreamsOutputDescription
      -> Maybe Text
      -> Maybe LambdaOutputDescription
      -> OutputDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DestinationSchema)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DestinationSchema")
            Parser
  (Maybe KinesisFirehoseOutputDescription
   -> Maybe KinesisStreamsOutputDescription
   -> Maybe Text
   -> Maybe LambdaOutputDescription
   -> OutputDescription)
-> Parser (Maybe KinesisFirehoseOutputDescription)
-> Parser
     (Maybe KinesisStreamsOutputDescription
      -> Maybe Text
      -> Maybe LambdaOutputDescription
      -> OutputDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe KinesisFirehoseOutputDescription)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"KinesisFirehoseOutputDescription")
            Parser
  (Maybe KinesisStreamsOutputDescription
   -> Maybe Text
   -> Maybe LambdaOutputDescription
   -> OutputDescription)
-> Parser (Maybe KinesisStreamsOutputDescription)
-> Parser
     (Maybe Text -> Maybe LambdaOutputDescription -> OutputDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe KinesisStreamsOutputDescription)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"KinesisStreamsOutputDescription")
            Parser
  (Maybe Text -> Maybe LambdaOutputDescription -> OutputDescription)
-> Parser (Maybe Text)
-> Parser (Maybe LambdaOutputDescription -> OutputDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
            Parser (Maybe LambdaOutputDescription -> OutputDescription)
-> Parser (Maybe LambdaOutputDescription)
-> Parser OutputDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LambdaOutputDescription)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LambdaOutputDescription")
      )

instance Prelude.Hashable OutputDescription

instance Prelude.NFData OutputDescription