{-# 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.KinesisVideo.Types.StreamInfo
-- 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.KinesisVideo.Types.StreamInfo where

import qualified Amazonka.Core as Core
import Amazonka.KinesisVideo.Types.StreamStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object describing a Kinesis video stream.
--
-- /See:/ 'newStreamInfo' smart constructor.
data StreamInfo = StreamInfo'
  { -- | A time stamp that indicates when the stream was created.
    StreamInfo -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
    -- | The status of the stream.
    StreamInfo -> Maybe StreamStatus
status :: Prelude.Maybe StreamStatus,
    -- | The @MediaType@ of the stream.
    StreamInfo -> Maybe Text
mediaType :: Prelude.Maybe Prelude.Text,
    -- | How long the stream retains data, in hours.
    StreamInfo -> Maybe Natural
dataRetentionInHours :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon Resource Name (ARN) of the stream.
    StreamInfo -> Maybe Text
streamARN :: Prelude.Maybe Prelude.Text,
    -- | The ID of the AWS Key Management Service (AWS KMS) key that Kinesis
    -- Video Streams uses to encrypt data on the stream.
    StreamInfo -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | The name of the device that is associated with the stream.
    StreamInfo -> Maybe Text
deviceName :: Prelude.Maybe Prelude.Text,
    -- | The version of the stream.
    StreamInfo -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
    -- | The name of the stream.
    StreamInfo -> Maybe Text
streamName :: Prelude.Maybe Prelude.Text
  }
  deriving (StreamInfo -> StreamInfo -> Bool
(StreamInfo -> StreamInfo -> Bool)
-> (StreamInfo -> StreamInfo -> Bool) -> Eq StreamInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StreamInfo -> StreamInfo -> Bool
$c/= :: StreamInfo -> StreamInfo -> Bool
== :: StreamInfo -> StreamInfo -> Bool
$c== :: StreamInfo -> StreamInfo -> Bool
Prelude.Eq, ReadPrec [StreamInfo]
ReadPrec StreamInfo
Int -> ReadS StreamInfo
ReadS [StreamInfo]
(Int -> ReadS StreamInfo)
-> ReadS [StreamInfo]
-> ReadPrec StreamInfo
-> ReadPrec [StreamInfo]
-> Read StreamInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StreamInfo]
$creadListPrec :: ReadPrec [StreamInfo]
readPrec :: ReadPrec StreamInfo
$creadPrec :: ReadPrec StreamInfo
readList :: ReadS [StreamInfo]
$creadList :: ReadS [StreamInfo]
readsPrec :: Int -> ReadS StreamInfo
$creadsPrec :: Int -> ReadS StreamInfo
Prelude.Read, Int -> StreamInfo -> ShowS
[StreamInfo] -> ShowS
StreamInfo -> String
(Int -> StreamInfo -> ShowS)
-> (StreamInfo -> String)
-> ([StreamInfo] -> ShowS)
-> Show StreamInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StreamInfo] -> ShowS
$cshowList :: [StreamInfo] -> ShowS
show :: StreamInfo -> String
$cshow :: StreamInfo -> String
showsPrec :: Int -> StreamInfo -> ShowS
$cshowsPrec :: Int -> StreamInfo -> ShowS
Prelude.Show, (forall x. StreamInfo -> Rep StreamInfo x)
-> (forall x. Rep StreamInfo x -> StreamInfo) -> Generic StreamInfo
forall x. Rep StreamInfo x -> StreamInfo
forall x. StreamInfo -> Rep StreamInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StreamInfo x -> StreamInfo
$cfrom :: forall x. StreamInfo -> Rep StreamInfo x
Prelude.Generic)

-- |
-- Create a value of 'StreamInfo' 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:
--
-- 'creationTime', 'streamInfo_creationTime' - A time stamp that indicates when the stream was created.
--
-- 'status', 'streamInfo_status' - The status of the stream.
--
-- 'mediaType', 'streamInfo_mediaType' - The @MediaType@ of the stream.
--
-- 'dataRetentionInHours', 'streamInfo_dataRetentionInHours' - How long the stream retains data, in hours.
--
-- 'streamARN', 'streamInfo_streamARN' - The Amazon Resource Name (ARN) of the stream.
--
-- 'kmsKeyId', 'streamInfo_kmsKeyId' - The ID of the AWS Key Management Service (AWS KMS) key that Kinesis
-- Video Streams uses to encrypt data on the stream.
--
-- 'deviceName', 'streamInfo_deviceName' - The name of the device that is associated with the stream.
--
-- 'version', 'streamInfo_version' - The version of the stream.
--
-- 'streamName', 'streamInfo_streamName' - The name of the stream.
newStreamInfo ::
  StreamInfo
newStreamInfo :: StreamInfo
newStreamInfo =
  StreamInfo' :: Maybe POSIX
-> Maybe StreamStatus
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> StreamInfo
StreamInfo'
    { $sel:creationTime:StreamInfo' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:status:StreamInfo' :: Maybe StreamStatus
status = Maybe StreamStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:mediaType:StreamInfo' :: Maybe Text
mediaType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dataRetentionInHours:StreamInfo' :: Maybe Natural
dataRetentionInHours = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:streamARN:StreamInfo' :: Maybe Text
streamARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyId:StreamInfo' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deviceName:StreamInfo' :: Maybe Text
deviceName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:version:StreamInfo' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:streamName:StreamInfo' :: Maybe Text
streamName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A time stamp that indicates when the stream was created.
streamInfo_creationTime :: Lens.Lens' StreamInfo (Prelude.Maybe Prelude.UTCTime)
streamInfo_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> StreamInfo -> f StreamInfo
streamInfo_creationTime = (StreamInfo -> Maybe POSIX)
-> (StreamInfo -> Maybe POSIX -> StreamInfo)
-> Lens StreamInfo StreamInfo (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamInfo' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:StreamInfo' :: StreamInfo -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: StreamInfo
s@StreamInfo' {} Maybe POSIX
a -> StreamInfo
s {$sel:creationTime:StreamInfo' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: StreamInfo) ((Maybe POSIX -> f (Maybe POSIX)) -> StreamInfo -> f StreamInfo)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> StreamInfo
-> f StreamInfo
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 status of the stream.
streamInfo_status :: Lens.Lens' StreamInfo (Prelude.Maybe StreamStatus)
streamInfo_status :: (Maybe StreamStatus -> f (Maybe StreamStatus))
-> StreamInfo -> f StreamInfo
streamInfo_status = (StreamInfo -> Maybe StreamStatus)
-> (StreamInfo -> Maybe StreamStatus -> StreamInfo)
-> Lens
     StreamInfo StreamInfo (Maybe StreamStatus) (Maybe StreamStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamInfo' {Maybe StreamStatus
status :: Maybe StreamStatus
$sel:status:StreamInfo' :: StreamInfo -> Maybe StreamStatus
status} -> Maybe StreamStatus
status) (\s :: StreamInfo
s@StreamInfo' {} Maybe StreamStatus
a -> StreamInfo
s {$sel:status:StreamInfo' :: Maybe StreamStatus
status = Maybe StreamStatus
a} :: StreamInfo)

-- | The @MediaType@ of the stream.
streamInfo_mediaType :: Lens.Lens' StreamInfo (Prelude.Maybe Prelude.Text)
streamInfo_mediaType :: (Maybe Text -> f (Maybe Text)) -> StreamInfo -> f StreamInfo
streamInfo_mediaType = (StreamInfo -> Maybe Text)
-> (StreamInfo -> Maybe Text -> StreamInfo)
-> Lens StreamInfo StreamInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamInfo' {Maybe Text
mediaType :: Maybe Text
$sel:mediaType:StreamInfo' :: StreamInfo -> Maybe Text
mediaType} -> Maybe Text
mediaType) (\s :: StreamInfo
s@StreamInfo' {} Maybe Text
a -> StreamInfo
s {$sel:mediaType:StreamInfo' :: Maybe Text
mediaType = Maybe Text
a} :: StreamInfo)

-- | How long the stream retains data, in hours.
streamInfo_dataRetentionInHours :: Lens.Lens' StreamInfo (Prelude.Maybe Prelude.Natural)
streamInfo_dataRetentionInHours :: (Maybe Natural -> f (Maybe Natural)) -> StreamInfo -> f StreamInfo
streamInfo_dataRetentionInHours = (StreamInfo -> Maybe Natural)
-> (StreamInfo -> Maybe Natural -> StreamInfo)
-> Lens StreamInfo StreamInfo (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamInfo' {Maybe Natural
dataRetentionInHours :: Maybe Natural
$sel:dataRetentionInHours:StreamInfo' :: StreamInfo -> Maybe Natural
dataRetentionInHours} -> Maybe Natural
dataRetentionInHours) (\s :: StreamInfo
s@StreamInfo' {} Maybe Natural
a -> StreamInfo
s {$sel:dataRetentionInHours:StreamInfo' :: Maybe Natural
dataRetentionInHours = Maybe Natural
a} :: StreamInfo)

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

-- | The ID of the AWS Key Management Service (AWS KMS) key that Kinesis
-- Video Streams uses to encrypt data on the stream.
streamInfo_kmsKeyId :: Lens.Lens' StreamInfo (Prelude.Maybe Prelude.Text)
streamInfo_kmsKeyId :: (Maybe Text -> f (Maybe Text)) -> StreamInfo -> f StreamInfo
streamInfo_kmsKeyId = (StreamInfo -> Maybe Text)
-> (StreamInfo -> Maybe Text -> StreamInfo)
-> Lens StreamInfo StreamInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamInfo' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:StreamInfo' :: StreamInfo -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: StreamInfo
s@StreamInfo' {} Maybe Text
a -> StreamInfo
s {$sel:kmsKeyId:StreamInfo' :: Maybe Text
kmsKeyId = Maybe Text
a} :: StreamInfo)

-- | The name of the device that is associated with the stream.
streamInfo_deviceName :: Lens.Lens' StreamInfo (Prelude.Maybe Prelude.Text)
streamInfo_deviceName :: (Maybe Text -> f (Maybe Text)) -> StreamInfo -> f StreamInfo
streamInfo_deviceName = (StreamInfo -> Maybe Text)
-> (StreamInfo -> Maybe Text -> StreamInfo)
-> Lens StreamInfo StreamInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamInfo' {Maybe Text
deviceName :: Maybe Text
$sel:deviceName:StreamInfo' :: StreamInfo -> Maybe Text
deviceName} -> Maybe Text
deviceName) (\s :: StreamInfo
s@StreamInfo' {} Maybe Text
a -> StreamInfo
s {$sel:deviceName:StreamInfo' :: Maybe Text
deviceName = Maybe Text
a} :: StreamInfo)

-- | The version of the stream.
streamInfo_version :: Lens.Lens' StreamInfo (Prelude.Maybe Prelude.Text)
streamInfo_version :: (Maybe Text -> f (Maybe Text)) -> StreamInfo -> f StreamInfo
streamInfo_version = (StreamInfo -> Maybe Text)
-> (StreamInfo -> Maybe Text -> StreamInfo)
-> Lens StreamInfo StreamInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamInfo' {Maybe Text
version :: Maybe Text
$sel:version:StreamInfo' :: StreamInfo -> Maybe Text
version} -> Maybe Text
version) (\s :: StreamInfo
s@StreamInfo' {} Maybe Text
a -> StreamInfo
s {$sel:version:StreamInfo' :: Maybe Text
version = Maybe Text
a} :: StreamInfo)

-- | The name of the stream.
streamInfo_streamName :: Lens.Lens' StreamInfo (Prelude.Maybe Prelude.Text)
streamInfo_streamName :: (Maybe Text -> f (Maybe Text)) -> StreamInfo -> f StreamInfo
streamInfo_streamName = (StreamInfo -> Maybe Text)
-> (StreamInfo -> Maybe Text -> StreamInfo)
-> Lens StreamInfo StreamInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamInfo' {Maybe Text
streamName :: Maybe Text
$sel:streamName:StreamInfo' :: StreamInfo -> Maybe Text
streamName} -> Maybe Text
streamName) (\s :: StreamInfo
s@StreamInfo' {} Maybe Text
a -> StreamInfo
s {$sel:streamName:StreamInfo' :: Maybe Text
streamName = Maybe Text
a} :: StreamInfo)

instance Core.FromJSON StreamInfo where
  parseJSON :: Value -> Parser StreamInfo
parseJSON =
    String
-> (Object -> Parser StreamInfo) -> Value -> Parser StreamInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StreamInfo"
      ( \Object
x ->
          Maybe POSIX
-> Maybe StreamStatus
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> StreamInfo
StreamInfo'
            (Maybe POSIX
 -> Maybe StreamStatus
 -> Maybe Text
 -> Maybe Natural
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> StreamInfo)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe StreamStatus
      -> Maybe Text
      -> Maybe Natural
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> StreamInfo)
forall (f :: * -> *) a b. Functor 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
"CreationTime")
            Parser
  (Maybe StreamStatus
   -> Maybe Text
   -> Maybe Natural
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> StreamInfo)
-> Parser (Maybe StreamStatus)
-> Parser
     (Maybe Text
      -> Maybe Natural
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> StreamInfo)
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
"Status")
            Parser
  (Maybe Text
   -> Maybe Natural
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> StreamInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe Natural
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> StreamInfo)
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
"MediaType")
            Parser
  (Maybe Natural
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> StreamInfo)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> StreamInfo)
forall (f :: * -> *) a b. Applicative f => 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
"DataRetentionInHours")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> StreamInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> StreamInfo)
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 -> Maybe Text -> Maybe Text -> StreamInfo)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> StreamInfo)
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
"KmsKeyId")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> StreamInfo)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> StreamInfo)
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
"DeviceName")
            Parser (Maybe Text -> Maybe Text -> StreamInfo)
-> Parser (Maybe Text) -> Parser (Maybe Text -> StreamInfo)
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
"Version")
            Parser (Maybe Text -> StreamInfo)
-> Parser (Maybe Text) -> Parser StreamInfo
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
"StreamName")
      )

instance Prelude.Hashable StreamInfo

instance Prelude.NFData StreamInfo