{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.KinesisAnalytics.Types.KinesisStreamsOutput 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

-- | 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
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]
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
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. 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'
    { $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 :: Lens' KinesisStreamsOutput Text
kinesisStreamsOutput_resourceARN = 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 :: Lens' KinesisStreamsOutput Text
kinesisStreamsOutput_roleARN = 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 where
  hashWithSalt :: Int -> KinesisStreamsOutput -> Int
hashWithSalt Int
_salt KinesisStreamsOutput' {Text
roleARN :: Text
resourceARN :: Text
$sel:roleARN:KinesisStreamsOutput' :: KinesisStreamsOutput -> Text
$sel:resourceARN:KinesisStreamsOutput' :: KinesisStreamsOutput -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceARN
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
roleARN

instance Prelude.NFData KinesisStreamsOutput where
  rnf :: KinesisStreamsOutput -> ()
rnf KinesisStreamsOutput' {Text
roleARN :: Text
resourceARN :: Text
$sel:roleARN:KinesisStreamsOutput' :: KinesisStreamsOutput -> Text
$sel:resourceARN:KinesisStreamsOutput' :: KinesisStreamsOutput -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
resourceARN
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
roleARN

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"ResourceARN" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
resourceARN),
            forall a. a -> Maybe a
Prelude.Just (Key
"RoleARN" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
roleARN)
          ]
      )