{-# 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.KinesisStreamsInput
-- 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.KinesisStreamsInput 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

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

-- |
-- Create a value of 'KinesisStreamsInput' 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', 'kinesisStreamsInput_resourceARN' - ARN of the input Amazon Kinesis stream to read.
--
-- 'roleARN', 'kinesisStreamsInput_roleARN' - ARN of the IAM role that Amazon Kinesis Analytics can assume to access
-- the stream on your behalf. You need to grant the necessary permissions
-- to this role.
newKinesisStreamsInput ::
  -- | 'resourceARN'
  Prelude.Text ->
  -- | 'roleARN'
  Prelude.Text ->
  KinesisStreamsInput
newKinesisStreamsInput :: Text -> Text -> KinesisStreamsInput
newKinesisStreamsInput Text
pResourceARN_ Text
pRoleARN_ =
  KinesisStreamsInput'
    { $sel:resourceARN:KinesisStreamsInput' :: Text
resourceARN = Text
pResourceARN_,
      $sel:roleARN:KinesisStreamsInput' :: Text
roleARN = Text
pRoleARN_
    }

-- | ARN of the input Amazon Kinesis stream to read.
kinesisStreamsInput_resourceARN :: Lens.Lens' KinesisStreamsInput Prelude.Text
kinesisStreamsInput_resourceARN :: Lens' KinesisStreamsInput Text
kinesisStreamsInput_resourceARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KinesisStreamsInput' {Text
resourceARN :: Text
$sel:resourceARN:KinesisStreamsInput' :: KinesisStreamsInput -> Text
resourceARN} -> Text
resourceARN) (\s :: KinesisStreamsInput
s@KinesisStreamsInput' {} Text
a -> KinesisStreamsInput
s {$sel:resourceARN:KinesisStreamsInput' :: Text
resourceARN = Text
a} :: KinesisStreamsInput)

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

instance Prelude.Hashable KinesisStreamsInput where
  hashWithSalt :: Int -> KinesisStreamsInput -> Int
hashWithSalt Int
_salt KinesisStreamsInput' {Text
roleARN :: Text
resourceARN :: Text
$sel:roleARN:KinesisStreamsInput' :: KinesisStreamsInput -> Text
$sel:resourceARN:KinesisStreamsInput' :: KinesisStreamsInput -> 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 KinesisStreamsInput where
  rnf :: KinesisStreamsInput -> ()
rnf KinesisStreamsInput' {Text
roleARN :: Text
resourceARN :: Text
$sel:roleARN:KinesisStreamsInput' :: KinesisStreamsInput -> Text
$sel:resourceARN:KinesisStreamsInput' :: KinesisStreamsInput -> 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 KinesisStreamsInput where
  toJSON :: KinesisStreamsInput -> Value
toJSON KinesisStreamsInput' {Text
roleARN :: Text
resourceARN :: Text
$sel:roleARN:KinesisStreamsInput' :: KinesisStreamsInput -> Text
$sel:resourceARN:KinesisStreamsInput' :: KinesisStreamsInput -> 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)
          ]
      )