{-# 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.DynamoDBStreams.Types.StreamDescription
-- 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.DynamoDBStreams.Types.StreamDescription where

import qualified Amazonka.Core as Core
import Amazonka.DynamoDBStreams.Types.KeySchemaElement
import Amazonka.DynamoDBStreams.Types.Shard
import Amazonka.DynamoDBStreams.Types.StreamStatus
import Amazonka.DynamoDBStreams.Types.StreamViewType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents all of the data describing a particular stream.
--
-- /See:/ 'newStreamDescription' smart constructor.
data StreamDescription = StreamDescription'
  { -- | The shard ID of the item where the operation stopped, inclusive of the
    -- previous result set. Use this value to start a new operation, excluding
    -- this value in the new request.
    --
    -- If @LastEvaluatedShardId@ is empty, then the \"last page\" of results
    -- has been processed and there is currently no more data to be retrieved.
    --
    -- If @LastEvaluatedShardId@ is not empty, it does not necessarily mean
    -- that there is more data in the result set. The only way to know when you
    -- have reached the end of the result set is when @LastEvaluatedShardId@ is
    -- empty.
    StreamDescription -> Maybe Text
lastEvaluatedShardId :: Prelude.Maybe Prelude.Text,
    -- | A timestamp, in ISO 8601 format, for this stream.
    --
    -- Note that @LatestStreamLabel@ is not a unique identifier for the stream,
    -- because it is possible that a stream from another table might have the
    -- same timestamp. However, the combination of the following three elements
    -- is guaranteed to be unique:
    --
    -- -   the AWS customer ID.
    --
    -- -   the table name
    --
    -- -   the @StreamLabel@
    StreamDescription -> Maybe Text
streamLabel :: Prelude.Maybe Prelude.Text,
    -- | Indicates the current status of the stream:
    --
    -- -   @ENABLING@ - Streams is currently being enabled on the DynamoDB
    --     table.
    --
    -- -   @ENABLED@ - the stream is enabled.
    --
    -- -   @DISABLING@ - Streams is currently being disabled on the DynamoDB
    --     table.
    --
    -- -   @DISABLED@ - the stream is disabled.
    StreamDescription -> Maybe StreamStatus
streamStatus :: Prelude.Maybe StreamStatus,
    -- | The key attribute(s) of the stream\'s DynamoDB table.
    StreamDescription -> Maybe (NonEmpty KeySchemaElement)
keySchema :: Prelude.Maybe (Prelude.NonEmpty KeySchemaElement),
    -- | Indicates the format of the records within this stream:
    --
    -- -   @KEYS_ONLY@ - only the key attributes of items that were modified in
    --     the DynamoDB table.
    --
    -- -   @NEW_IMAGE@ - entire items from the table, as they appeared after
    --     they were modified.
    --
    -- -   @OLD_IMAGE@ - entire items from the table, as they appeared before
    --     they were modified.
    --
    -- -   @NEW_AND_OLD_IMAGES@ - both the new and the old images of the items
    --     from the table.
    StreamDescription -> Maybe StreamViewType
streamViewType :: Prelude.Maybe StreamViewType,
    -- | The Amazon Resource Name (ARN) for the stream.
    StreamDescription -> Maybe Text
streamArn :: Prelude.Maybe Prelude.Text,
    -- | The shards that comprise the stream.
    StreamDescription -> Maybe [Shard]
shards :: Prelude.Maybe [Shard],
    -- | The DynamoDB table with which the stream is associated.
    StreamDescription -> Maybe Text
tableName :: Prelude.Maybe Prelude.Text,
    -- | The date and time when the request to create this stream was issued.
    StreamDescription -> Maybe POSIX
creationRequestDateTime :: Prelude.Maybe Core.POSIX
  }
  deriving (StreamDescription -> StreamDescription -> Bool
(StreamDescription -> StreamDescription -> Bool)
-> (StreamDescription -> StreamDescription -> Bool)
-> Eq StreamDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StreamDescription -> StreamDescription -> Bool
$c/= :: StreamDescription -> StreamDescription -> Bool
== :: StreamDescription -> StreamDescription -> Bool
$c== :: StreamDescription -> StreamDescription -> Bool
Prelude.Eq, ReadPrec [StreamDescription]
ReadPrec StreamDescription
Int -> ReadS StreamDescription
ReadS [StreamDescription]
(Int -> ReadS StreamDescription)
-> ReadS [StreamDescription]
-> ReadPrec StreamDescription
-> ReadPrec [StreamDescription]
-> Read StreamDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StreamDescription]
$creadListPrec :: ReadPrec [StreamDescription]
readPrec :: ReadPrec StreamDescription
$creadPrec :: ReadPrec StreamDescription
readList :: ReadS [StreamDescription]
$creadList :: ReadS [StreamDescription]
readsPrec :: Int -> ReadS StreamDescription
$creadsPrec :: Int -> ReadS StreamDescription
Prelude.Read, Int -> StreamDescription -> ShowS
[StreamDescription] -> ShowS
StreamDescription -> String
(Int -> StreamDescription -> ShowS)
-> (StreamDescription -> String)
-> ([StreamDescription] -> ShowS)
-> Show StreamDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StreamDescription] -> ShowS
$cshowList :: [StreamDescription] -> ShowS
show :: StreamDescription -> String
$cshow :: StreamDescription -> String
showsPrec :: Int -> StreamDescription -> ShowS
$cshowsPrec :: Int -> StreamDescription -> ShowS
Prelude.Show, (forall x. StreamDescription -> Rep StreamDescription x)
-> (forall x. Rep StreamDescription x -> StreamDescription)
-> Generic StreamDescription
forall x. Rep StreamDescription x -> StreamDescription
forall x. StreamDescription -> Rep StreamDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StreamDescription x -> StreamDescription
$cfrom :: forall x. StreamDescription -> Rep StreamDescription x
Prelude.Generic)

-- |
-- Create a value of 'StreamDescription' 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:
--
-- 'lastEvaluatedShardId', 'streamDescription_lastEvaluatedShardId' - The shard ID of the item where the operation stopped, inclusive of the
-- previous result set. Use this value to start a new operation, excluding
-- this value in the new request.
--
-- If @LastEvaluatedShardId@ is empty, then the \"last page\" of results
-- has been processed and there is currently no more data to be retrieved.
--
-- If @LastEvaluatedShardId@ is not empty, it does not necessarily mean
-- that there is more data in the result set. The only way to know when you
-- have reached the end of the result set is when @LastEvaluatedShardId@ is
-- empty.
--
-- 'streamLabel', 'streamDescription_streamLabel' - A timestamp, in ISO 8601 format, for this stream.
--
-- Note that @LatestStreamLabel@ is not a unique identifier for the stream,
-- because it is possible that a stream from another table might have the
-- same timestamp. However, the combination of the following three elements
-- is guaranteed to be unique:
--
-- -   the AWS customer ID.
--
-- -   the table name
--
-- -   the @StreamLabel@
--
-- 'streamStatus', 'streamDescription_streamStatus' - Indicates the current status of the stream:
--
-- -   @ENABLING@ - Streams is currently being enabled on the DynamoDB
--     table.
--
-- -   @ENABLED@ - the stream is enabled.
--
-- -   @DISABLING@ - Streams is currently being disabled on the DynamoDB
--     table.
--
-- -   @DISABLED@ - the stream is disabled.
--
-- 'keySchema', 'streamDescription_keySchema' - The key attribute(s) of the stream\'s DynamoDB table.
--
-- 'streamViewType', 'streamDescription_streamViewType' - Indicates the format of the records within this stream:
--
-- -   @KEYS_ONLY@ - only the key attributes of items that were modified in
--     the DynamoDB table.
--
-- -   @NEW_IMAGE@ - entire items from the table, as they appeared after
--     they were modified.
--
-- -   @OLD_IMAGE@ - entire items from the table, as they appeared before
--     they were modified.
--
-- -   @NEW_AND_OLD_IMAGES@ - both the new and the old images of the items
--     from the table.
--
-- 'streamArn', 'streamDescription_streamArn' - The Amazon Resource Name (ARN) for the stream.
--
-- 'shards', 'streamDescription_shards' - The shards that comprise the stream.
--
-- 'tableName', 'streamDescription_tableName' - The DynamoDB table with which the stream is associated.
--
-- 'creationRequestDateTime', 'streamDescription_creationRequestDateTime' - The date and time when the request to create this stream was issued.
newStreamDescription ::
  StreamDescription
newStreamDescription :: StreamDescription
newStreamDescription =
  StreamDescription' :: Maybe Text
-> Maybe Text
-> Maybe StreamStatus
-> Maybe (NonEmpty KeySchemaElement)
-> Maybe StreamViewType
-> Maybe Text
-> Maybe [Shard]
-> Maybe Text
-> Maybe POSIX
-> StreamDescription
StreamDescription'
    { $sel:lastEvaluatedShardId:StreamDescription' :: Maybe Text
lastEvaluatedShardId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:streamLabel:StreamDescription' :: Maybe Text
streamLabel = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:streamStatus:StreamDescription' :: Maybe StreamStatus
streamStatus = Maybe StreamStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:keySchema:StreamDescription' :: Maybe (NonEmpty KeySchemaElement)
keySchema = Maybe (NonEmpty KeySchemaElement)
forall a. Maybe a
Prelude.Nothing,
      $sel:streamViewType:StreamDescription' :: Maybe StreamViewType
streamViewType = Maybe StreamViewType
forall a. Maybe a
Prelude.Nothing,
      $sel:streamArn:StreamDescription' :: Maybe Text
streamArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:shards:StreamDescription' :: Maybe [Shard]
shards = Maybe [Shard]
forall a. Maybe a
Prelude.Nothing,
      $sel:tableName:StreamDescription' :: Maybe Text
tableName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationRequestDateTime:StreamDescription' :: Maybe POSIX
creationRequestDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The shard ID of the item where the operation stopped, inclusive of the
-- previous result set. Use this value to start a new operation, excluding
-- this value in the new request.
--
-- If @LastEvaluatedShardId@ is empty, then the \"last page\" of results
-- has been processed and there is currently no more data to be retrieved.
--
-- If @LastEvaluatedShardId@ is not empty, it does not necessarily mean
-- that there is more data in the result set. The only way to know when you
-- have reached the end of the result set is when @LastEvaluatedShardId@ is
-- empty.
streamDescription_lastEvaluatedShardId :: Lens.Lens' StreamDescription (Prelude.Maybe Prelude.Text)
streamDescription_lastEvaluatedShardId :: (Maybe Text -> f (Maybe Text))
-> StreamDescription -> f StreamDescription
streamDescription_lastEvaluatedShardId = (StreamDescription -> Maybe Text)
-> (StreamDescription -> Maybe Text -> StreamDescription)
-> Lens
     StreamDescription StreamDescription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamDescription' {Maybe Text
lastEvaluatedShardId :: Maybe Text
$sel:lastEvaluatedShardId:StreamDescription' :: StreamDescription -> Maybe Text
lastEvaluatedShardId} -> Maybe Text
lastEvaluatedShardId) (\s :: StreamDescription
s@StreamDescription' {} Maybe Text
a -> StreamDescription
s {$sel:lastEvaluatedShardId:StreamDescription' :: Maybe Text
lastEvaluatedShardId = Maybe Text
a} :: StreamDescription)

-- | A timestamp, in ISO 8601 format, for this stream.
--
-- Note that @LatestStreamLabel@ is not a unique identifier for the stream,
-- because it is possible that a stream from another table might have the
-- same timestamp. However, the combination of the following three elements
-- is guaranteed to be unique:
--
-- -   the AWS customer ID.
--
-- -   the table name
--
-- -   the @StreamLabel@
streamDescription_streamLabel :: Lens.Lens' StreamDescription (Prelude.Maybe Prelude.Text)
streamDescription_streamLabel :: (Maybe Text -> f (Maybe Text))
-> StreamDescription -> f StreamDescription
streamDescription_streamLabel = (StreamDescription -> Maybe Text)
-> (StreamDescription -> Maybe Text -> StreamDescription)
-> Lens
     StreamDescription StreamDescription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamDescription' {Maybe Text
streamLabel :: Maybe Text
$sel:streamLabel:StreamDescription' :: StreamDescription -> Maybe Text
streamLabel} -> Maybe Text
streamLabel) (\s :: StreamDescription
s@StreamDescription' {} Maybe Text
a -> StreamDescription
s {$sel:streamLabel:StreamDescription' :: Maybe Text
streamLabel = Maybe Text
a} :: StreamDescription)

-- | Indicates the current status of the stream:
--
-- -   @ENABLING@ - Streams is currently being enabled on the DynamoDB
--     table.
--
-- -   @ENABLED@ - the stream is enabled.
--
-- -   @DISABLING@ - Streams is currently being disabled on the DynamoDB
--     table.
--
-- -   @DISABLED@ - the stream is disabled.
streamDescription_streamStatus :: Lens.Lens' StreamDescription (Prelude.Maybe StreamStatus)
streamDescription_streamStatus :: (Maybe StreamStatus -> f (Maybe StreamStatus))
-> StreamDescription -> f StreamDescription
streamDescription_streamStatus = (StreamDescription -> Maybe StreamStatus)
-> (StreamDescription -> Maybe StreamStatus -> StreamDescription)
-> Lens
     StreamDescription
     StreamDescription
     (Maybe StreamStatus)
     (Maybe StreamStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamDescription' {Maybe StreamStatus
streamStatus :: Maybe StreamStatus
$sel:streamStatus:StreamDescription' :: StreamDescription -> Maybe StreamStatus
streamStatus} -> Maybe StreamStatus
streamStatus) (\s :: StreamDescription
s@StreamDescription' {} Maybe StreamStatus
a -> StreamDescription
s {$sel:streamStatus:StreamDescription' :: Maybe StreamStatus
streamStatus = Maybe StreamStatus
a} :: StreamDescription)

-- | The key attribute(s) of the stream\'s DynamoDB table.
streamDescription_keySchema :: Lens.Lens' StreamDescription (Prelude.Maybe (Prelude.NonEmpty KeySchemaElement))
streamDescription_keySchema :: (Maybe (NonEmpty KeySchemaElement)
 -> f (Maybe (NonEmpty KeySchemaElement)))
-> StreamDescription -> f StreamDescription
streamDescription_keySchema = (StreamDescription -> Maybe (NonEmpty KeySchemaElement))
-> (StreamDescription
    -> Maybe (NonEmpty KeySchemaElement) -> StreamDescription)
-> Lens
     StreamDescription
     StreamDescription
     (Maybe (NonEmpty KeySchemaElement))
     (Maybe (NonEmpty KeySchemaElement))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamDescription' {Maybe (NonEmpty KeySchemaElement)
keySchema :: Maybe (NonEmpty KeySchemaElement)
$sel:keySchema:StreamDescription' :: StreamDescription -> Maybe (NonEmpty KeySchemaElement)
keySchema} -> Maybe (NonEmpty KeySchemaElement)
keySchema) (\s :: StreamDescription
s@StreamDescription' {} Maybe (NonEmpty KeySchemaElement)
a -> StreamDescription
s {$sel:keySchema:StreamDescription' :: Maybe (NonEmpty KeySchemaElement)
keySchema = Maybe (NonEmpty KeySchemaElement)
a} :: StreamDescription) ((Maybe (NonEmpty KeySchemaElement)
  -> f (Maybe (NonEmpty KeySchemaElement)))
 -> StreamDescription -> f StreamDescription)
-> ((Maybe (NonEmpty KeySchemaElement)
     -> f (Maybe (NonEmpty KeySchemaElement)))
    -> Maybe (NonEmpty KeySchemaElement)
    -> f (Maybe (NonEmpty KeySchemaElement)))
-> (Maybe (NonEmpty KeySchemaElement)
    -> f (Maybe (NonEmpty KeySchemaElement)))
-> StreamDescription
-> f StreamDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty KeySchemaElement)
  (NonEmpty KeySchemaElement)
  (NonEmpty KeySchemaElement)
  (NonEmpty KeySchemaElement)
-> Iso
     (Maybe (NonEmpty KeySchemaElement))
     (Maybe (NonEmpty KeySchemaElement))
     (Maybe (NonEmpty KeySchemaElement))
     (Maybe (NonEmpty KeySchemaElement))
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
  (NonEmpty KeySchemaElement)
  (NonEmpty KeySchemaElement)
  (NonEmpty KeySchemaElement)
  (NonEmpty KeySchemaElement)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Indicates the format of the records within this stream:
--
-- -   @KEYS_ONLY@ - only the key attributes of items that were modified in
--     the DynamoDB table.
--
-- -   @NEW_IMAGE@ - entire items from the table, as they appeared after
--     they were modified.
--
-- -   @OLD_IMAGE@ - entire items from the table, as they appeared before
--     they were modified.
--
-- -   @NEW_AND_OLD_IMAGES@ - both the new and the old images of the items
--     from the table.
streamDescription_streamViewType :: Lens.Lens' StreamDescription (Prelude.Maybe StreamViewType)
streamDescription_streamViewType :: (Maybe StreamViewType -> f (Maybe StreamViewType))
-> StreamDescription -> f StreamDescription
streamDescription_streamViewType = (StreamDescription -> Maybe StreamViewType)
-> (StreamDescription -> Maybe StreamViewType -> StreamDescription)
-> Lens
     StreamDescription
     StreamDescription
     (Maybe StreamViewType)
     (Maybe StreamViewType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamDescription' {Maybe StreamViewType
streamViewType :: Maybe StreamViewType
$sel:streamViewType:StreamDescription' :: StreamDescription -> Maybe StreamViewType
streamViewType} -> Maybe StreamViewType
streamViewType) (\s :: StreamDescription
s@StreamDescription' {} Maybe StreamViewType
a -> StreamDescription
s {$sel:streamViewType:StreamDescription' :: Maybe StreamViewType
streamViewType = Maybe StreamViewType
a} :: StreamDescription)

-- | The Amazon Resource Name (ARN) for the stream.
streamDescription_streamArn :: Lens.Lens' StreamDescription (Prelude.Maybe Prelude.Text)
streamDescription_streamArn :: (Maybe Text -> f (Maybe Text))
-> StreamDescription -> f StreamDescription
streamDescription_streamArn = (StreamDescription -> Maybe Text)
-> (StreamDescription -> Maybe Text -> StreamDescription)
-> Lens
     StreamDescription StreamDescription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamDescription' {Maybe Text
streamArn :: Maybe Text
$sel:streamArn:StreamDescription' :: StreamDescription -> Maybe Text
streamArn} -> Maybe Text
streamArn) (\s :: StreamDescription
s@StreamDescription' {} Maybe Text
a -> StreamDescription
s {$sel:streamArn:StreamDescription' :: Maybe Text
streamArn = Maybe Text
a} :: StreamDescription)

-- | The shards that comprise the stream.
streamDescription_shards :: Lens.Lens' StreamDescription (Prelude.Maybe [Shard])
streamDescription_shards :: (Maybe [Shard] -> f (Maybe [Shard]))
-> StreamDescription -> f StreamDescription
streamDescription_shards = (StreamDescription -> Maybe [Shard])
-> (StreamDescription -> Maybe [Shard] -> StreamDescription)
-> Lens
     StreamDescription StreamDescription (Maybe [Shard]) (Maybe [Shard])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamDescription' {Maybe [Shard]
shards :: Maybe [Shard]
$sel:shards:StreamDescription' :: StreamDescription -> Maybe [Shard]
shards} -> Maybe [Shard]
shards) (\s :: StreamDescription
s@StreamDescription' {} Maybe [Shard]
a -> StreamDescription
s {$sel:shards:StreamDescription' :: Maybe [Shard]
shards = Maybe [Shard]
a} :: StreamDescription) ((Maybe [Shard] -> f (Maybe [Shard]))
 -> StreamDescription -> f StreamDescription)
-> ((Maybe [Shard] -> f (Maybe [Shard]))
    -> Maybe [Shard] -> f (Maybe [Shard]))
-> (Maybe [Shard] -> f (Maybe [Shard]))
-> StreamDescription
-> f StreamDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Shard] [Shard] [Shard] [Shard]
-> Iso
     (Maybe [Shard]) (Maybe [Shard]) (Maybe [Shard]) (Maybe [Shard])
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 [Shard] [Shard] [Shard] [Shard]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The DynamoDB table with which the stream is associated.
streamDescription_tableName :: Lens.Lens' StreamDescription (Prelude.Maybe Prelude.Text)
streamDescription_tableName :: (Maybe Text -> f (Maybe Text))
-> StreamDescription -> f StreamDescription
streamDescription_tableName = (StreamDescription -> Maybe Text)
-> (StreamDescription -> Maybe Text -> StreamDescription)
-> Lens
     StreamDescription StreamDescription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamDescription' {Maybe Text
tableName :: Maybe Text
$sel:tableName:StreamDescription' :: StreamDescription -> Maybe Text
tableName} -> Maybe Text
tableName) (\s :: StreamDescription
s@StreamDescription' {} Maybe Text
a -> StreamDescription
s {$sel:tableName:StreamDescription' :: Maybe Text
tableName = Maybe Text
a} :: StreamDescription)

-- | The date and time when the request to create this stream was issued.
streamDescription_creationRequestDateTime :: Lens.Lens' StreamDescription (Prelude.Maybe Prelude.UTCTime)
streamDescription_creationRequestDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> StreamDescription -> f StreamDescription
streamDescription_creationRequestDateTime = (StreamDescription -> Maybe POSIX)
-> (StreamDescription -> Maybe POSIX -> StreamDescription)
-> Lens
     StreamDescription StreamDescription (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamDescription' {Maybe POSIX
creationRequestDateTime :: Maybe POSIX
$sel:creationRequestDateTime:StreamDescription' :: StreamDescription -> Maybe POSIX
creationRequestDateTime} -> Maybe POSIX
creationRequestDateTime) (\s :: StreamDescription
s@StreamDescription' {} Maybe POSIX
a -> StreamDescription
s {$sel:creationRequestDateTime:StreamDescription' :: Maybe POSIX
creationRequestDateTime = Maybe POSIX
a} :: StreamDescription) ((Maybe POSIX -> f (Maybe POSIX))
 -> StreamDescription -> f StreamDescription)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> StreamDescription
-> f StreamDescription
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

instance Core.FromJSON StreamDescription where
  parseJSON :: Value -> Parser StreamDescription
parseJSON =
    String
-> (Object -> Parser StreamDescription)
-> Value
-> Parser StreamDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StreamDescription"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe StreamStatus
-> Maybe (NonEmpty KeySchemaElement)
-> Maybe StreamViewType
-> Maybe Text
-> Maybe [Shard]
-> Maybe Text
-> Maybe POSIX
-> StreamDescription
StreamDescription'
            (Maybe Text
 -> Maybe Text
 -> Maybe StreamStatus
 -> Maybe (NonEmpty KeySchemaElement)
 -> Maybe StreamViewType
 -> Maybe Text
 -> Maybe [Shard]
 -> Maybe Text
 -> Maybe POSIX
 -> StreamDescription)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe StreamStatus
      -> Maybe (NonEmpty KeySchemaElement)
      -> Maybe StreamViewType
      -> Maybe Text
      -> Maybe [Shard]
      -> Maybe Text
      -> Maybe POSIX
      -> StreamDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastEvaluatedShardId")
            Parser
  (Maybe Text
   -> Maybe StreamStatus
   -> Maybe (NonEmpty KeySchemaElement)
   -> Maybe StreamViewType
   -> Maybe Text
   -> Maybe [Shard]
   -> Maybe Text
   -> Maybe POSIX
   -> StreamDescription)
-> Parser (Maybe Text)
-> Parser
     (Maybe StreamStatus
      -> Maybe (NonEmpty KeySchemaElement)
      -> Maybe StreamViewType
      -> Maybe Text
      -> Maybe [Shard]
      -> Maybe Text
      -> Maybe POSIX
      -> StreamDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StreamLabel")
            Parser
  (Maybe StreamStatus
   -> Maybe (NonEmpty KeySchemaElement)
   -> Maybe StreamViewType
   -> Maybe Text
   -> Maybe [Shard]
   -> Maybe Text
   -> Maybe POSIX
   -> StreamDescription)
-> Parser (Maybe StreamStatus)
-> Parser
     (Maybe (NonEmpty KeySchemaElement)
      -> Maybe StreamViewType
      -> Maybe Text
      -> Maybe [Shard]
      -> Maybe Text
      -> Maybe POSIX
      -> StreamDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe StreamStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StreamStatus")
            Parser
  (Maybe (NonEmpty KeySchemaElement)
   -> Maybe StreamViewType
   -> Maybe Text
   -> Maybe [Shard]
   -> Maybe Text
   -> Maybe POSIX
   -> StreamDescription)
-> Parser (Maybe (NonEmpty KeySchemaElement))
-> Parser
     (Maybe StreamViewType
      -> Maybe Text
      -> Maybe [Shard]
      -> Maybe Text
      -> Maybe POSIX
      -> StreamDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (NonEmpty KeySchemaElement))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"KeySchema")
            Parser
  (Maybe StreamViewType
   -> Maybe Text
   -> Maybe [Shard]
   -> Maybe Text
   -> Maybe POSIX
   -> StreamDescription)
-> Parser (Maybe StreamViewType)
-> Parser
     (Maybe Text
      -> Maybe [Shard] -> Maybe Text -> Maybe POSIX -> StreamDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe StreamViewType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StreamViewType")
            Parser
  (Maybe Text
   -> Maybe [Shard] -> Maybe Text -> Maybe POSIX -> StreamDescription)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Shard] -> Maybe Text -> Maybe POSIX -> StreamDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StreamArn")
            Parser
  (Maybe [Shard] -> Maybe Text -> Maybe POSIX -> StreamDescription)
-> Parser (Maybe [Shard])
-> Parser (Maybe Text -> Maybe POSIX -> StreamDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Shard]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Shards" Parser (Maybe (Maybe [Shard]))
-> Maybe [Shard] -> Parser (Maybe [Shard])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Shard]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Text -> Maybe POSIX -> StreamDescription)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> StreamDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TableName")
            Parser (Maybe POSIX -> StreamDescription)
-> Parser (Maybe POSIX) -> Parser StreamDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreationRequestDateTime")
      )

instance Prelude.Hashable StreamDescription

instance Prelude.NFData StreamDescription