{-# 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.NotificationChannel
-- 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.NotificationChannel 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 completion status of a video analysis operation. For more
-- information, see
-- <https://docs.aws.amazon.com/rekognition/latest/dg/api-video.html Calling Amazon Rekognition Video operations>.
-- Note that the Amazon SNS topic must have a topic name that begins with
-- /AmazonRekognition/ if you are using the AmazonRekognitionServiceRole
-- permissions policy to access the topic. For more information, see
-- <https://docs.aws.amazon.com/rekognition/latest/dg/api-video-roles.html#api-video-roles-all-topics Giving access to multiple Amazon SNS topics>.
--
-- /See:/ 'newNotificationChannel' smart constructor.
data NotificationChannel = NotificationChannel'
  { -- | The Amazon SNS topic to which Amazon Rekognition posts the completion
    -- status.
    NotificationChannel -> Text
sNSTopicArn :: Prelude.Text,
    -- | The ARN of an IAM role that gives Amazon Rekognition publishing
    -- permissions to the Amazon SNS topic.
    NotificationChannel -> Text
roleArn :: Prelude.Text
  }
  deriving (NotificationChannel -> NotificationChannel -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NotificationChannel -> NotificationChannel -> Bool
$c/= :: NotificationChannel -> NotificationChannel -> Bool
== :: NotificationChannel -> NotificationChannel -> Bool
$c== :: NotificationChannel -> NotificationChannel -> Bool
Prelude.Eq, ReadPrec [NotificationChannel]
ReadPrec NotificationChannel
Int -> ReadS NotificationChannel
ReadS [NotificationChannel]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NotificationChannel]
$creadListPrec :: ReadPrec [NotificationChannel]
readPrec :: ReadPrec NotificationChannel
$creadPrec :: ReadPrec NotificationChannel
readList :: ReadS [NotificationChannel]
$creadList :: ReadS [NotificationChannel]
readsPrec :: Int -> ReadS NotificationChannel
$creadsPrec :: Int -> ReadS NotificationChannel
Prelude.Read, Int -> NotificationChannel -> ShowS
[NotificationChannel] -> ShowS
NotificationChannel -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NotificationChannel] -> ShowS
$cshowList :: [NotificationChannel] -> ShowS
show :: NotificationChannel -> String
$cshow :: NotificationChannel -> String
showsPrec :: Int -> NotificationChannel -> ShowS
$cshowsPrec :: Int -> NotificationChannel -> ShowS
Prelude.Show, forall x. Rep NotificationChannel x -> NotificationChannel
forall x. NotificationChannel -> Rep NotificationChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NotificationChannel x -> NotificationChannel
$cfrom :: forall x. NotificationChannel -> Rep NotificationChannel x
Prelude.Generic)

-- |
-- Create a value of 'NotificationChannel' 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', 'notificationChannel_sNSTopicArn' - The Amazon SNS topic to which Amazon Rekognition posts the completion
-- status.
--
-- 'roleArn', 'notificationChannel_roleArn' - The ARN of an IAM role that gives Amazon Rekognition publishing
-- permissions to the Amazon SNS topic.
newNotificationChannel ::
  -- | 'sNSTopicArn'
  Prelude.Text ->
  -- | 'roleArn'
  Prelude.Text ->
  NotificationChannel
newNotificationChannel :: Text -> Text -> NotificationChannel
newNotificationChannel Text
pSNSTopicArn_ Text
pRoleArn_ =
  NotificationChannel'
    { $sel:sNSTopicArn:NotificationChannel' :: Text
sNSTopicArn = Text
pSNSTopicArn_,
      $sel:roleArn:NotificationChannel' :: Text
roleArn = Text
pRoleArn_
    }

-- | The Amazon SNS topic to which Amazon Rekognition posts the completion
-- status.
notificationChannel_sNSTopicArn :: Lens.Lens' NotificationChannel Prelude.Text
notificationChannel_sNSTopicArn :: Lens' NotificationChannel Text
notificationChannel_sNSTopicArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotificationChannel' {Text
sNSTopicArn :: Text
$sel:sNSTopicArn:NotificationChannel' :: NotificationChannel -> Text
sNSTopicArn} -> Text
sNSTopicArn) (\s :: NotificationChannel
s@NotificationChannel' {} Text
a -> NotificationChannel
s {$sel:sNSTopicArn:NotificationChannel' :: Text
sNSTopicArn = Text
a} :: NotificationChannel)

-- | The ARN of an IAM role that gives Amazon Rekognition publishing
-- permissions to the Amazon SNS topic.
notificationChannel_roleArn :: Lens.Lens' NotificationChannel Prelude.Text
notificationChannel_roleArn :: Lens' NotificationChannel Text
notificationChannel_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotificationChannel' {Text
roleArn :: Text
$sel:roleArn:NotificationChannel' :: NotificationChannel -> Text
roleArn} -> Text
roleArn) (\s :: NotificationChannel
s@NotificationChannel' {} Text
a -> NotificationChannel
s {$sel:roleArn:NotificationChannel' :: Text
roleArn = Text
a} :: NotificationChannel)

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

instance Prelude.NFData NotificationChannel where
  rnf :: NotificationChannel -> ()
rnf NotificationChannel' {Text
roleArn :: Text
sNSTopicArn :: Text
$sel:roleArn:NotificationChannel' :: NotificationChannel -> Text
$sel:sNSTopicArn:NotificationChannel' :: NotificationChannel -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
sNSTopicArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
roleArn

instance Data.ToJSON NotificationChannel where
  toJSON :: NotificationChannel -> Value
toJSON NotificationChannel' {Text
roleArn :: Text
sNSTopicArn :: Text
$sel:roleArn:NotificationChannel' :: NotificationChannel -> Text
$sel:sNSTopicArn:NotificationChannel' :: NotificationChannel -> 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),
            forall a. a -> Maybe a
Prelude.Just (Key
"RoleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
roleArn)
          ]
      )