{-# 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.KinesisAnalytics.Types.KinesisFirehoseOutput
-- 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.KinesisAnalytics.Types.KinesisFirehoseOutput where

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

-- | When configuring application output, identifies an Amazon Kinesis
-- Firehose delivery stream as the destination. You provide the stream
-- Amazon Resource Name (ARN) and an IAM role that enables Amazon Kinesis
-- Analytics to write to the stream on your behalf.
--
-- /See:/ 'newKinesisFirehoseOutput' smart constructor.
data KinesisFirehoseOutput = KinesisFirehoseOutput'
  { -- | ARN of the destination Amazon Kinesis Firehose delivery stream to write
    -- to.
    KinesisFirehoseOutput -> Text
resourceARN :: Prelude.Text,
    -- | ARN of the IAM role that Amazon Kinesis Analytics can assume to write to
    -- the destination stream on your behalf. You need to grant the necessary
    -- permissions to this role.
    KinesisFirehoseOutput -> Text
roleARN :: Prelude.Text
  }
  deriving (KinesisFirehoseOutput -> KinesisFirehoseOutput -> Bool
(KinesisFirehoseOutput -> KinesisFirehoseOutput -> Bool)
-> (KinesisFirehoseOutput -> KinesisFirehoseOutput -> Bool)
-> Eq KinesisFirehoseOutput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KinesisFirehoseOutput -> KinesisFirehoseOutput -> Bool
$c/= :: KinesisFirehoseOutput -> KinesisFirehoseOutput -> Bool
== :: KinesisFirehoseOutput -> KinesisFirehoseOutput -> Bool
$c== :: KinesisFirehoseOutput -> KinesisFirehoseOutput -> Bool
Prelude.Eq, ReadPrec [KinesisFirehoseOutput]
ReadPrec KinesisFirehoseOutput
Int -> ReadS KinesisFirehoseOutput
ReadS [KinesisFirehoseOutput]
(Int -> ReadS KinesisFirehoseOutput)
-> ReadS [KinesisFirehoseOutput]
-> ReadPrec KinesisFirehoseOutput
-> ReadPrec [KinesisFirehoseOutput]
-> Read KinesisFirehoseOutput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KinesisFirehoseOutput]
$creadListPrec :: ReadPrec [KinesisFirehoseOutput]
readPrec :: ReadPrec KinesisFirehoseOutput
$creadPrec :: ReadPrec KinesisFirehoseOutput
readList :: ReadS [KinesisFirehoseOutput]
$creadList :: ReadS [KinesisFirehoseOutput]
readsPrec :: Int -> ReadS KinesisFirehoseOutput
$creadsPrec :: Int -> ReadS KinesisFirehoseOutput
Prelude.Read, Int -> KinesisFirehoseOutput -> ShowS
[KinesisFirehoseOutput] -> ShowS
KinesisFirehoseOutput -> String
(Int -> KinesisFirehoseOutput -> ShowS)
-> (KinesisFirehoseOutput -> String)
-> ([KinesisFirehoseOutput] -> ShowS)
-> Show KinesisFirehoseOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KinesisFirehoseOutput] -> ShowS
$cshowList :: [KinesisFirehoseOutput] -> ShowS
show :: KinesisFirehoseOutput -> String
$cshow :: KinesisFirehoseOutput -> String
showsPrec :: Int -> KinesisFirehoseOutput -> ShowS
$cshowsPrec :: Int -> KinesisFirehoseOutput -> ShowS
Prelude.Show, (forall x. KinesisFirehoseOutput -> Rep KinesisFirehoseOutput x)
-> (forall x. Rep KinesisFirehoseOutput x -> KinesisFirehoseOutput)
-> Generic KinesisFirehoseOutput
forall x. Rep KinesisFirehoseOutput x -> KinesisFirehoseOutput
forall x. KinesisFirehoseOutput -> Rep KinesisFirehoseOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep KinesisFirehoseOutput x -> KinesisFirehoseOutput
$cfrom :: forall x. KinesisFirehoseOutput -> Rep KinesisFirehoseOutput x
Prelude.Generic)

-- |
-- Create a value of 'KinesisFirehoseOutput' 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:
--
-- 'resourceARN', 'kinesisFirehoseOutput_resourceARN' - ARN of the destination Amazon Kinesis Firehose delivery stream to write
-- to.
--
-- 'roleARN', 'kinesisFirehoseOutput_roleARN' - ARN of the IAM role that Amazon Kinesis Analytics can assume to write to
-- the destination stream on your behalf. You need to grant the necessary
-- permissions to this role.
newKinesisFirehoseOutput ::
  -- | 'resourceARN'
  Prelude.Text ->
  -- | 'roleARN'
  Prelude.Text ->
  KinesisFirehoseOutput
newKinesisFirehoseOutput :: Text -> Text -> KinesisFirehoseOutput
newKinesisFirehoseOutput Text
pResourceARN_ Text
pRoleARN_ =
  KinesisFirehoseOutput' :: Text -> Text -> KinesisFirehoseOutput
KinesisFirehoseOutput'
    { $sel:resourceARN:KinesisFirehoseOutput' :: Text
resourceARN = Text
pResourceARN_,
      $sel:roleARN:KinesisFirehoseOutput' :: Text
roleARN = Text
pRoleARN_
    }

-- | ARN of the destination Amazon Kinesis Firehose delivery stream to write
-- to.
kinesisFirehoseOutput_resourceARN :: Lens.Lens' KinesisFirehoseOutput Prelude.Text
kinesisFirehoseOutput_resourceARN :: (Text -> f Text)
-> KinesisFirehoseOutput -> f KinesisFirehoseOutput
kinesisFirehoseOutput_resourceARN = (KinesisFirehoseOutput -> Text)
-> (KinesisFirehoseOutput -> Text -> KinesisFirehoseOutput)
-> Lens KinesisFirehoseOutput KinesisFirehoseOutput Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KinesisFirehoseOutput' {Text
resourceARN :: Text
$sel:resourceARN:KinesisFirehoseOutput' :: KinesisFirehoseOutput -> Text
resourceARN} -> Text
resourceARN) (\s :: KinesisFirehoseOutput
s@KinesisFirehoseOutput' {} Text
a -> KinesisFirehoseOutput
s {$sel:resourceARN:KinesisFirehoseOutput' :: Text
resourceARN = Text
a} :: KinesisFirehoseOutput)

-- | ARN of the IAM role that Amazon Kinesis Analytics can assume to write to
-- the destination stream on your behalf. You need to grant the necessary
-- permissions to this role.
kinesisFirehoseOutput_roleARN :: Lens.Lens' KinesisFirehoseOutput Prelude.Text
kinesisFirehoseOutput_roleARN :: (Text -> f Text)
-> KinesisFirehoseOutput -> f KinesisFirehoseOutput
kinesisFirehoseOutput_roleARN = (KinesisFirehoseOutput -> Text)
-> (KinesisFirehoseOutput -> Text -> KinesisFirehoseOutput)
-> Lens KinesisFirehoseOutput KinesisFirehoseOutput Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KinesisFirehoseOutput' {Text
roleARN :: Text
$sel:roleARN:KinesisFirehoseOutput' :: KinesisFirehoseOutput -> Text
roleARN} -> Text
roleARN) (\s :: KinesisFirehoseOutput
s@KinesisFirehoseOutput' {} Text
a -> KinesisFirehoseOutput
s {$sel:roleARN:KinesisFirehoseOutput' :: Text
roleARN = Text
a} :: KinesisFirehoseOutput)

instance Prelude.Hashable KinesisFirehoseOutput

instance Prelude.NFData KinesisFirehoseOutput

instance Core.ToJSON KinesisFirehoseOutput where
  toJSON :: KinesisFirehoseOutput -> Value
toJSON KinesisFirehoseOutput' {Text
roleARN :: Text
resourceARN :: Text
$sel:roleARN:KinesisFirehoseOutput' :: KinesisFirehoseOutput -> Text
$sel:resourceARN:KinesisFirehoseOutput' :: KinesisFirehoseOutput -> 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
"ResourceARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceARN),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"RoleARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleARN)
          ]
      )