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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains the delivery stream ARN and the IAM role ARN associated with an
-- Amazon Kinesis Firehose event destination.
--
-- Event destinations, such as Amazon Kinesis Firehose, 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:/ 'newKinesisFirehoseDestination' smart constructor.
data KinesisFirehoseDestination = KinesisFirehoseDestination'
  { -- | The ARN of the IAM role under which Amazon SES publishes email sending
    -- events to the Amazon Kinesis Firehose stream.
    KinesisFirehoseDestination -> Text
iAMRoleARN :: Prelude.Text,
    -- | The ARN of the Amazon Kinesis Firehose stream that email sending events
    -- should be published to.
    KinesisFirehoseDestination -> Text
deliveryStreamARN :: Prelude.Text
  }
  deriving (KinesisFirehoseDestination -> KinesisFirehoseDestination -> Bool
(KinesisFirehoseDestination -> KinesisFirehoseDestination -> Bool)
-> (KinesisFirehoseDestination
    -> KinesisFirehoseDestination -> Bool)
-> Eq KinesisFirehoseDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KinesisFirehoseDestination -> KinesisFirehoseDestination -> Bool
$c/= :: KinesisFirehoseDestination -> KinesisFirehoseDestination -> Bool
== :: KinesisFirehoseDestination -> KinesisFirehoseDestination -> Bool
$c== :: KinesisFirehoseDestination -> KinesisFirehoseDestination -> Bool
Prelude.Eq, ReadPrec [KinesisFirehoseDestination]
ReadPrec KinesisFirehoseDestination
Int -> ReadS KinesisFirehoseDestination
ReadS [KinesisFirehoseDestination]
(Int -> ReadS KinesisFirehoseDestination)
-> ReadS [KinesisFirehoseDestination]
-> ReadPrec KinesisFirehoseDestination
-> ReadPrec [KinesisFirehoseDestination]
-> Read KinesisFirehoseDestination
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KinesisFirehoseDestination]
$creadListPrec :: ReadPrec [KinesisFirehoseDestination]
readPrec :: ReadPrec KinesisFirehoseDestination
$creadPrec :: ReadPrec KinesisFirehoseDestination
readList :: ReadS [KinesisFirehoseDestination]
$creadList :: ReadS [KinesisFirehoseDestination]
readsPrec :: Int -> ReadS KinesisFirehoseDestination
$creadsPrec :: Int -> ReadS KinesisFirehoseDestination
Prelude.Read, Int -> KinesisFirehoseDestination -> ShowS
[KinesisFirehoseDestination] -> ShowS
KinesisFirehoseDestination -> String
(Int -> KinesisFirehoseDestination -> ShowS)
-> (KinesisFirehoseDestination -> String)
-> ([KinesisFirehoseDestination] -> ShowS)
-> Show KinesisFirehoseDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KinesisFirehoseDestination] -> ShowS
$cshowList :: [KinesisFirehoseDestination] -> ShowS
show :: KinesisFirehoseDestination -> String
$cshow :: KinesisFirehoseDestination -> String
showsPrec :: Int -> KinesisFirehoseDestination -> ShowS
$cshowsPrec :: Int -> KinesisFirehoseDestination -> ShowS
Prelude.Show, (forall x.
 KinesisFirehoseDestination -> Rep KinesisFirehoseDestination x)
-> (forall x.
    Rep KinesisFirehoseDestination x -> KinesisFirehoseDestination)
-> Generic KinesisFirehoseDestination
forall x.
Rep KinesisFirehoseDestination x -> KinesisFirehoseDestination
forall x.
KinesisFirehoseDestination -> Rep KinesisFirehoseDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep KinesisFirehoseDestination x -> KinesisFirehoseDestination
$cfrom :: forall x.
KinesisFirehoseDestination -> Rep KinesisFirehoseDestination x
Prelude.Generic)

-- |
-- Create a value of 'KinesisFirehoseDestination' 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:
--
-- 'iAMRoleARN', 'kinesisFirehoseDestination_iAMRoleARN' - The ARN of the IAM role under which Amazon SES publishes email sending
-- events to the Amazon Kinesis Firehose stream.
--
-- 'deliveryStreamARN', 'kinesisFirehoseDestination_deliveryStreamARN' - The ARN of the Amazon Kinesis Firehose stream that email sending events
-- should be published to.
newKinesisFirehoseDestination ::
  -- | 'iAMRoleARN'
  Prelude.Text ->
  -- | 'deliveryStreamARN'
  Prelude.Text ->
  KinesisFirehoseDestination
newKinesisFirehoseDestination :: Text -> Text -> KinesisFirehoseDestination
newKinesisFirehoseDestination
  Text
pIAMRoleARN_
  Text
pDeliveryStreamARN_ =
    KinesisFirehoseDestination' :: Text -> Text -> KinesisFirehoseDestination
KinesisFirehoseDestination'
      { $sel:iAMRoleARN:KinesisFirehoseDestination' :: Text
iAMRoleARN =
          Text
pIAMRoleARN_,
        $sel:deliveryStreamARN:KinesisFirehoseDestination' :: Text
deliveryStreamARN = Text
pDeliveryStreamARN_
      }

-- | The ARN of the IAM role under which Amazon SES publishes email sending
-- events to the Amazon Kinesis Firehose stream.
kinesisFirehoseDestination_iAMRoleARN :: Lens.Lens' KinesisFirehoseDestination Prelude.Text
kinesisFirehoseDestination_iAMRoleARN :: (Text -> f Text)
-> KinesisFirehoseDestination -> f KinesisFirehoseDestination
kinesisFirehoseDestination_iAMRoleARN = (KinesisFirehoseDestination -> Text)
-> (KinesisFirehoseDestination
    -> Text -> KinesisFirehoseDestination)
-> Lens
     KinesisFirehoseDestination KinesisFirehoseDestination Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KinesisFirehoseDestination' {Text
iAMRoleARN :: Text
$sel:iAMRoleARN:KinesisFirehoseDestination' :: KinesisFirehoseDestination -> Text
iAMRoleARN} -> Text
iAMRoleARN) (\s :: KinesisFirehoseDestination
s@KinesisFirehoseDestination' {} Text
a -> KinesisFirehoseDestination
s {$sel:iAMRoleARN:KinesisFirehoseDestination' :: Text
iAMRoleARN = Text
a} :: KinesisFirehoseDestination)

-- | The ARN of the Amazon Kinesis Firehose stream that email sending events
-- should be published to.
kinesisFirehoseDestination_deliveryStreamARN :: Lens.Lens' KinesisFirehoseDestination Prelude.Text
kinesisFirehoseDestination_deliveryStreamARN :: (Text -> f Text)
-> KinesisFirehoseDestination -> f KinesisFirehoseDestination
kinesisFirehoseDestination_deliveryStreamARN = (KinesisFirehoseDestination -> Text)
-> (KinesisFirehoseDestination
    -> Text -> KinesisFirehoseDestination)
-> Lens
     KinesisFirehoseDestination KinesisFirehoseDestination Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KinesisFirehoseDestination' {Text
deliveryStreamARN :: Text
$sel:deliveryStreamARN:KinesisFirehoseDestination' :: KinesisFirehoseDestination -> Text
deliveryStreamARN} -> Text
deliveryStreamARN) (\s :: KinesisFirehoseDestination
s@KinesisFirehoseDestination' {} Text
a -> KinesisFirehoseDestination
s {$sel:deliveryStreamARN:KinesisFirehoseDestination' :: Text
deliveryStreamARN = Text
a} :: KinesisFirehoseDestination)

instance Core.FromXML KinesisFirehoseDestination where
  parseXML :: [Node] -> Either String KinesisFirehoseDestination
parseXML [Node]
x =
    Text -> Text -> KinesisFirehoseDestination
KinesisFirehoseDestination'
      (Text -> Text -> KinesisFirehoseDestination)
-> Either String Text
-> Either String (Text -> KinesisFirehoseDestination)
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
"IAMRoleARN")
      Either String (Text -> KinesisFirehoseDestination)
-> Either String Text -> Either String KinesisFirehoseDestination
forall (f :: * -> *) a b. Applicative f => 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
"DeliveryStreamARN")

instance Prelude.Hashable KinesisFirehoseDestination

instance Prelude.NFData KinesisFirehoseDestination

instance Core.ToQuery KinesisFirehoseDestination where
  toQuery :: KinesisFirehoseDestination -> QueryString
toQuery KinesisFirehoseDestination' {Text
deliveryStreamARN :: Text
iAMRoleARN :: Text
$sel:deliveryStreamARN:KinesisFirehoseDestination' :: KinesisFirehoseDestination -> Text
$sel:iAMRoleARN:KinesisFirehoseDestination' :: KinesisFirehoseDestination -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"IAMRoleARN" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
iAMRoleARN,
        ByteString
"DeliveryStreamARN" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
deliveryStreamARN
      ]