{-# 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.StreamProcessorNotificationChannel
-- 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.StreamProcessorNotificationChannel 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

-- | The Amazon Simple Notification Service topic to which Amazon Rekognition
-- publishes the object detection results and completion status of a video
-- analysis operation.
--
-- Amazon Rekognition publishes a notification the first time an object of
-- interest or a person is detected in the video stream. For example, if
-- Amazon Rekognition detects a person at second 2, a pet at second 4, and
-- a person again at second 5, Amazon Rekognition sends 2 object class
-- detected notifications, one for a person at second 2 and one for a pet
-- at second 4.
--
-- Amazon Rekognition also publishes an an end-of-session notification with
-- a summary when the stream processing session is complete.
--
-- /See:/ 'newStreamProcessorNotificationChannel' smart constructor.
data StreamProcessorNotificationChannel = StreamProcessorNotificationChannel'
  { -- | The Amazon Resource Number (ARN) of the Amazon Amazon Simple
    -- Notification Service topic to which Amazon Rekognition posts the
    -- completion status.
    StreamProcessorNotificationChannel -> Text
sNSTopicArn :: Prelude.Text
  }
  deriving (StreamProcessorNotificationChannel
-> StreamProcessorNotificationChannel -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StreamProcessorNotificationChannel
-> StreamProcessorNotificationChannel -> Bool
$c/= :: StreamProcessorNotificationChannel
-> StreamProcessorNotificationChannel -> Bool
== :: StreamProcessorNotificationChannel
-> StreamProcessorNotificationChannel -> Bool
$c== :: StreamProcessorNotificationChannel
-> StreamProcessorNotificationChannel -> Bool
Prelude.Eq, ReadPrec [StreamProcessorNotificationChannel]
ReadPrec StreamProcessorNotificationChannel
Int -> ReadS StreamProcessorNotificationChannel
ReadS [StreamProcessorNotificationChannel]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StreamProcessorNotificationChannel]
$creadListPrec :: ReadPrec [StreamProcessorNotificationChannel]
readPrec :: ReadPrec StreamProcessorNotificationChannel
$creadPrec :: ReadPrec StreamProcessorNotificationChannel
readList :: ReadS [StreamProcessorNotificationChannel]
$creadList :: ReadS [StreamProcessorNotificationChannel]
readsPrec :: Int -> ReadS StreamProcessorNotificationChannel
$creadsPrec :: Int -> ReadS StreamProcessorNotificationChannel
Prelude.Read, Int -> StreamProcessorNotificationChannel -> ShowS
[StreamProcessorNotificationChannel] -> ShowS
StreamProcessorNotificationChannel -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StreamProcessorNotificationChannel] -> ShowS
$cshowList :: [StreamProcessorNotificationChannel] -> ShowS
show :: StreamProcessorNotificationChannel -> String
$cshow :: StreamProcessorNotificationChannel -> String
showsPrec :: Int -> StreamProcessorNotificationChannel -> ShowS
$cshowsPrec :: Int -> StreamProcessorNotificationChannel -> ShowS
Prelude.Show, forall x.
Rep StreamProcessorNotificationChannel x
-> StreamProcessorNotificationChannel
forall x.
StreamProcessorNotificationChannel
-> Rep StreamProcessorNotificationChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StreamProcessorNotificationChannel x
-> StreamProcessorNotificationChannel
$cfrom :: forall x.
StreamProcessorNotificationChannel
-> Rep StreamProcessorNotificationChannel x
Prelude.Generic)

-- |
-- Create a value of 'StreamProcessorNotificationChannel' 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:
--
-- 'sNSTopicArn', 'streamProcessorNotificationChannel_sNSTopicArn' - The Amazon Resource Number (ARN) of the Amazon Amazon Simple
-- Notification Service topic to which Amazon Rekognition posts the
-- completion status.
newStreamProcessorNotificationChannel ::
  -- | 'sNSTopicArn'
  Prelude.Text ->
  StreamProcessorNotificationChannel
newStreamProcessorNotificationChannel :: Text -> StreamProcessorNotificationChannel
newStreamProcessorNotificationChannel Text
pSNSTopicArn_ =
  StreamProcessorNotificationChannel'
    { $sel:sNSTopicArn:StreamProcessorNotificationChannel' :: Text
sNSTopicArn =
        Text
pSNSTopicArn_
    }

-- | The Amazon Resource Number (ARN) of the Amazon Amazon Simple
-- Notification Service topic to which Amazon Rekognition posts the
-- completion status.
streamProcessorNotificationChannel_sNSTopicArn :: Lens.Lens' StreamProcessorNotificationChannel Prelude.Text
streamProcessorNotificationChannel_sNSTopicArn :: Lens' StreamProcessorNotificationChannel Text
streamProcessorNotificationChannel_sNSTopicArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamProcessorNotificationChannel' {Text
sNSTopicArn :: Text
$sel:sNSTopicArn:StreamProcessorNotificationChannel' :: StreamProcessorNotificationChannel -> Text
sNSTopicArn} -> Text
sNSTopicArn) (\s :: StreamProcessorNotificationChannel
s@StreamProcessorNotificationChannel' {} Text
a -> StreamProcessorNotificationChannel
s {$sel:sNSTopicArn:StreamProcessorNotificationChannel' :: Text
sNSTopicArn = Text
a} :: StreamProcessorNotificationChannel)

instance
  Data.FromJSON
    StreamProcessorNotificationChannel
  where
  parseJSON :: Value -> Parser StreamProcessorNotificationChannel
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StreamProcessorNotificationChannel"
      ( \Object
x ->
          Text -> StreamProcessorNotificationChannel
StreamProcessorNotificationChannel'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"SNSTopicArn")
      )

instance
  Prelude.Hashable
    StreamProcessorNotificationChannel
  where
  hashWithSalt :: Int -> StreamProcessorNotificationChannel -> Int
hashWithSalt
    Int
_salt
    StreamProcessorNotificationChannel' {Text
sNSTopicArn :: Text
$sel:sNSTopicArn:StreamProcessorNotificationChannel' :: StreamProcessorNotificationChannel -> Text
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sNSTopicArn

instance
  Prelude.NFData
    StreamProcessorNotificationChannel
  where
  rnf :: StreamProcessorNotificationChannel -> ()
rnf StreamProcessorNotificationChannel' {Text
sNSTopicArn :: Text
$sel:sNSTopicArn:StreamProcessorNotificationChannel' :: StreamProcessorNotificationChannel -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
sNSTopicArn

instance
  Data.ToJSON
    StreamProcessorNotificationChannel
  where
  toJSON :: StreamProcessorNotificationChannel -> Value
toJSON StreamProcessorNotificationChannel' {Text
sNSTopicArn :: Text
$sel:sNSTopicArn:StreamProcessorNotificationChannel' :: StreamProcessorNotificationChannel -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"SNSTopicArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
sNSTopicArn)]
      )