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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(SNSDestination -> SNSDestination -> Bool)
-> (SNSDestination -> SNSDestination -> Bool) -> Eq SNSDestination
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]
(Int -> ReadS SNSDestination)
-> ReadS [SNSDestination]
-> ReadPrec SNSDestination
-> ReadPrec [SNSDestination]
-> Read 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
(Int -> SNSDestination -> ShowS)
-> (SNSDestination -> String)
-> ([SNSDestination] -> ShowS)
-> Show SNSDestination
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. SNSDestination -> Rep SNSDestination x)
-> (forall x. Rep SNSDestination x -> SNSDestination)
-> Generic SNSDestination
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' :: Text -> SNSDestination
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 :: (Text -> f Text) -> SNSDestination -> f SNSDestination
sNSDestination_topicARN = (SNSDestination -> Text)
-> (SNSDestination -> Text -> SNSDestination)
-> Lens SNSDestination SNSDestination Text Text
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 Core.FromXML SNSDestination where
  parseXML :: [Node] -> Either String SNSDestination
parseXML [Node]
x =
    Text -> SNSDestination
SNSDestination' (Text -> SNSDestination)
-> Either String Text -> Either String SNSDestination
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"TopicARN")

instance Prelude.Hashable SNSDestination

instance Prelude.NFData SNSDestination

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