{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoT.Types.StreamSummary 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

-- | A summary of a stream.
--
-- /See:/ 'newStreamSummary' smart constructor.
data StreamSummary = StreamSummary'
  { -- | A description of the stream.
    StreamSummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The stream ARN.
    StreamSummary -> Maybe Text
streamArn :: Prelude.Maybe Prelude.Text,
    -- | The stream ID.
    StreamSummary -> Maybe Text
streamId :: Prelude.Maybe Prelude.Text,
    -- | The stream version.
    StreamSummary -> Maybe Natural
streamVersion :: Prelude.Maybe Prelude.Natural
  }
  deriving (StreamSummary -> StreamSummary -> Bool
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]
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
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. 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:
--
-- 'description', 'streamSummary_description' - A description of the stream.
--
-- 'streamArn', 'streamSummary_streamArn' - The stream ARN.
--
-- 'streamId', 'streamSummary_streamId' - The stream ID.
--
-- 'streamVersion', 'streamSummary_streamVersion' - The stream version.
newStreamSummary ::
  StreamSummary
newStreamSummary :: StreamSummary
newStreamSummary =
  StreamSummary'
    { $sel:description:StreamSummary' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:streamArn:StreamSummary' :: Maybe Text
streamArn = forall a. Maybe a
Prelude.Nothing,
      $sel:streamId:StreamSummary' :: Maybe Text
streamId = forall a. Maybe a
Prelude.Nothing,
      $sel:streamVersion:StreamSummary' :: Maybe Natural
streamVersion = forall a. Maybe a
Prelude.Nothing
    }

-- | A description of the stream.
streamSummary_description :: Lens.Lens' StreamSummary (Prelude.Maybe Prelude.Text)
streamSummary_description :: Lens' StreamSummary (Maybe Text)
streamSummary_description = 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 ARN.
streamSummary_streamArn :: Lens.Lens' StreamSummary (Prelude.Maybe Prelude.Text)
streamSummary_streamArn :: Lens' StreamSummary (Maybe Text)
streamSummary_streamArn = 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)

-- | The stream ID.
streamSummary_streamId :: Lens.Lens' StreamSummary (Prelude.Maybe Prelude.Text)
streamSummary_streamId :: Lens' StreamSummary (Maybe Text)
streamSummary_streamId = 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)

-- | The stream version.
streamSummary_streamVersion :: Lens.Lens' StreamSummary (Prelude.Maybe Prelude.Natural)
streamSummary_streamVersion :: Lens' StreamSummary (Maybe Natural)
streamSummary_streamVersion = 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)

instance Data.FromJSON StreamSummary where
  parseJSON :: Value -> Parser StreamSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StreamSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Natural -> StreamSummary
StreamSummary'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"streamArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"streamId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"streamVersion")
      )

instance Prelude.Hashable StreamSummary where
  hashWithSalt :: Int -> StreamSummary -> Int
hashWithSalt Int
_salt StreamSummary' {Maybe Natural
Maybe Text
streamVersion :: Maybe Natural
streamId :: Maybe Text
streamArn :: Maybe Text
description :: Maybe Text
$sel:streamVersion:StreamSummary' :: StreamSummary -> Maybe Natural
$sel:streamId:StreamSummary' :: StreamSummary -> Maybe Text
$sel:streamArn:StreamSummary' :: StreamSummary -> Maybe Text
$sel:description:StreamSummary' :: StreamSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
streamArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
streamId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
streamVersion

instance Prelude.NFData StreamSummary where
  rnf :: StreamSummary -> ()
rnf StreamSummary' {Maybe Natural
Maybe Text
streamVersion :: Maybe Natural
streamId :: Maybe Text
streamArn :: Maybe Text
description :: Maybe Text
$sel:streamVersion:StreamSummary' :: StreamSummary -> Maybe Natural
$sel:streamId:StreamSummary' :: StreamSummary -> Maybe Text
$sel:streamArn:StreamSummary' :: StreamSummary -> Maybe Text
$sel:description:StreamSummary' :: StreamSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
streamArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
streamId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
streamVersion