{-# 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.IoT.Types.StreamSummary
-- 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.IoT.Types.StreamSummary where

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

-- | A summary of a stream.
--
-- /See:/ 'newStreamSummary' smart constructor.
data StreamSummary = StreamSummary'
  { -- | The stream version.
    StreamSummary -> Maybe Natural
streamVersion :: Prelude.Maybe Prelude.Natural,
    -- | The stream ARN.
    StreamSummary -> Maybe Text
streamArn :: Prelude.Maybe Prelude.Text,
    -- | A description of the stream.
    StreamSummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The stream ID.
    StreamSummary -> Maybe Text
streamId :: Prelude.Maybe Prelude.Text
  }
  deriving (StreamSummary -> StreamSummary -> Bool
(StreamSummary -> StreamSummary -> Bool)
-> (StreamSummary -> StreamSummary -> Bool) -> Eq StreamSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StreamSummary -> StreamSummary -> Bool
$c/= :: StreamSummary -> StreamSummary -> Bool
== :: StreamSummary -> StreamSummary -> Bool
$c== :: StreamSummary -> StreamSummary -> Bool
Prelude.Eq, ReadPrec [StreamSummary]
ReadPrec StreamSummary
Int -> ReadS StreamSummary
ReadS [StreamSummary]
(Int -> ReadS StreamSummary)
-> ReadS [StreamSummary]
-> ReadPrec StreamSummary
-> ReadPrec [StreamSummary]
-> Read StreamSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StreamSummary]
$creadListPrec :: ReadPrec [StreamSummary]
readPrec :: ReadPrec StreamSummary
$creadPrec :: ReadPrec StreamSummary
readList :: ReadS [StreamSummary]
$creadList :: ReadS [StreamSummary]
readsPrec :: Int -> ReadS StreamSummary
$creadsPrec :: Int -> ReadS StreamSummary
Prelude.Read, Int -> StreamSummary -> ShowS
[StreamSummary] -> ShowS
StreamSummary -> String
(Int -> StreamSummary -> ShowS)
-> (StreamSummary -> String)
-> ([StreamSummary] -> ShowS)
-> Show StreamSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StreamSummary] -> ShowS
$cshowList :: [StreamSummary] -> ShowS
show :: StreamSummary -> String
$cshow :: StreamSummary -> String
showsPrec :: Int -> StreamSummary -> ShowS
$cshowsPrec :: Int -> StreamSummary -> ShowS
Prelude.Show, (forall x. StreamSummary -> Rep StreamSummary x)
-> (forall x. Rep StreamSummary x -> StreamSummary)
-> Generic StreamSummary
forall x. Rep StreamSummary x -> StreamSummary
forall x. StreamSummary -> Rep StreamSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StreamSummary x -> StreamSummary
$cfrom :: forall x. StreamSummary -> Rep StreamSummary x
Prelude.Generic)

-- |
-- Create a value of 'StreamSummary' 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:
--
-- 'streamVersion', 'streamSummary_streamVersion' - The stream version.
--
-- 'streamArn', 'streamSummary_streamArn' - The stream ARN.
--
-- 'description', 'streamSummary_description' - A description of the stream.
--
-- 'streamId', 'streamSummary_streamId' - The stream ID.
newStreamSummary ::
  StreamSummary
newStreamSummary :: StreamSummary
newStreamSummary =
  StreamSummary' :: Maybe Natural
-> Maybe Text -> Maybe Text -> Maybe Text -> StreamSummary
StreamSummary'
    { $sel:streamVersion:StreamSummary' :: Maybe Natural
streamVersion = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:streamArn:StreamSummary' :: Maybe Text
streamArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:StreamSummary' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:streamId:StreamSummary' :: Maybe Text
streamId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The stream version.
streamSummary_streamVersion :: Lens.Lens' StreamSummary (Prelude.Maybe Prelude.Natural)
streamSummary_streamVersion :: (Maybe Natural -> f (Maybe Natural))
-> StreamSummary -> f StreamSummary
streamSummary_streamVersion = (StreamSummary -> Maybe Natural)
-> (StreamSummary -> Maybe Natural -> StreamSummary)
-> Lens StreamSummary StreamSummary (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamSummary' {Maybe Natural
streamVersion :: Maybe Natural
$sel:streamVersion:StreamSummary' :: StreamSummary -> Maybe Natural
streamVersion} -> Maybe Natural
streamVersion) (\s :: StreamSummary
s@StreamSummary' {} Maybe Natural
a -> StreamSummary
s {$sel:streamVersion:StreamSummary' :: Maybe Natural
streamVersion = Maybe Natural
a} :: StreamSummary)

-- | The stream ARN.
streamSummary_streamArn :: Lens.Lens' StreamSummary (Prelude.Maybe Prelude.Text)
streamSummary_streamArn :: (Maybe Text -> f (Maybe Text)) -> StreamSummary -> f StreamSummary
streamSummary_streamArn = (StreamSummary -> Maybe Text)
-> (StreamSummary -> Maybe Text -> StreamSummary)
-> Lens StreamSummary StreamSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamSummary' {Maybe Text
streamArn :: Maybe Text
$sel:streamArn:StreamSummary' :: StreamSummary -> Maybe Text
streamArn} -> Maybe Text
streamArn) (\s :: StreamSummary
s@StreamSummary' {} Maybe Text
a -> StreamSummary
s {$sel:streamArn:StreamSummary' :: Maybe Text
streamArn = Maybe Text
a} :: StreamSummary)

-- | A description of the stream.
streamSummary_description :: Lens.Lens' StreamSummary (Prelude.Maybe Prelude.Text)
streamSummary_description :: (Maybe Text -> f (Maybe Text)) -> StreamSummary -> f StreamSummary
streamSummary_description = (StreamSummary -> Maybe Text)
-> (StreamSummary -> Maybe Text -> StreamSummary)
-> Lens StreamSummary StreamSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamSummary' {Maybe Text
description :: Maybe Text
$sel:description:StreamSummary' :: StreamSummary -> Maybe Text
description} -> Maybe Text
description) (\s :: StreamSummary
s@StreamSummary' {} Maybe Text
a -> StreamSummary
s {$sel:description:StreamSummary' :: Maybe Text
description = Maybe Text
a} :: StreamSummary)

-- | The stream ID.
streamSummary_streamId :: Lens.Lens' StreamSummary (Prelude.Maybe Prelude.Text)
streamSummary_streamId :: (Maybe Text -> f (Maybe Text)) -> StreamSummary -> f StreamSummary
streamSummary_streamId = (StreamSummary -> Maybe Text)
-> (StreamSummary -> Maybe Text -> StreamSummary)
-> Lens StreamSummary StreamSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamSummary' {Maybe Text
streamId :: Maybe Text
$sel:streamId:StreamSummary' :: StreamSummary -> Maybe Text
streamId} -> Maybe Text
streamId) (\s :: StreamSummary
s@StreamSummary' {} Maybe Text
a -> StreamSummary
s {$sel:streamId:StreamSummary' :: Maybe Text
streamId = Maybe Text
a} :: StreamSummary)

instance Core.FromJSON StreamSummary where
  parseJSON :: Value -> Parser StreamSummary
parseJSON =
    String
-> (Object -> Parser StreamSummary)
-> Value
-> Parser StreamSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StreamSummary"
      ( \Object
x ->
          Maybe Natural
-> Maybe Text -> Maybe Text -> Maybe Text -> StreamSummary
StreamSummary'
            (Maybe Natural
 -> Maybe Text -> Maybe Text -> Maybe Text -> StreamSummary)
-> Parser (Maybe Natural)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> StreamSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"streamVersion")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> StreamSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> StreamSummary)
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 Text -> Maybe Text -> StreamSummary)
-> Parser (Maybe Text) -> Parser (Maybe Text -> StreamSummary)
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
"description")
            Parser (Maybe Text -> StreamSummary)
-> Parser (Maybe Text) -> Parser StreamSummary
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
"streamId")
      )

instance Prelude.Hashable StreamSummary

instance Prelude.NFData StreamSummary