{-# 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.KinesisStreamsOutputUpdate
-- 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.KinesisStreamsOutputUpdate 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 updating an output configuration using the
-- <https://docs.aws.amazon.com/kinesisanalytics/latest/dev/API_UpdateApplication.html UpdateApplication>
-- operation, provides information about an Amazon Kinesis stream
-- configured as the destination.
--
-- /See:/ 'newKinesisStreamsOutputUpdate' smart constructor.
data KinesisStreamsOutputUpdate = KinesisStreamsOutputUpdate'
  { -- | Amazon Resource Name (ARN) of the Amazon Kinesis stream where you want
    -- to write the output.
    KinesisStreamsOutputUpdate -> Maybe Text
resourceARNUpdate :: Prelude.Maybe 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.
    KinesisStreamsOutputUpdate -> Maybe Text
roleARNUpdate :: Prelude.Maybe Prelude.Text
  }
  deriving (KinesisStreamsOutputUpdate -> KinesisStreamsOutputUpdate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KinesisStreamsOutputUpdate -> KinesisStreamsOutputUpdate -> Bool
$c/= :: KinesisStreamsOutputUpdate -> KinesisStreamsOutputUpdate -> Bool
== :: KinesisStreamsOutputUpdate -> KinesisStreamsOutputUpdate -> Bool
$c== :: KinesisStreamsOutputUpdate -> KinesisStreamsOutputUpdate -> Bool
Prelude.Eq, ReadPrec [KinesisStreamsOutputUpdate]
ReadPrec KinesisStreamsOutputUpdate
Int -> ReadS KinesisStreamsOutputUpdate
ReadS [KinesisStreamsOutputUpdate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KinesisStreamsOutputUpdate]
$creadListPrec :: ReadPrec [KinesisStreamsOutputUpdate]
readPrec :: ReadPrec KinesisStreamsOutputUpdate
$creadPrec :: ReadPrec KinesisStreamsOutputUpdate
readList :: ReadS [KinesisStreamsOutputUpdate]
$creadList :: ReadS [KinesisStreamsOutputUpdate]
readsPrec :: Int -> ReadS KinesisStreamsOutputUpdate
$creadsPrec :: Int -> ReadS KinesisStreamsOutputUpdate
Prelude.Read, Int -> KinesisStreamsOutputUpdate -> ShowS
[KinesisStreamsOutputUpdate] -> ShowS
KinesisStreamsOutputUpdate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KinesisStreamsOutputUpdate] -> ShowS
$cshowList :: [KinesisStreamsOutputUpdate] -> ShowS
show :: KinesisStreamsOutputUpdate -> String
$cshow :: KinesisStreamsOutputUpdate -> String
showsPrec :: Int -> KinesisStreamsOutputUpdate -> ShowS
$cshowsPrec :: Int -> KinesisStreamsOutputUpdate -> ShowS
Prelude.Show, forall x.
Rep KinesisStreamsOutputUpdate x -> KinesisStreamsOutputUpdate
forall x.
KinesisStreamsOutputUpdate -> Rep KinesisStreamsOutputUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep KinesisStreamsOutputUpdate x -> KinesisStreamsOutputUpdate
$cfrom :: forall x.
KinesisStreamsOutputUpdate -> Rep KinesisStreamsOutputUpdate x
Prelude.Generic)

-- |
-- Create a value of 'KinesisStreamsOutputUpdate' 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:
--
-- 'resourceARNUpdate', 'kinesisStreamsOutputUpdate_resourceARNUpdate' - Amazon Resource Name (ARN) of the Amazon Kinesis stream where you want
-- to write the output.
--
-- 'roleARNUpdate', 'kinesisStreamsOutputUpdate_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.
newKinesisStreamsOutputUpdate ::
  KinesisStreamsOutputUpdate
newKinesisStreamsOutputUpdate :: KinesisStreamsOutputUpdate
newKinesisStreamsOutputUpdate =
  KinesisStreamsOutputUpdate'
    { $sel:resourceARNUpdate:KinesisStreamsOutputUpdate' :: Maybe Text
resourceARNUpdate =
        forall a. Maybe a
Prelude.Nothing,
      $sel:roleARNUpdate:KinesisStreamsOutputUpdate' :: Maybe Text
roleARNUpdate = forall a. Maybe a
Prelude.Nothing
    }

-- | Amazon Resource Name (ARN) of the Amazon Kinesis stream where you want
-- to write the output.
kinesisStreamsOutputUpdate_resourceARNUpdate :: Lens.Lens' KinesisStreamsOutputUpdate (Prelude.Maybe Prelude.Text)
kinesisStreamsOutputUpdate_resourceARNUpdate :: Lens' KinesisStreamsOutputUpdate (Maybe Text)
kinesisStreamsOutputUpdate_resourceARNUpdate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KinesisStreamsOutputUpdate' {Maybe Text
resourceARNUpdate :: Maybe Text
$sel:resourceARNUpdate:KinesisStreamsOutputUpdate' :: KinesisStreamsOutputUpdate -> Maybe Text
resourceARNUpdate} -> Maybe Text
resourceARNUpdate) (\s :: KinesisStreamsOutputUpdate
s@KinesisStreamsOutputUpdate' {} Maybe Text
a -> KinesisStreamsOutputUpdate
s {$sel:resourceARNUpdate:KinesisStreamsOutputUpdate' :: Maybe Text
resourceARNUpdate = Maybe Text
a} :: KinesisStreamsOutputUpdate)

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

instance Prelude.Hashable KinesisStreamsOutputUpdate where
  hashWithSalt :: Int -> KinesisStreamsOutputUpdate -> Int
hashWithSalt Int
_salt KinesisStreamsOutputUpdate' {Maybe Text
roleARNUpdate :: Maybe Text
resourceARNUpdate :: Maybe Text
$sel:roleARNUpdate:KinesisStreamsOutputUpdate' :: KinesisStreamsOutputUpdate -> Maybe Text
$sel:resourceARNUpdate:KinesisStreamsOutputUpdate' :: KinesisStreamsOutputUpdate -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceARNUpdate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
roleARNUpdate

instance Prelude.NFData KinesisStreamsOutputUpdate where
  rnf :: KinesisStreamsOutputUpdate -> ()
rnf KinesisStreamsOutputUpdate' {Maybe Text
roleARNUpdate :: Maybe Text
resourceARNUpdate :: Maybe Text
$sel:roleARNUpdate:KinesisStreamsOutputUpdate' :: KinesisStreamsOutputUpdate -> Maybe Text
$sel:resourceARNUpdate:KinesisStreamsOutputUpdate' :: KinesisStreamsOutputUpdate -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceARNUpdate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
roleARNUpdate

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