{-# 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.SES.Types.SNSDestination
-- 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.SES.Types.SNSDestination 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

-- | Contains the topic ARN associated with an Amazon Simple Notification
-- Service (Amazon SNS) event destination.
--
-- Event destinations, such as Amazon SNS, are associated with
-- configuration sets, which enable you to publish email sending events.
-- For information about using configuration sets, see the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/monitor-sending-activity.html Amazon SES Developer Guide>.
--
-- /See:/ 'newSNSDestination' smart constructor.
data SNSDestination = SNSDestination'
  { -- | The ARN of the Amazon SNS topic that email sending events will be
    -- published to. An example of an Amazon SNS topic ARN is
    -- @arn:aws:sns:us-west-2:123456789012:MyTopic@. For more information about
    -- Amazon SNS topics, see the
    -- <https://docs.aws.amazon.com/sns/latest/dg/CreateTopic.html Amazon SNS Developer Guide>.
    SNSDestination -> Text
topicARN :: Prelude.Text
  }
  deriving (SNSDestination -> SNSDestination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SNSDestination -> SNSDestination -> Bool
$c/= :: SNSDestination -> SNSDestination -> Bool
== :: SNSDestination -> SNSDestination -> Bool
$c== :: SNSDestination -> SNSDestination -> Bool
Prelude.Eq, ReadPrec [SNSDestination]
ReadPrec SNSDestination
Int -> ReadS SNSDestination
ReadS [SNSDestination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SNSDestination]
$creadListPrec :: ReadPrec [SNSDestination]
readPrec :: ReadPrec SNSDestination
$creadPrec :: ReadPrec SNSDestination
readList :: ReadS [SNSDestination]
$creadList :: ReadS [SNSDestination]
readsPrec :: Int -> ReadS SNSDestination
$creadsPrec :: Int -> ReadS SNSDestination
Prelude.Read, Int -> SNSDestination -> ShowS
[SNSDestination] -> ShowS
SNSDestination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SNSDestination] -> ShowS
$cshowList :: [SNSDestination] -> ShowS
show :: SNSDestination -> String
$cshow :: SNSDestination -> String
showsPrec :: Int -> SNSDestination -> ShowS
$cshowsPrec :: Int -> SNSDestination -> ShowS
Prelude.Show, forall x. Rep SNSDestination x -> SNSDestination
forall x. SNSDestination -> Rep SNSDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SNSDestination x -> SNSDestination
$cfrom :: forall x. SNSDestination -> Rep SNSDestination x
Prelude.Generic)

-- |
-- Create a value of 'SNSDestination' 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:
--
-- 'topicARN', 'sNSDestination_topicARN' - The ARN of the Amazon SNS topic that email sending events will be
-- published to. An example of an Amazon SNS topic ARN is
-- @arn:aws:sns:us-west-2:123456789012:MyTopic@. For more information about
-- Amazon SNS topics, see the
-- <https://docs.aws.amazon.com/sns/latest/dg/CreateTopic.html Amazon SNS Developer Guide>.
newSNSDestination ::
  -- | 'topicARN'
  Prelude.Text ->
  SNSDestination
newSNSDestination :: Text -> SNSDestination
newSNSDestination Text
pTopicARN_ =
  SNSDestination' {$sel:topicARN:SNSDestination' :: Text
topicARN = Text
pTopicARN_}

-- | The ARN of the Amazon SNS topic that email sending events will be
-- published to. An example of an Amazon SNS topic ARN is
-- @arn:aws:sns:us-west-2:123456789012:MyTopic@. For more information about
-- Amazon SNS topics, see the
-- <https://docs.aws.amazon.com/sns/latest/dg/CreateTopic.html Amazon SNS Developer Guide>.
sNSDestination_topicARN :: Lens.Lens' SNSDestination Prelude.Text
sNSDestination_topicARN :: Lens' SNSDestination Text
sNSDestination_topicARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SNSDestination' {Text
topicARN :: Text
$sel:topicARN:SNSDestination' :: SNSDestination -> Text
topicARN} -> Text
topicARN) (\s :: SNSDestination
s@SNSDestination' {} Text
a -> SNSDestination
s {$sel:topicARN:SNSDestination' :: Text
topicARN = Text
a} :: SNSDestination)

instance Data.FromXML SNSDestination where
  parseXML :: [Node] -> Either String SNSDestination
parseXML [Node]
x =
    Text -> SNSDestination
SNSDestination' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"TopicARN")

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

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

instance Data.ToQuery SNSDestination where
  toQuery :: SNSDestination -> QueryString
toQuery SNSDestination' {Text
topicARN :: Text
$sel:topicARN:SNSDestination' :: SNSDestination -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"TopicARN" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
topicARN]