{-# 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.KinesisStreamsInputUpdate
-- 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.KinesisStreamsInputUpdate where

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

-- | When updating application input configuration, provides information
-- about an Amazon Kinesis stream as the streaming source.
--
-- /See:/ 'newKinesisStreamsInputUpdate' smart constructor.
data KinesisStreamsInputUpdate = KinesisStreamsInputUpdate'
  { -- | 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.
    KinesisStreamsInputUpdate -> Maybe Text
roleARNUpdate :: Prelude.Maybe Prelude.Text,
    -- | Amazon Resource Name (ARN) of the input Amazon Kinesis stream to read.
    KinesisStreamsInputUpdate -> Maybe Text
resourceARNUpdate :: Prelude.Maybe Prelude.Text
  }
  deriving (KinesisStreamsInputUpdate -> KinesisStreamsInputUpdate -> Bool
(KinesisStreamsInputUpdate -> KinesisStreamsInputUpdate -> Bool)
-> (KinesisStreamsInputUpdate -> KinesisStreamsInputUpdate -> Bool)
-> Eq KinesisStreamsInputUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KinesisStreamsInputUpdate -> KinesisStreamsInputUpdate -> Bool
$c/= :: KinesisStreamsInputUpdate -> KinesisStreamsInputUpdate -> Bool
== :: KinesisStreamsInputUpdate -> KinesisStreamsInputUpdate -> Bool
$c== :: KinesisStreamsInputUpdate -> KinesisStreamsInputUpdate -> Bool
Prelude.Eq, ReadPrec [KinesisStreamsInputUpdate]
ReadPrec KinesisStreamsInputUpdate
Int -> ReadS KinesisStreamsInputUpdate
ReadS [KinesisStreamsInputUpdate]
(Int -> ReadS KinesisStreamsInputUpdate)
-> ReadS [KinesisStreamsInputUpdate]
-> ReadPrec KinesisStreamsInputUpdate
-> ReadPrec [KinesisStreamsInputUpdate]
-> Read KinesisStreamsInputUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KinesisStreamsInputUpdate]
$creadListPrec :: ReadPrec [KinesisStreamsInputUpdate]
readPrec :: ReadPrec KinesisStreamsInputUpdate
$creadPrec :: ReadPrec KinesisStreamsInputUpdate
readList :: ReadS [KinesisStreamsInputUpdate]
$creadList :: ReadS [KinesisStreamsInputUpdate]
readsPrec :: Int -> ReadS KinesisStreamsInputUpdate
$creadsPrec :: Int -> ReadS KinesisStreamsInputUpdate
Prelude.Read, Int -> KinesisStreamsInputUpdate -> ShowS
[KinesisStreamsInputUpdate] -> ShowS
KinesisStreamsInputUpdate -> String
(Int -> KinesisStreamsInputUpdate -> ShowS)
-> (KinesisStreamsInputUpdate -> String)
-> ([KinesisStreamsInputUpdate] -> ShowS)
-> Show KinesisStreamsInputUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KinesisStreamsInputUpdate] -> ShowS
$cshowList :: [KinesisStreamsInputUpdate] -> ShowS
show :: KinesisStreamsInputUpdate -> String
$cshow :: KinesisStreamsInputUpdate -> String
showsPrec :: Int -> KinesisStreamsInputUpdate -> ShowS
$cshowsPrec :: Int -> KinesisStreamsInputUpdate -> ShowS
Prelude.Show, (forall x.
 KinesisStreamsInputUpdate -> Rep KinesisStreamsInputUpdate x)
-> (forall x.
    Rep KinesisStreamsInputUpdate x -> KinesisStreamsInputUpdate)
-> Generic KinesisStreamsInputUpdate
forall x.
Rep KinesisStreamsInputUpdate x -> KinesisStreamsInputUpdate
forall x.
KinesisStreamsInputUpdate -> Rep KinesisStreamsInputUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep KinesisStreamsInputUpdate x -> KinesisStreamsInputUpdate
$cfrom :: forall x.
KinesisStreamsInputUpdate -> Rep KinesisStreamsInputUpdate x
Prelude.Generic)

-- |
-- Create a value of 'KinesisStreamsInputUpdate' 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:
--
-- 'roleARNUpdate', 'kinesisStreamsInputUpdate_roleARNUpdate' - 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.
--
-- 'resourceARNUpdate', 'kinesisStreamsInputUpdate_resourceARNUpdate' - Amazon Resource Name (ARN) of the input Amazon Kinesis stream to read.
newKinesisStreamsInputUpdate ::
  KinesisStreamsInputUpdate
newKinesisStreamsInputUpdate :: KinesisStreamsInputUpdate
newKinesisStreamsInputUpdate =
  KinesisStreamsInputUpdate' :: Maybe Text -> Maybe Text -> KinesisStreamsInputUpdate
KinesisStreamsInputUpdate'
    { $sel:roleARNUpdate:KinesisStreamsInputUpdate' :: Maybe Text
roleARNUpdate =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceARNUpdate:KinesisStreamsInputUpdate' :: Maybe Text
resourceARNUpdate = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | Amazon Resource Name (ARN) of the input Amazon Kinesis stream to read.
kinesisStreamsInputUpdate_resourceARNUpdate :: Lens.Lens' KinesisStreamsInputUpdate (Prelude.Maybe Prelude.Text)
kinesisStreamsInputUpdate_resourceARNUpdate :: (Maybe Text -> f (Maybe Text))
-> KinesisStreamsInputUpdate -> f KinesisStreamsInputUpdate
kinesisStreamsInputUpdate_resourceARNUpdate = (KinesisStreamsInputUpdate -> Maybe Text)
-> (KinesisStreamsInputUpdate
    -> Maybe Text -> KinesisStreamsInputUpdate)
-> Lens
     KinesisStreamsInputUpdate
     KinesisStreamsInputUpdate
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KinesisStreamsInputUpdate' {Maybe Text
resourceARNUpdate :: Maybe Text
$sel:resourceARNUpdate:KinesisStreamsInputUpdate' :: KinesisStreamsInputUpdate -> Maybe Text
resourceARNUpdate} -> Maybe Text
resourceARNUpdate) (\s :: KinesisStreamsInputUpdate
s@KinesisStreamsInputUpdate' {} Maybe Text
a -> KinesisStreamsInputUpdate
s {$sel:resourceARNUpdate:KinesisStreamsInputUpdate' :: Maybe Text
resourceARNUpdate = Maybe Text
a} :: KinesisStreamsInputUpdate)

instance Prelude.Hashable KinesisStreamsInputUpdate

instance Prelude.NFData KinesisStreamsInputUpdate

instance Core.ToJSON KinesisStreamsInputUpdate where
  toJSON :: KinesisStreamsInputUpdate -> Value
toJSON KinesisStreamsInputUpdate' {Maybe Text
resourceARNUpdate :: Maybe Text
roleARNUpdate :: Maybe Text
$sel:resourceARNUpdate:KinesisStreamsInputUpdate' :: KinesisStreamsInputUpdate -> Maybe Text
$sel:roleARNUpdate:KinesisStreamsInputUpdate' :: KinesisStreamsInputUpdate -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RoleARNUpdate" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
roleARNUpdate,
            (Text
"ResourceARNUpdate" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
resourceARNUpdate
          ]
      )