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

-- | An object that contains information about an event destination that
-- sends data to Amazon Kinesis Data Firehose.
--
-- /See:/ 'newKinesisFirehoseDestination' smart constructor.
data KinesisFirehoseDestination = KinesisFirehoseDestination'
  { -- | The Amazon Resource Name (ARN) of an IAM role that can write data to an
    -- Amazon Kinesis Data Firehose stream.
    KinesisFirehoseDestination -> Maybe Text
deliveryStreamArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the Amazon Kinesis Data Firehose
    -- destination that you want to use in the event destination.
    KinesisFirehoseDestination -> Maybe Text
iamRoleArn :: Prelude.Maybe Prelude.Text
  }
  deriving (KinesisFirehoseDestination -> KinesisFirehoseDestination -> Bool
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]
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
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.
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:
--
-- 'deliveryStreamArn', 'kinesisFirehoseDestination_deliveryStreamArn' - The Amazon Resource Name (ARN) of an IAM role that can write data to an
-- Amazon Kinesis Data Firehose stream.
--
-- 'iamRoleArn', 'kinesisFirehoseDestination_iamRoleArn' - The Amazon Resource Name (ARN) of the Amazon Kinesis Data Firehose
-- destination that you want to use in the event destination.
newKinesisFirehoseDestination ::
  KinesisFirehoseDestination
newKinesisFirehoseDestination :: KinesisFirehoseDestination
newKinesisFirehoseDestination =
  KinesisFirehoseDestination'
    { $sel:deliveryStreamArn:KinesisFirehoseDestination' :: Maybe Text
deliveryStreamArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:iamRoleArn:KinesisFirehoseDestination' :: Maybe Text
iamRoleArn = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of an IAM role that can write data to an
-- Amazon Kinesis Data Firehose stream.
kinesisFirehoseDestination_deliveryStreamArn :: Lens.Lens' KinesisFirehoseDestination (Prelude.Maybe Prelude.Text)
kinesisFirehoseDestination_deliveryStreamArn :: Lens' KinesisFirehoseDestination (Maybe Text)
kinesisFirehoseDestination_deliveryStreamArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KinesisFirehoseDestination' {Maybe Text
deliveryStreamArn :: Maybe Text
$sel:deliveryStreamArn:KinesisFirehoseDestination' :: KinesisFirehoseDestination -> Maybe Text
deliveryStreamArn} -> Maybe Text
deliveryStreamArn) (\s :: KinesisFirehoseDestination
s@KinesisFirehoseDestination' {} Maybe Text
a -> KinesisFirehoseDestination
s {$sel:deliveryStreamArn:KinesisFirehoseDestination' :: Maybe Text
deliveryStreamArn = Maybe Text
a} :: KinesisFirehoseDestination)

-- | The Amazon Resource Name (ARN) of the Amazon Kinesis Data Firehose
-- destination that you want to use in the event destination.
kinesisFirehoseDestination_iamRoleArn :: Lens.Lens' KinesisFirehoseDestination (Prelude.Maybe Prelude.Text)
kinesisFirehoseDestination_iamRoleArn :: Lens' KinesisFirehoseDestination (Maybe Text)
kinesisFirehoseDestination_iamRoleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KinesisFirehoseDestination' {Maybe Text
iamRoleArn :: Maybe Text
$sel:iamRoleArn:KinesisFirehoseDestination' :: KinesisFirehoseDestination -> Maybe Text
iamRoleArn} -> Maybe Text
iamRoleArn) (\s :: KinesisFirehoseDestination
s@KinesisFirehoseDestination' {} Maybe Text
a -> KinesisFirehoseDestination
s {$sel:iamRoleArn:KinesisFirehoseDestination' :: Maybe Text
iamRoleArn = Maybe Text
a} :: KinesisFirehoseDestination)

instance Data.FromJSON KinesisFirehoseDestination where
  parseJSON :: Value -> Parser KinesisFirehoseDestination
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"KinesisFirehoseDestination"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> KinesisFirehoseDestination
KinesisFirehoseDestination'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DeliveryStreamArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"IamRoleArn")
      )

instance Prelude.Hashable KinesisFirehoseDestination where
  hashWithSalt :: Int -> KinesisFirehoseDestination -> Int
hashWithSalt Int
_salt KinesisFirehoseDestination' {Maybe Text
iamRoleArn :: Maybe Text
deliveryStreamArn :: Maybe Text
$sel:iamRoleArn:KinesisFirehoseDestination' :: KinesisFirehoseDestination -> Maybe Text
$sel:deliveryStreamArn:KinesisFirehoseDestination' :: KinesisFirehoseDestination -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deliveryStreamArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
iamRoleArn

instance Prelude.NFData KinesisFirehoseDestination where
  rnf :: KinesisFirehoseDestination -> ()
rnf KinesisFirehoseDestination' {Maybe Text
iamRoleArn :: Maybe Text
deliveryStreamArn :: Maybe Text
$sel:iamRoleArn:KinesisFirehoseDestination' :: KinesisFirehoseDestination -> Maybe Text
$sel:deliveryStreamArn:KinesisFirehoseDestination' :: KinesisFirehoseDestination -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deliveryStreamArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
iamRoleArn

instance Data.ToJSON KinesisFirehoseDestination where
  toJSON :: KinesisFirehoseDestination -> Value
toJSON KinesisFirehoseDestination' {Maybe Text
iamRoleArn :: Maybe Text
deliveryStreamArn :: Maybe Text
$sel:iamRoleArn:KinesisFirehoseDestination' :: KinesisFirehoseDestination -> Maybe Text
$sel:deliveryStreamArn:KinesisFirehoseDestination' :: KinesisFirehoseDestination -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"DeliveryStreamArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
deliveryStreamArn,
            (Key
"IamRoleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
iamRoleArn
          ]
      )