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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Rekognition.Types.KinesisDataStream

-- | 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
  }
  deriving (StreamProcessorOutput -> StreamProcessorOutput -> Bool
(StreamProcessorOutput -> StreamProcessorOutput -> Bool)
-> (StreamProcessorOutput -> StreamProcessorOutput -> Bool)
-> Eq StreamProcessorOutput
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]
(Int -> ReadS StreamProcessorOutput)
-> ReadS [StreamProcessorOutput]
-> ReadPrec StreamProcessorOutput
-> ReadPrec [StreamProcessorOutput]
-> Read 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
(Int -> StreamProcessorOutput -> ShowS)
-> (StreamProcessorOutput -> String)
-> ([StreamProcessorOutput] -> ShowS)
-> Show StreamProcessorOutput
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. StreamProcessorOutput -> Rep StreamProcessorOutput x)
-> (forall x. Rep StreamProcessorOutput x -> StreamProcessorOutput)
-> Generic StreamProcessorOutput
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.
newStreamProcessorOutput ::
  StreamProcessorOutput
newStreamProcessorOutput :: StreamProcessorOutput
newStreamProcessorOutput =
  StreamProcessorOutput' :: Maybe KinesisDataStream -> StreamProcessorOutput
StreamProcessorOutput'
    { $sel:kinesisDataStream:StreamProcessorOutput' :: Maybe KinesisDataStream
kinesisDataStream =
        Maybe KinesisDataStream
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 :: (Maybe KinesisDataStream -> f (Maybe KinesisDataStream))
-> StreamProcessorOutput -> f StreamProcessorOutput
streamProcessorOutput_kinesisDataStream = (StreamProcessorOutput -> Maybe KinesisDataStream)
-> (StreamProcessorOutput
    -> Maybe KinesisDataStream -> StreamProcessorOutput)
-> Lens
     StreamProcessorOutput
     StreamProcessorOutput
     (Maybe KinesisDataStream)
     (Maybe 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)

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

instance Prelude.Hashable StreamProcessorOutput

instance Prelude.NFData StreamProcessorOutput

instance Core.ToJSON StreamProcessorOutput where
  toJSON :: StreamProcessorOutput -> Value
toJSON StreamProcessorOutput' {Maybe KinesisDataStream
kinesisDataStream :: Maybe KinesisDataStream
$sel:kinesisDataStream:StreamProcessorOutput' :: StreamProcessorOutput -> Maybe KinesisDataStream
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"KinesisDataStream" Text -> KinesisDataStream -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (KinesisDataStream -> Pair)
-> Maybe KinesisDataStream -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe KinesisDataStream
kinesisDataStream
          ]
      )