{-# 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-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.NotificationChannel where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 api-video. 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 to 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
(NotificationChannel -> NotificationChannel -> Bool)
-> (NotificationChannel -> NotificationChannel -> Bool)
-> Eq NotificationChannel
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]
(Int -> ReadS NotificationChannel)
-> ReadS [NotificationChannel]
-> ReadPrec NotificationChannel
-> ReadPrec [NotificationChannel]
-> Read 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
(Int -> NotificationChannel -> ShowS)
-> (NotificationChannel -> String)
-> ([NotificationChannel] -> ShowS)
-> Show NotificationChannel
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. NotificationChannel -> Rep NotificationChannel x)
-> (forall x. Rep NotificationChannel x -> NotificationChannel)
-> Generic NotificationChannel
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 to 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' :: Text -> Text -> NotificationChannel
NotificationChannel'
    { $sel:sNSTopicArn:NotificationChannel' :: Text
sNSTopicArn = Text
pSNSTopicArn_,
      $sel:roleArn:NotificationChannel' :: Text
roleArn = Text
pRoleArn_
    }

-- | The Amazon SNS topic to which Amazon Rekognition to posts the completion
-- status.
notificationChannel_sNSTopicArn :: Lens.Lens' NotificationChannel Prelude.Text
notificationChannel_sNSTopicArn :: (Text -> f Text) -> NotificationChannel -> f NotificationChannel
notificationChannel_sNSTopicArn = (NotificationChannel -> Text)
-> (NotificationChannel -> Text -> NotificationChannel)
-> Lens NotificationChannel NotificationChannel Text Text
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 :: (Text -> f Text) -> NotificationChannel -> f NotificationChannel
notificationChannel_roleArn = (NotificationChannel -> Text)
-> (NotificationChannel -> Text -> NotificationChannel)
-> Lens NotificationChannel NotificationChannel Text Text
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

instance Prelude.NFData NotificationChannel

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SNSTopicArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sNSTopicArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"RoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn)
          ]
      )