{-# 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.Rekognition.Types.StreamProcessorOutput
-- 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.Rekognition.Types.StreamProcessorOutput where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.Rekognition.Types.KinesisDataStream
import Amazonka.Rekognition.Types.S3Destination

-- | Information about the Amazon Kinesis Data Streams stream to which a
-- Amazon Rekognition Video stream processor streams the results of a video
-- analysis. For more information, see CreateStreamProcessor in the Amazon
-- Rekognition Developer Guide.
--
-- /See:/ 'newStreamProcessorOutput' smart constructor.
data StreamProcessorOutput = StreamProcessorOutput'
  { -- | The Amazon Kinesis Data Streams stream to which the Amazon Rekognition
    -- stream processor streams the analysis results.
    StreamProcessorOutput -> Maybe KinesisDataStream
kinesisDataStream :: Prelude.Maybe KinesisDataStream,
    -- | The Amazon S3 bucket location to which Amazon Rekognition publishes the
    -- detailed inference results of a video analysis operation.
    StreamProcessorOutput -> Maybe S3Destination
s3Destination :: Prelude.Maybe S3Destination
  }
  deriving (StreamProcessorOutput -> StreamProcessorOutput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StreamProcessorOutput -> StreamProcessorOutput -> Bool
$c/= :: StreamProcessorOutput -> StreamProcessorOutput -> Bool
== :: StreamProcessorOutput -> StreamProcessorOutput -> Bool
$c== :: StreamProcessorOutput -> StreamProcessorOutput -> Bool
Prelude.Eq, ReadPrec [StreamProcessorOutput]
ReadPrec StreamProcessorOutput
Int -> ReadS StreamProcessorOutput
ReadS [StreamProcessorOutput]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StreamProcessorOutput]
$creadListPrec :: ReadPrec [StreamProcessorOutput]
readPrec :: ReadPrec StreamProcessorOutput
$creadPrec :: ReadPrec StreamProcessorOutput
readList :: ReadS [StreamProcessorOutput]
$creadList :: ReadS [StreamProcessorOutput]
readsPrec :: Int -> ReadS StreamProcessorOutput
$creadsPrec :: Int -> ReadS StreamProcessorOutput
Prelude.Read, Int -> StreamProcessorOutput -> ShowS
[StreamProcessorOutput] -> ShowS
StreamProcessorOutput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StreamProcessorOutput] -> ShowS
$cshowList :: [StreamProcessorOutput] -> ShowS
show :: StreamProcessorOutput -> String
$cshow :: StreamProcessorOutput -> String
showsPrec :: Int -> StreamProcessorOutput -> ShowS
$cshowsPrec :: Int -> StreamProcessorOutput -> ShowS
Prelude.Show, forall x. Rep StreamProcessorOutput x -> StreamProcessorOutput
forall x. StreamProcessorOutput -> Rep StreamProcessorOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StreamProcessorOutput x -> StreamProcessorOutput
$cfrom :: forall x. StreamProcessorOutput -> Rep StreamProcessorOutput x
Prelude.Generic)

-- |
-- Create a value of 'StreamProcessorOutput' 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:
--
-- 'kinesisDataStream', 'streamProcessorOutput_kinesisDataStream' - The Amazon Kinesis Data Streams stream to which the Amazon Rekognition
-- stream processor streams the analysis results.
--
-- 's3Destination', 'streamProcessorOutput_s3Destination' - The Amazon S3 bucket location to which Amazon Rekognition publishes the
-- detailed inference results of a video analysis operation.
newStreamProcessorOutput ::
  StreamProcessorOutput
newStreamProcessorOutput :: StreamProcessorOutput
newStreamProcessorOutput =
  StreamProcessorOutput'
    { $sel:kinesisDataStream:StreamProcessorOutput' :: Maybe KinesisDataStream
kinesisDataStream =
        forall a. Maybe a
Prelude.Nothing,
      $sel:s3Destination:StreamProcessorOutput' :: Maybe S3Destination
s3Destination = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Kinesis Data Streams stream to which the Amazon Rekognition
-- stream processor streams the analysis results.
streamProcessorOutput_kinesisDataStream :: Lens.Lens' StreamProcessorOutput (Prelude.Maybe KinesisDataStream)
streamProcessorOutput_kinesisDataStream :: Lens' StreamProcessorOutput (Maybe KinesisDataStream)
streamProcessorOutput_kinesisDataStream = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamProcessorOutput' {Maybe KinesisDataStream
kinesisDataStream :: Maybe KinesisDataStream
$sel:kinesisDataStream:StreamProcessorOutput' :: StreamProcessorOutput -> Maybe KinesisDataStream
kinesisDataStream} -> Maybe KinesisDataStream
kinesisDataStream) (\s :: StreamProcessorOutput
s@StreamProcessorOutput' {} Maybe KinesisDataStream
a -> StreamProcessorOutput
s {$sel:kinesisDataStream:StreamProcessorOutput' :: Maybe KinesisDataStream
kinesisDataStream = Maybe KinesisDataStream
a} :: StreamProcessorOutput)

-- | The Amazon S3 bucket location to which Amazon Rekognition publishes the
-- detailed inference results of a video analysis operation.
streamProcessorOutput_s3Destination :: Lens.Lens' StreamProcessorOutput (Prelude.Maybe S3Destination)
streamProcessorOutput_s3Destination :: Lens' StreamProcessorOutput (Maybe S3Destination)
streamProcessorOutput_s3Destination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamProcessorOutput' {Maybe S3Destination
s3Destination :: Maybe S3Destination
$sel:s3Destination:StreamProcessorOutput' :: StreamProcessorOutput -> Maybe S3Destination
s3Destination} -> Maybe S3Destination
s3Destination) (\s :: StreamProcessorOutput
s@StreamProcessorOutput' {} Maybe S3Destination
a -> StreamProcessorOutput
s {$sel:s3Destination:StreamProcessorOutput' :: Maybe S3Destination
s3Destination = Maybe S3Destination
a} :: StreamProcessorOutput)

instance Data.FromJSON StreamProcessorOutput where
  parseJSON :: Value -> Parser StreamProcessorOutput
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StreamProcessorOutput"
      ( \Object
x ->
          Maybe KinesisDataStream
-> Maybe S3Destination -> StreamProcessorOutput
StreamProcessorOutput'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"KinesisDataStream")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"S3Destination")
      )

instance Prelude.Hashable StreamProcessorOutput where
  hashWithSalt :: Int -> StreamProcessorOutput -> Int
hashWithSalt Int
_salt StreamProcessorOutput' {Maybe KinesisDataStream
Maybe S3Destination
s3Destination :: Maybe S3Destination
kinesisDataStream :: Maybe KinesisDataStream
$sel:s3Destination:StreamProcessorOutput' :: StreamProcessorOutput -> Maybe S3Destination
$sel:kinesisDataStream:StreamProcessorOutput' :: StreamProcessorOutput -> Maybe KinesisDataStream
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe KinesisDataStream
kinesisDataStream
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3Destination
s3Destination

instance Prelude.NFData StreamProcessorOutput where
  rnf :: StreamProcessorOutput -> ()
rnf StreamProcessorOutput' {Maybe KinesisDataStream
Maybe S3Destination
s3Destination :: Maybe S3Destination
kinesisDataStream :: Maybe KinesisDataStream
$sel:s3Destination:StreamProcessorOutput' :: StreamProcessorOutput -> Maybe S3Destination
$sel:kinesisDataStream:StreamProcessorOutput' :: StreamProcessorOutput -> Maybe KinesisDataStream
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe KinesisDataStream
kinesisDataStream
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe S3Destination
s3Destination

instance Data.ToJSON StreamProcessorOutput where
  toJSON :: StreamProcessorOutput -> Value
toJSON StreamProcessorOutput' {Maybe KinesisDataStream
Maybe S3Destination
s3Destination :: Maybe S3Destination
kinesisDataStream :: Maybe KinesisDataStream
$sel:s3Destination:StreamProcessorOutput' :: StreamProcessorOutput -> Maybe S3Destination
$sel:kinesisDataStream:StreamProcessorOutput' :: StreamProcessorOutput -> Maybe KinesisDataStream
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"KinesisDataStream" 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 KinesisDataStream
kinesisDataStream,
            (Key
"S3Destination" 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 S3Destination
s3Destination
          ]
      )