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

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

-- | An object that defines an Amazon Kinesis Data Firehose destination for
-- email events. You can use Amazon Kinesis Data Firehose to stream data to
-- other services, such as Amazon S3 and Amazon Redshift.
--
-- /See:/ 'newKinesisFirehoseDestination' smart constructor.
data KinesisFirehoseDestination = KinesisFirehoseDestination'
  { -- | The Amazon Resource Name (ARN) of the IAM role that the Amazon SES API
    -- v2 uses to send email events to the Amazon Kinesis Data Firehose stream.
    KinesisFirehoseDestination -> Text
iamRoleArn :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the Amazon Kinesis Data Firehose
    -- stream that the Amazon SES API v2 sends email events 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 Amazon Resource Name (ARN) of the IAM role that the Amazon SES API
-- v2 uses to send email events to the Amazon Kinesis Data Firehose stream.
--
-- 'deliveryStreamArn', 'kinesisFirehoseDestination_deliveryStreamArn' - The Amazon Resource Name (ARN) of the Amazon Kinesis Data Firehose
-- stream that the Amazon SES API v2 sends email events 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 Amazon Resource Name (ARN) of the IAM role that the Amazon SES API
-- v2 uses to send email events to the Amazon Kinesis Data 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 Amazon Resource Name (ARN) of the Amazon Kinesis Data Firehose
-- stream that the Amazon SES API v2 sends email events 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.FromJSON KinesisFirehoseDestination where
  parseJSON :: Value -> Parser KinesisFirehoseDestination
parseJSON =
    String
-> (Object -> Parser KinesisFirehoseDestination)
-> Value
-> Parser KinesisFirehoseDestination
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"KinesisFirehoseDestination"
      ( \Object
x ->
          Text -> Text -> KinesisFirehoseDestination
KinesisFirehoseDestination'
            (Text -> Text -> KinesisFirehoseDestination)
-> Parser Text -> Parser (Text -> KinesisFirehoseDestination)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"IamRoleArn")
            Parser (Text -> KinesisFirehoseDestination)
-> Parser Text -> Parser KinesisFirehoseDestination
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DeliveryStreamArn")
      )

instance Prelude.Hashable KinesisFirehoseDestination

instance Prelude.NFData KinesisFirehoseDestination

instance Core.ToJSON KinesisFirehoseDestination where
  toJSON :: KinesisFirehoseDestination -> Value
toJSON KinesisFirehoseDestination' {Text
deliveryStreamArn :: Text
iamRoleArn :: Text
$sel:deliveryStreamArn:KinesisFirehoseDestination' :: KinesisFirehoseDestination -> Text
$sel:iamRoleArn:KinesisFirehoseDestination' :: KinesisFirehoseDestination -> 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
"IamRoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
iamRoleArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"DeliveryStreamArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
deliveryStreamArn)
          ]
      )