{-# 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.KinesisStreamsOutput
-- 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.KinesisStreamsOutput 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 stream
-- as the destination. You provide the stream Amazon Resource Name (ARN)
-- and also an IAM role ARN that Amazon Kinesis Analytics can use to write
-- to the stream on your behalf.
--
-- /See:/ 'newKinesisStreamsOutput' smart constructor.
data KinesisStreamsOutput = KinesisStreamsOutput'
  { -- | ARN of the destination Amazon Kinesis stream to write to.
    KinesisStreamsOutput -> 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.
    KinesisStreamsOutput -> Text
roleARN :: Prelude.Text
  }
  deriving (KinesisStreamsOutput -> KinesisStreamsOutput -> Bool
(KinesisStreamsOutput -> KinesisStreamsOutput -> Bool)
-> (KinesisStreamsOutput -> KinesisStreamsOutput -> Bool)
-> Eq KinesisStreamsOutput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KinesisStreamsOutput -> KinesisStreamsOutput -> Bool
$c/= :: KinesisStreamsOutput -> KinesisStreamsOutput -> Bool
== :: KinesisStreamsOutput -> KinesisStreamsOutput -> Bool
$c== :: KinesisStreamsOutput -> KinesisStreamsOutput -> Bool
Prelude.Eq, ReadPrec [KinesisStreamsOutput]
ReadPrec KinesisStreamsOutput
Int -> ReadS KinesisStreamsOutput
ReadS [KinesisStreamsOutput]
(Int -> ReadS KinesisStreamsOutput)
-> ReadS [KinesisStreamsOutput]
-> ReadPrec KinesisStreamsOutput
-> ReadPrec [KinesisStreamsOutput]
-> Read KinesisStreamsOutput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KinesisStreamsOutput]
$creadListPrec :: ReadPrec [KinesisStreamsOutput]
readPrec :: ReadPrec KinesisStreamsOutput
$creadPrec :: ReadPrec KinesisStreamsOutput
readList :: ReadS [KinesisStreamsOutput]
$creadList :: ReadS [KinesisStreamsOutput]
readsPrec :: Int -> ReadS KinesisStreamsOutput
$creadsPrec :: Int -> ReadS KinesisStreamsOutput
Prelude.Read, Int -> KinesisStreamsOutput -> ShowS
[KinesisStreamsOutput] -> ShowS
KinesisStreamsOutput -> String
(Int -> KinesisStreamsOutput -> ShowS)
-> (KinesisStreamsOutput -> String)
-> ([KinesisStreamsOutput] -> ShowS)
-> Show KinesisStreamsOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KinesisStreamsOutput] -> ShowS
$cshowList :: [KinesisStreamsOutput] -> ShowS
show :: KinesisStreamsOutput -> String
$cshow :: KinesisStreamsOutput -> String
showsPrec :: Int -> KinesisStreamsOutput -> ShowS
$cshowsPrec :: Int -> KinesisStreamsOutput -> ShowS
Prelude.Show, (forall x. KinesisStreamsOutput -> Rep KinesisStreamsOutput x)
-> (forall x. Rep KinesisStreamsOutput x -> KinesisStreamsOutput)
-> Generic KinesisStreamsOutput
forall x. Rep KinesisStreamsOutput x -> KinesisStreamsOutput
forall x. KinesisStreamsOutput -> Rep KinesisStreamsOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep KinesisStreamsOutput x -> KinesisStreamsOutput
$cfrom :: forall x. KinesisStreamsOutput -> Rep KinesisStreamsOutput x
Prelude.Generic)

-- |
-- Create a value of 'KinesisStreamsOutput' 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', 'kinesisStreamsOutput_resourceARN' - ARN of the destination Amazon Kinesis stream to write to.
--
-- 'roleARN', 'kinesisStreamsOutput_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.
newKinesisStreamsOutput ::
  -- | 'resourceARN'
  Prelude.Text ->
  -- | 'roleARN'
  Prelude.Text ->
  KinesisStreamsOutput
newKinesisStreamsOutput :: Text -> Text -> KinesisStreamsOutput
newKinesisStreamsOutput Text
pResourceARN_ Text
pRoleARN_ =
  KinesisStreamsOutput' :: Text -> Text -> KinesisStreamsOutput
KinesisStreamsOutput'
    { $sel:resourceARN:KinesisStreamsOutput' :: Text
resourceARN = Text
pResourceARN_,
      $sel:roleARN:KinesisStreamsOutput' :: Text
roleARN = Text
pRoleARN_
    }

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

-- | 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.
kinesisStreamsOutput_roleARN :: Lens.Lens' KinesisStreamsOutput Prelude.Text
kinesisStreamsOutput_roleARN :: (Text -> f Text) -> KinesisStreamsOutput -> f KinesisStreamsOutput
kinesisStreamsOutput_roleARN = (KinesisStreamsOutput -> Text)
-> (KinesisStreamsOutput -> Text -> KinesisStreamsOutput)
-> Lens KinesisStreamsOutput KinesisStreamsOutput Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KinesisStreamsOutput' {Text
roleARN :: Text
$sel:roleARN:KinesisStreamsOutput' :: KinesisStreamsOutput -> Text
roleARN} -> Text
roleARN) (\s :: KinesisStreamsOutput
s@KinesisStreamsOutput' {} Text
a -> KinesisStreamsOutput
s {$sel:roleARN:KinesisStreamsOutput' :: Text
roleARN = Text
a} :: KinesisStreamsOutput)

instance Prelude.Hashable KinesisStreamsOutput

instance Prelude.NFData KinesisStreamsOutput

instance Core.ToJSON KinesisStreamsOutput where
  toJSON :: KinesisStreamsOutput -> Value
toJSON KinesisStreamsOutput' {Text
roleARN :: Text
resourceARN :: Text
$sel:roleARN:KinesisStreamsOutput' :: KinesisStreamsOutput -> Text
$sel:resourceARN:KinesisStreamsOutput' :: KinesisStreamsOutput -> 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)
          ]
      )