{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.QLDB.StreamJournalToKinesis
-- 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)
--
-- Creates a journal stream for a given Amazon QLDB ledger. The stream
-- captures every document revision that is committed to the ledger\'s
-- journal and delivers the data to a specified Amazon Kinesis Data Streams
-- resource.
module Amazonka.QLDB.StreamJournalToKinesis
  ( -- * Creating a Request
    StreamJournalToKinesis (..),
    newStreamJournalToKinesis,

    -- * Request Lenses
    streamJournalToKinesis_exclusiveEndTime,
    streamJournalToKinesis_tags,
    streamJournalToKinesis_ledgerName,
    streamJournalToKinesis_roleArn,
    streamJournalToKinesis_inclusiveStartTime,
    streamJournalToKinesis_kinesisConfiguration,
    streamJournalToKinesis_streamName,

    -- * Destructuring the Response
    StreamJournalToKinesisResponse (..),
    newStreamJournalToKinesisResponse,

    -- * Response Lenses
    streamJournalToKinesisResponse_streamId,
    streamJournalToKinesisResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QLDB.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newStreamJournalToKinesis' smart constructor.
data StreamJournalToKinesis = StreamJournalToKinesis'
  { -- | The exclusive date and time that specifies when the stream ends. If you
    -- don\'t define this parameter, the stream runs indefinitely until you
    -- cancel it.
    --
    -- The @ExclusiveEndTime@ must be in @ISO 8601@ date and time format and in
    -- Universal Coordinated Time (UTC). For example: @2019-06-13T21:36:34Z@.
    StreamJournalToKinesis -> Maybe POSIX
exclusiveEndTime :: Prelude.Maybe Core.POSIX,
    -- | The key-value pairs to add as tags to the stream that you want to
    -- create. Tag keys are case sensitive. Tag values are case sensitive and
    -- can be null.
    StreamJournalToKinesis -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name of the ledger.
    StreamJournalToKinesis -> Text
ledgerName :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the IAM role that grants QLDB
    -- permissions for a journal stream to write data records to a Kinesis Data
    -- Streams resource.
    StreamJournalToKinesis -> Text
roleArn :: Prelude.Text,
    -- | The inclusive start date and time from which to start streaming journal
    -- data. This parameter must be in @ISO 8601@ date and time format and in
    -- Universal Coordinated Time (UTC). For example: @2019-06-13T21:36:34Z@.
    --
    -- The @InclusiveStartTime@ cannot be in the future and must be before
    -- @ExclusiveEndTime@.
    --
    -- If you provide an @InclusiveStartTime@ that is before the ledger\'s
    -- @CreationDateTime@, QLDB effectively defaults it to the ledger\'s
    -- @CreationDateTime@.
    StreamJournalToKinesis -> POSIX
inclusiveStartTime :: Core.POSIX,
    -- | The configuration settings of the Kinesis Data Streams destination for
    -- your stream request.
    StreamJournalToKinesis -> KinesisConfiguration
kinesisConfiguration :: KinesisConfiguration,
    -- | The name that you want to assign to the QLDB journal stream.
    -- User-defined names can help identify and indicate the purpose of a
    -- stream.
    --
    -- Your stream name must be unique among other /active/ streams for a given
    -- ledger. Stream names have the same naming constraints as ledger names,
    -- as defined in
    -- <https://docs.aws.amazon.com/qldb/latest/developerguide/limits.html#limits.naming Quotas in Amazon QLDB>
    -- in the /Amazon QLDB Developer Guide/.
    StreamJournalToKinesis -> Text
streamName :: Prelude.Text
  }
  deriving (StreamJournalToKinesis -> StreamJournalToKinesis -> Bool
(StreamJournalToKinesis -> StreamJournalToKinesis -> Bool)
-> (StreamJournalToKinesis -> StreamJournalToKinesis -> Bool)
-> Eq StreamJournalToKinesis
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StreamJournalToKinesis -> StreamJournalToKinesis -> Bool
$c/= :: StreamJournalToKinesis -> StreamJournalToKinesis -> Bool
== :: StreamJournalToKinesis -> StreamJournalToKinesis -> Bool
$c== :: StreamJournalToKinesis -> StreamJournalToKinesis -> Bool
Prelude.Eq, ReadPrec [StreamJournalToKinesis]
ReadPrec StreamJournalToKinesis
Int -> ReadS StreamJournalToKinesis
ReadS [StreamJournalToKinesis]
(Int -> ReadS StreamJournalToKinesis)
-> ReadS [StreamJournalToKinesis]
-> ReadPrec StreamJournalToKinesis
-> ReadPrec [StreamJournalToKinesis]
-> Read StreamJournalToKinesis
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StreamJournalToKinesis]
$creadListPrec :: ReadPrec [StreamJournalToKinesis]
readPrec :: ReadPrec StreamJournalToKinesis
$creadPrec :: ReadPrec StreamJournalToKinesis
readList :: ReadS [StreamJournalToKinesis]
$creadList :: ReadS [StreamJournalToKinesis]
readsPrec :: Int -> ReadS StreamJournalToKinesis
$creadsPrec :: Int -> ReadS StreamJournalToKinesis
Prelude.Read, Int -> StreamJournalToKinesis -> ShowS
[StreamJournalToKinesis] -> ShowS
StreamJournalToKinesis -> String
(Int -> StreamJournalToKinesis -> ShowS)
-> (StreamJournalToKinesis -> String)
-> ([StreamJournalToKinesis] -> ShowS)
-> Show StreamJournalToKinesis
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StreamJournalToKinesis] -> ShowS
$cshowList :: [StreamJournalToKinesis] -> ShowS
show :: StreamJournalToKinesis -> String
$cshow :: StreamJournalToKinesis -> String
showsPrec :: Int -> StreamJournalToKinesis -> ShowS
$cshowsPrec :: Int -> StreamJournalToKinesis -> ShowS
Prelude.Show, (forall x. StreamJournalToKinesis -> Rep StreamJournalToKinesis x)
-> (forall x.
    Rep StreamJournalToKinesis x -> StreamJournalToKinesis)
-> Generic StreamJournalToKinesis
forall x. Rep StreamJournalToKinesis x -> StreamJournalToKinesis
forall x. StreamJournalToKinesis -> Rep StreamJournalToKinesis x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StreamJournalToKinesis x -> StreamJournalToKinesis
$cfrom :: forall x. StreamJournalToKinesis -> Rep StreamJournalToKinesis x
Prelude.Generic)

-- |
-- Create a value of 'StreamJournalToKinesis' 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:
--
-- 'exclusiveEndTime', 'streamJournalToKinesis_exclusiveEndTime' - The exclusive date and time that specifies when the stream ends. If you
-- don\'t define this parameter, the stream runs indefinitely until you
-- cancel it.
--
-- The @ExclusiveEndTime@ must be in @ISO 8601@ date and time format and in
-- Universal Coordinated Time (UTC). For example: @2019-06-13T21:36:34Z@.
--
-- 'tags', 'streamJournalToKinesis_tags' - The key-value pairs to add as tags to the stream that you want to
-- create. Tag keys are case sensitive. Tag values are case sensitive and
-- can be null.
--
-- 'ledgerName', 'streamJournalToKinesis_ledgerName' - The name of the ledger.
--
-- 'roleArn', 'streamJournalToKinesis_roleArn' - The Amazon Resource Name (ARN) of the IAM role that grants QLDB
-- permissions for a journal stream to write data records to a Kinesis Data
-- Streams resource.
--
-- 'inclusiveStartTime', 'streamJournalToKinesis_inclusiveStartTime' - The inclusive start date and time from which to start streaming journal
-- data. This parameter must be in @ISO 8601@ date and time format and in
-- Universal Coordinated Time (UTC). For example: @2019-06-13T21:36:34Z@.
--
-- The @InclusiveStartTime@ cannot be in the future and must be before
-- @ExclusiveEndTime@.
--
-- If you provide an @InclusiveStartTime@ that is before the ledger\'s
-- @CreationDateTime@, QLDB effectively defaults it to the ledger\'s
-- @CreationDateTime@.
--
-- 'kinesisConfiguration', 'streamJournalToKinesis_kinesisConfiguration' - The configuration settings of the Kinesis Data Streams destination for
-- your stream request.
--
-- 'streamName', 'streamJournalToKinesis_streamName' - The name that you want to assign to the QLDB journal stream.
-- User-defined names can help identify and indicate the purpose of a
-- stream.
--
-- Your stream name must be unique among other /active/ streams for a given
-- ledger. Stream names have the same naming constraints as ledger names,
-- as defined in
-- <https://docs.aws.amazon.com/qldb/latest/developerguide/limits.html#limits.naming Quotas in Amazon QLDB>
-- in the /Amazon QLDB Developer Guide/.
newStreamJournalToKinesis ::
  -- | 'ledgerName'
  Prelude.Text ->
  -- | 'roleArn'
  Prelude.Text ->
  -- | 'inclusiveStartTime'
  Prelude.UTCTime ->
  -- | 'kinesisConfiguration'
  KinesisConfiguration ->
  -- | 'streamName'
  Prelude.Text ->
  StreamJournalToKinesis
newStreamJournalToKinesis :: Text
-> Text
-> UTCTime
-> KinesisConfiguration
-> Text
-> StreamJournalToKinesis
newStreamJournalToKinesis
  Text
pLedgerName_
  Text
pRoleArn_
  UTCTime
pInclusiveStartTime_
  KinesisConfiguration
pKinesisConfiguration_
  Text
pStreamName_ =
    StreamJournalToKinesis' :: Maybe POSIX
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> POSIX
-> KinesisConfiguration
-> Text
-> StreamJournalToKinesis
StreamJournalToKinesis'
      { $sel:exclusiveEndTime:StreamJournalToKinesis' :: Maybe POSIX
exclusiveEndTime =
          Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:StreamJournalToKinesis' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:ledgerName:StreamJournalToKinesis' :: Text
ledgerName = Text
pLedgerName_,
        $sel:roleArn:StreamJournalToKinesis' :: Text
roleArn = Text
pRoleArn_,
        $sel:inclusiveStartTime:StreamJournalToKinesis' :: POSIX
inclusiveStartTime =
          Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pInclusiveStartTime_,
        $sel:kinesisConfiguration:StreamJournalToKinesis' :: KinesisConfiguration
kinesisConfiguration = KinesisConfiguration
pKinesisConfiguration_,
        $sel:streamName:StreamJournalToKinesis' :: Text
streamName = Text
pStreamName_
      }

-- | The exclusive date and time that specifies when the stream ends. If you
-- don\'t define this parameter, the stream runs indefinitely until you
-- cancel it.
--
-- The @ExclusiveEndTime@ must be in @ISO 8601@ date and time format and in
-- Universal Coordinated Time (UTC). For example: @2019-06-13T21:36:34Z@.
streamJournalToKinesis_exclusiveEndTime :: Lens.Lens' StreamJournalToKinesis (Prelude.Maybe Prelude.UTCTime)
streamJournalToKinesis_exclusiveEndTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> StreamJournalToKinesis -> f StreamJournalToKinesis
streamJournalToKinesis_exclusiveEndTime = (StreamJournalToKinesis -> Maybe POSIX)
-> (StreamJournalToKinesis
    -> Maybe POSIX -> StreamJournalToKinesis)
-> Lens
     StreamJournalToKinesis
     StreamJournalToKinesis
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamJournalToKinesis' {Maybe POSIX
exclusiveEndTime :: Maybe POSIX
$sel:exclusiveEndTime:StreamJournalToKinesis' :: StreamJournalToKinesis -> Maybe POSIX
exclusiveEndTime} -> Maybe POSIX
exclusiveEndTime) (\s :: StreamJournalToKinesis
s@StreamJournalToKinesis' {} Maybe POSIX
a -> StreamJournalToKinesis
s {$sel:exclusiveEndTime:StreamJournalToKinesis' :: Maybe POSIX
exclusiveEndTime = Maybe POSIX
a} :: StreamJournalToKinesis) ((Maybe POSIX -> f (Maybe POSIX))
 -> StreamJournalToKinesis -> f StreamJournalToKinesis)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> StreamJournalToKinesis
-> f StreamJournalToKinesis
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The key-value pairs to add as tags to the stream that you want to
-- create. Tag keys are case sensitive. Tag values are case sensitive and
-- can be null.
streamJournalToKinesis_tags :: Lens.Lens' StreamJournalToKinesis (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
streamJournalToKinesis_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> StreamJournalToKinesis -> f StreamJournalToKinesis
streamJournalToKinesis_tags = (StreamJournalToKinesis -> Maybe (HashMap Text Text))
-> (StreamJournalToKinesis
    -> Maybe (HashMap Text Text) -> StreamJournalToKinesis)
-> Lens
     StreamJournalToKinesis
     StreamJournalToKinesis
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamJournalToKinesis' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:StreamJournalToKinesis' :: StreamJournalToKinesis -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: StreamJournalToKinesis
s@StreamJournalToKinesis' {} Maybe (HashMap Text Text)
a -> StreamJournalToKinesis
s {$sel:tags:StreamJournalToKinesis' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: StreamJournalToKinesis) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> StreamJournalToKinesis -> f StreamJournalToKinesis)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> StreamJournalToKinesis
-> f StreamJournalToKinesis
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the ledger.
streamJournalToKinesis_ledgerName :: Lens.Lens' StreamJournalToKinesis Prelude.Text
streamJournalToKinesis_ledgerName :: (Text -> f Text)
-> StreamJournalToKinesis -> f StreamJournalToKinesis
streamJournalToKinesis_ledgerName = (StreamJournalToKinesis -> Text)
-> (StreamJournalToKinesis -> Text -> StreamJournalToKinesis)
-> Lens StreamJournalToKinesis StreamJournalToKinesis Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamJournalToKinesis' {Text
ledgerName :: Text
$sel:ledgerName:StreamJournalToKinesis' :: StreamJournalToKinesis -> Text
ledgerName} -> Text
ledgerName) (\s :: StreamJournalToKinesis
s@StreamJournalToKinesis' {} Text
a -> StreamJournalToKinesis
s {$sel:ledgerName:StreamJournalToKinesis' :: Text
ledgerName = Text
a} :: StreamJournalToKinesis)

-- | The Amazon Resource Name (ARN) of the IAM role that grants QLDB
-- permissions for a journal stream to write data records to a Kinesis Data
-- Streams resource.
streamJournalToKinesis_roleArn :: Lens.Lens' StreamJournalToKinesis Prelude.Text
streamJournalToKinesis_roleArn :: (Text -> f Text)
-> StreamJournalToKinesis -> f StreamJournalToKinesis
streamJournalToKinesis_roleArn = (StreamJournalToKinesis -> Text)
-> (StreamJournalToKinesis -> Text -> StreamJournalToKinesis)
-> Lens StreamJournalToKinesis StreamJournalToKinesis Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamJournalToKinesis' {Text
roleArn :: Text
$sel:roleArn:StreamJournalToKinesis' :: StreamJournalToKinesis -> Text
roleArn} -> Text
roleArn) (\s :: StreamJournalToKinesis
s@StreamJournalToKinesis' {} Text
a -> StreamJournalToKinesis
s {$sel:roleArn:StreamJournalToKinesis' :: Text
roleArn = Text
a} :: StreamJournalToKinesis)

-- | The inclusive start date and time from which to start streaming journal
-- data. This parameter must be in @ISO 8601@ date and time format and in
-- Universal Coordinated Time (UTC). For example: @2019-06-13T21:36:34Z@.
--
-- The @InclusiveStartTime@ cannot be in the future and must be before
-- @ExclusiveEndTime@.
--
-- If you provide an @InclusiveStartTime@ that is before the ledger\'s
-- @CreationDateTime@, QLDB effectively defaults it to the ledger\'s
-- @CreationDateTime@.
streamJournalToKinesis_inclusiveStartTime :: Lens.Lens' StreamJournalToKinesis Prelude.UTCTime
streamJournalToKinesis_inclusiveStartTime :: (UTCTime -> f UTCTime)
-> StreamJournalToKinesis -> f StreamJournalToKinesis
streamJournalToKinesis_inclusiveStartTime = (StreamJournalToKinesis -> POSIX)
-> (StreamJournalToKinesis -> POSIX -> StreamJournalToKinesis)
-> Lens StreamJournalToKinesis StreamJournalToKinesis POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamJournalToKinesis' {POSIX
inclusiveStartTime :: POSIX
$sel:inclusiveStartTime:StreamJournalToKinesis' :: StreamJournalToKinesis -> POSIX
inclusiveStartTime} -> POSIX
inclusiveStartTime) (\s :: StreamJournalToKinesis
s@StreamJournalToKinesis' {} POSIX
a -> StreamJournalToKinesis
s {$sel:inclusiveStartTime:StreamJournalToKinesis' :: POSIX
inclusiveStartTime = POSIX
a} :: StreamJournalToKinesis) ((POSIX -> f POSIX)
 -> StreamJournalToKinesis -> f StreamJournalToKinesis)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> StreamJournalToKinesis
-> f StreamJournalToKinesis
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The configuration settings of the Kinesis Data Streams destination for
-- your stream request.
streamJournalToKinesis_kinesisConfiguration :: Lens.Lens' StreamJournalToKinesis KinesisConfiguration
streamJournalToKinesis_kinesisConfiguration :: (KinesisConfiguration -> f KinesisConfiguration)
-> StreamJournalToKinesis -> f StreamJournalToKinesis
streamJournalToKinesis_kinesisConfiguration = (StreamJournalToKinesis -> KinesisConfiguration)
-> (StreamJournalToKinesis
    -> KinesisConfiguration -> StreamJournalToKinesis)
-> Lens
     StreamJournalToKinesis
     StreamJournalToKinesis
     KinesisConfiguration
     KinesisConfiguration
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamJournalToKinesis' {KinesisConfiguration
kinesisConfiguration :: KinesisConfiguration
$sel:kinesisConfiguration:StreamJournalToKinesis' :: StreamJournalToKinesis -> KinesisConfiguration
kinesisConfiguration} -> KinesisConfiguration
kinesisConfiguration) (\s :: StreamJournalToKinesis
s@StreamJournalToKinesis' {} KinesisConfiguration
a -> StreamJournalToKinesis
s {$sel:kinesisConfiguration:StreamJournalToKinesis' :: KinesisConfiguration
kinesisConfiguration = KinesisConfiguration
a} :: StreamJournalToKinesis)

-- | The name that you want to assign to the QLDB journal stream.
-- User-defined names can help identify and indicate the purpose of a
-- stream.
--
-- Your stream name must be unique among other /active/ streams for a given
-- ledger. Stream names have the same naming constraints as ledger names,
-- as defined in
-- <https://docs.aws.amazon.com/qldb/latest/developerguide/limits.html#limits.naming Quotas in Amazon QLDB>
-- in the /Amazon QLDB Developer Guide/.
streamJournalToKinesis_streamName :: Lens.Lens' StreamJournalToKinesis Prelude.Text
streamJournalToKinesis_streamName :: (Text -> f Text)
-> StreamJournalToKinesis -> f StreamJournalToKinesis
streamJournalToKinesis_streamName = (StreamJournalToKinesis -> Text)
-> (StreamJournalToKinesis -> Text -> StreamJournalToKinesis)
-> Lens StreamJournalToKinesis StreamJournalToKinesis Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamJournalToKinesis' {Text
streamName :: Text
$sel:streamName:StreamJournalToKinesis' :: StreamJournalToKinesis -> Text
streamName} -> Text
streamName) (\s :: StreamJournalToKinesis
s@StreamJournalToKinesis' {} Text
a -> StreamJournalToKinesis
s {$sel:streamName:StreamJournalToKinesis' :: Text
streamName = Text
a} :: StreamJournalToKinesis)

instance Core.AWSRequest StreamJournalToKinesis where
  type
    AWSResponse StreamJournalToKinesis =
      StreamJournalToKinesisResponse
  request :: StreamJournalToKinesis -> Request StreamJournalToKinesis
request = Service -> StreamJournalToKinesis -> Request StreamJournalToKinesis
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StreamJournalToKinesis
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StreamJournalToKinesis)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse StreamJournalToKinesis))
-> Logger
-> Service
-> Proxy StreamJournalToKinesis
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StreamJournalToKinesis)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> StreamJournalToKinesisResponse
StreamJournalToKinesisResponse'
            (Maybe Text -> Int -> StreamJournalToKinesisResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StreamJournalToKinesisResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"StreamId")
            Either String (Int -> StreamJournalToKinesisResponse)
-> Either String Int
-> Either String StreamJournalToKinesisResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable StreamJournalToKinesis

instance Prelude.NFData StreamJournalToKinesis

instance Core.ToHeaders StreamJournalToKinesis where
  toHeaders :: StreamJournalToKinesis -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StreamJournalToKinesis -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON StreamJournalToKinesis where
  toJSON :: StreamJournalToKinesis -> Value
toJSON StreamJournalToKinesis' {Maybe (HashMap Text Text)
Maybe POSIX
Text
POSIX
KinesisConfiguration
streamName :: Text
kinesisConfiguration :: KinesisConfiguration
inclusiveStartTime :: POSIX
roleArn :: Text
ledgerName :: Text
tags :: Maybe (HashMap Text Text)
exclusiveEndTime :: Maybe POSIX
$sel:streamName:StreamJournalToKinesis' :: StreamJournalToKinesis -> Text
$sel:kinesisConfiguration:StreamJournalToKinesis' :: StreamJournalToKinesis -> KinesisConfiguration
$sel:inclusiveStartTime:StreamJournalToKinesis' :: StreamJournalToKinesis -> POSIX
$sel:roleArn:StreamJournalToKinesis' :: StreamJournalToKinesis -> Text
$sel:ledgerName:StreamJournalToKinesis' :: StreamJournalToKinesis -> Text
$sel:tags:StreamJournalToKinesis' :: StreamJournalToKinesis -> Maybe (HashMap Text Text)
$sel:exclusiveEndTime:StreamJournalToKinesis' :: StreamJournalToKinesis -> Maybe POSIX
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ExclusiveEndTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
exclusiveEndTime,
            (Text
"Tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            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),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"InclusiveStartTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= POSIX
inclusiveStartTime),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"KinesisConfiguration"
                  Text -> KinesisConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= KinesisConfiguration
kinesisConfiguration
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"StreamName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
streamName)
          ]
      )

instance Core.ToPath StreamJournalToKinesis where
  toPath :: StreamJournalToKinesis -> ByteString
toPath StreamJournalToKinesis' {Maybe (HashMap Text Text)
Maybe POSIX
Text
POSIX
KinesisConfiguration
streamName :: Text
kinesisConfiguration :: KinesisConfiguration
inclusiveStartTime :: POSIX
roleArn :: Text
ledgerName :: Text
tags :: Maybe (HashMap Text Text)
exclusiveEndTime :: Maybe POSIX
$sel:streamName:StreamJournalToKinesis' :: StreamJournalToKinesis -> Text
$sel:kinesisConfiguration:StreamJournalToKinesis' :: StreamJournalToKinesis -> KinesisConfiguration
$sel:inclusiveStartTime:StreamJournalToKinesis' :: StreamJournalToKinesis -> POSIX
$sel:roleArn:StreamJournalToKinesis' :: StreamJournalToKinesis -> Text
$sel:ledgerName:StreamJournalToKinesis' :: StreamJournalToKinesis -> Text
$sel:tags:StreamJournalToKinesis' :: StreamJournalToKinesis -> Maybe (HashMap Text Text)
$sel:exclusiveEndTime:StreamJournalToKinesis' :: StreamJournalToKinesis -> Maybe POSIX
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/ledgers/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
ledgerName,
        ByteString
"/journal-kinesis-streams"
      ]

instance Core.ToQuery StreamJournalToKinesis where
  toQuery :: StreamJournalToKinesis -> QueryString
toQuery = QueryString -> StreamJournalToKinesis -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newStreamJournalToKinesisResponse' smart constructor.
data StreamJournalToKinesisResponse = StreamJournalToKinesisResponse'
  { -- | The UUID (represented in Base62-encoded text) that QLDB assigns to each
    -- QLDB journal stream.
    StreamJournalToKinesisResponse -> Maybe Text
streamId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    StreamJournalToKinesisResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StreamJournalToKinesisResponse
-> StreamJournalToKinesisResponse -> Bool
(StreamJournalToKinesisResponse
 -> StreamJournalToKinesisResponse -> Bool)
-> (StreamJournalToKinesisResponse
    -> StreamJournalToKinesisResponse -> Bool)
-> Eq StreamJournalToKinesisResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StreamJournalToKinesisResponse
-> StreamJournalToKinesisResponse -> Bool
$c/= :: StreamJournalToKinesisResponse
-> StreamJournalToKinesisResponse -> Bool
== :: StreamJournalToKinesisResponse
-> StreamJournalToKinesisResponse -> Bool
$c== :: StreamJournalToKinesisResponse
-> StreamJournalToKinesisResponse -> Bool
Prelude.Eq, ReadPrec [StreamJournalToKinesisResponse]
ReadPrec StreamJournalToKinesisResponse
Int -> ReadS StreamJournalToKinesisResponse
ReadS [StreamJournalToKinesisResponse]
(Int -> ReadS StreamJournalToKinesisResponse)
-> ReadS [StreamJournalToKinesisResponse]
-> ReadPrec StreamJournalToKinesisResponse
-> ReadPrec [StreamJournalToKinesisResponse]
-> Read StreamJournalToKinesisResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StreamJournalToKinesisResponse]
$creadListPrec :: ReadPrec [StreamJournalToKinesisResponse]
readPrec :: ReadPrec StreamJournalToKinesisResponse
$creadPrec :: ReadPrec StreamJournalToKinesisResponse
readList :: ReadS [StreamJournalToKinesisResponse]
$creadList :: ReadS [StreamJournalToKinesisResponse]
readsPrec :: Int -> ReadS StreamJournalToKinesisResponse
$creadsPrec :: Int -> ReadS StreamJournalToKinesisResponse
Prelude.Read, Int -> StreamJournalToKinesisResponse -> ShowS
[StreamJournalToKinesisResponse] -> ShowS
StreamJournalToKinesisResponse -> String
(Int -> StreamJournalToKinesisResponse -> ShowS)
-> (StreamJournalToKinesisResponse -> String)
-> ([StreamJournalToKinesisResponse] -> ShowS)
-> Show StreamJournalToKinesisResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StreamJournalToKinesisResponse] -> ShowS
$cshowList :: [StreamJournalToKinesisResponse] -> ShowS
show :: StreamJournalToKinesisResponse -> String
$cshow :: StreamJournalToKinesisResponse -> String
showsPrec :: Int -> StreamJournalToKinesisResponse -> ShowS
$cshowsPrec :: Int -> StreamJournalToKinesisResponse -> ShowS
Prelude.Show, (forall x.
 StreamJournalToKinesisResponse
 -> Rep StreamJournalToKinesisResponse x)
-> (forall x.
    Rep StreamJournalToKinesisResponse x
    -> StreamJournalToKinesisResponse)
-> Generic StreamJournalToKinesisResponse
forall x.
Rep StreamJournalToKinesisResponse x
-> StreamJournalToKinesisResponse
forall x.
StreamJournalToKinesisResponse
-> Rep StreamJournalToKinesisResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StreamJournalToKinesisResponse x
-> StreamJournalToKinesisResponse
$cfrom :: forall x.
StreamJournalToKinesisResponse
-> Rep StreamJournalToKinesisResponse x
Prelude.Generic)

-- |
-- Create a value of 'StreamJournalToKinesisResponse' 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:
--
-- 'streamId', 'streamJournalToKinesisResponse_streamId' - The UUID (represented in Base62-encoded text) that QLDB assigns to each
-- QLDB journal stream.
--
-- 'httpStatus', 'streamJournalToKinesisResponse_httpStatus' - The response's http status code.
newStreamJournalToKinesisResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StreamJournalToKinesisResponse
newStreamJournalToKinesisResponse :: Int -> StreamJournalToKinesisResponse
newStreamJournalToKinesisResponse Int
pHttpStatus_ =
  StreamJournalToKinesisResponse' :: Maybe Text -> Int -> StreamJournalToKinesisResponse
StreamJournalToKinesisResponse'
    { $sel:streamId:StreamJournalToKinesisResponse' :: Maybe Text
streamId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StreamJournalToKinesisResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The UUID (represented in Base62-encoded text) that QLDB assigns to each
-- QLDB journal stream.
streamJournalToKinesisResponse_streamId :: Lens.Lens' StreamJournalToKinesisResponse (Prelude.Maybe Prelude.Text)
streamJournalToKinesisResponse_streamId :: (Maybe Text -> f (Maybe Text))
-> StreamJournalToKinesisResponse
-> f StreamJournalToKinesisResponse
streamJournalToKinesisResponse_streamId = (StreamJournalToKinesisResponse -> Maybe Text)
-> (StreamJournalToKinesisResponse
    -> Maybe Text -> StreamJournalToKinesisResponse)
-> Lens
     StreamJournalToKinesisResponse
     StreamJournalToKinesisResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamJournalToKinesisResponse' {Maybe Text
streamId :: Maybe Text
$sel:streamId:StreamJournalToKinesisResponse' :: StreamJournalToKinesisResponse -> Maybe Text
streamId} -> Maybe Text
streamId) (\s :: StreamJournalToKinesisResponse
s@StreamJournalToKinesisResponse' {} Maybe Text
a -> StreamJournalToKinesisResponse
s {$sel:streamId:StreamJournalToKinesisResponse' :: Maybe Text
streamId = Maybe Text
a} :: StreamJournalToKinesisResponse)

-- | The response's http status code.
streamJournalToKinesisResponse_httpStatus :: Lens.Lens' StreamJournalToKinesisResponse Prelude.Int
streamJournalToKinesisResponse_httpStatus :: (Int -> f Int)
-> StreamJournalToKinesisResponse
-> f StreamJournalToKinesisResponse
streamJournalToKinesisResponse_httpStatus = (StreamJournalToKinesisResponse -> Int)
-> (StreamJournalToKinesisResponse
    -> Int -> StreamJournalToKinesisResponse)
-> Lens
     StreamJournalToKinesisResponse
     StreamJournalToKinesisResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamJournalToKinesisResponse' {Int
httpStatus :: Int
$sel:httpStatus:StreamJournalToKinesisResponse' :: StreamJournalToKinesisResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StreamJournalToKinesisResponse
s@StreamJournalToKinesisResponse' {} Int
a -> StreamJournalToKinesisResponse
s {$sel:httpStatus:StreamJournalToKinesisResponse' :: Int
httpStatus = Int
a} :: StreamJournalToKinesisResponse)

instance
  Prelude.NFData
    StreamJournalToKinesisResponse