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

import qualified Amazonka.Core as Core
import Amazonka.IoT.Types.StreamFile
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about a stream.
--
-- /See:/ 'newStreamInfo' smart constructor.
data StreamInfo = StreamInfo'
  { -- | The date when the stream was last updated.
    StreamInfo -> Maybe POSIX
lastUpdatedAt :: Prelude.Maybe Core.POSIX,
    -- | The date when the stream was created.
    StreamInfo -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | The stream version.
    StreamInfo -> Maybe Natural
streamVersion :: Prelude.Maybe Prelude.Natural,
    -- | The stream ARN.
    StreamInfo -> Maybe Text
streamArn :: Prelude.Maybe Prelude.Text,
    -- | The files to stream.
    StreamInfo -> Maybe (NonEmpty StreamFile)
files :: Prelude.Maybe (Prelude.NonEmpty StreamFile),
    -- | The description of the stream.
    StreamInfo -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The stream ID.
    StreamInfo -> Maybe Text
streamId :: Prelude.Maybe Prelude.Text,
    -- | An IAM role IoT assumes to access your S3 files.
    StreamInfo -> Maybe Text
roleArn :: 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:
--
-- 'lastUpdatedAt', 'streamInfo_lastUpdatedAt' - The date when the stream was last updated.
--
-- 'createdAt', 'streamInfo_createdAt' - The date when the stream was created.
--
-- 'streamVersion', 'streamInfo_streamVersion' - The stream version.
--
-- 'streamArn', 'streamInfo_streamArn' - The stream ARN.
--
-- 'files', 'streamInfo_files' - The files to stream.
--
-- 'description', 'streamInfo_description' - The description of the stream.
--
-- 'streamId', 'streamInfo_streamId' - The stream ID.
--
-- 'roleArn', 'streamInfo_roleArn' - An IAM role IoT assumes to access your S3 files.
newStreamInfo ::
  StreamInfo
newStreamInfo :: StreamInfo
newStreamInfo =
  StreamInfo' :: Maybe POSIX
-> Maybe POSIX
-> Maybe Natural
-> Maybe Text
-> Maybe (NonEmpty StreamFile)
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> StreamInfo
StreamInfo'
    { $sel:lastUpdatedAt:StreamInfo' :: Maybe POSIX
lastUpdatedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:StreamInfo' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:streamVersion:StreamInfo' :: Maybe Natural
streamVersion = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:streamArn:StreamInfo' :: Maybe Text
streamArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:files:StreamInfo' :: Maybe (NonEmpty StreamFile)
files = Maybe (NonEmpty StreamFile)
forall a. Maybe a
Prelude.Nothing,
      $sel:description:StreamInfo' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:streamId:StreamInfo' :: Maybe Text
streamId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:StreamInfo' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The date when the stream was last updated.
streamInfo_lastUpdatedAt :: Lens.Lens' StreamInfo (Prelude.Maybe Prelude.UTCTime)
streamInfo_lastUpdatedAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> StreamInfo -> f StreamInfo
streamInfo_lastUpdatedAt = (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
lastUpdatedAt :: Maybe POSIX
$sel:lastUpdatedAt:StreamInfo' :: StreamInfo -> Maybe POSIX
lastUpdatedAt} -> Maybe POSIX
lastUpdatedAt) (\s :: StreamInfo
s@StreamInfo' {} Maybe POSIX
a -> StreamInfo
s {$sel:lastUpdatedAt:StreamInfo' :: Maybe POSIX
lastUpdatedAt = 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 date when the stream was created.
streamInfo_createdAt :: Lens.Lens' StreamInfo (Prelude.Maybe Prelude.UTCTime)
streamInfo_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> StreamInfo -> f StreamInfo
streamInfo_createdAt = (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
createdAt :: Maybe POSIX
$sel:createdAt:StreamInfo' :: StreamInfo -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: StreamInfo
s@StreamInfo' {} Maybe POSIX
a -> StreamInfo
s {$sel:createdAt:StreamInfo' :: Maybe POSIX
createdAt = 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 stream version.
streamInfo_streamVersion :: Lens.Lens' StreamInfo (Prelude.Maybe Prelude.Natural)
streamInfo_streamVersion :: (Maybe Natural -> f (Maybe Natural)) -> StreamInfo -> f StreamInfo
streamInfo_streamVersion = (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
streamVersion :: Maybe Natural
$sel:streamVersion:StreamInfo' :: StreamInfo -> Maybe Natural
streamVersion} -> Maybe Natural
streamVersion) (\s :: StreamInfo
s@StreamInfo' {} Maybe Natural
a -> StreamInfo
s {$sel:streamVersion:StreamInfo' :: Maybe Natural
streamVersion = Maybe Natural
a} :: StreamInfo)

-- | The stream ARN.
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 files to stream.
streamInfo_files :: Lens.Lens' StreamInfo (Prelude.Maybe (Prelude.NonEmpty StreamFile))
streamInfo_files :: (Maybe (NonEmpty StreamFile) -> f (Maybe (NonEmpty StreamFile)))
-> StreamInfo -> f StreamInfo
streamInfo_files = (StreamInfo -> Maybe (NonEmpty StreamFile))
-> (StreamInfo -> Maybe (NonEmpty StreamFile) -> StreamInfo)
-> Lens
     StreamInfo
     StreamInfo
     (Maybe (NonEmpty StreamFile))
     (Maybe (NonEmpty StreamFile))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamInfo' {Maybe (NonEmpty StreamFile)
files :: Maybe (NonEmpty StreamFile)
$sel:files:StreamInfo' :: StreamInfo -> Maybe (NonEmpty StreamFile)
files} -> Maybe (NonEmpty StreamFile)
files) (\s :: StreamInfo
s@StreamInfo' {} Maybe (NonEmpty StreamFile)
a -> StreamInfo
s {$sel:files:StreamInfo' :: Maybe (NonEmpty StreamFile)
files = Maybe (NonEmpty StreamFile)
a} :: StreamInfo) ((Maybe (NonEmpty StreamFile) -> f (Maybe (NonEmpty StreamFile)))
 -> StreamInfo -> f StreamInfo)
-> ((Maybe (NonEmpty StreamFile)
     -> f (Maybe (NonEmpty StreamFile)))
    -> Maybe (NonEmpty StreamFile) -> f (Maybe (NonEmpty StreamFile)))
-> (Maybe (NonEmpty StreamFile) -> f (Maybe (NonEmpty StreamFile)))
-> StreamInfo
-> f StreamInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty StreamFile)
  (NonEmpty StreamFile)
  (NonEmpty StreamFile)
  (NonEmpty StreamFile)
-> Iso
     (Maybe (NonEmpty StreamFile))
     (Maybe (NonEmpty StreamFile))
     (Maybe (NonEmpty StreamFile))
     (Maybe (NonEmpty StreamFile))
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 StreamFile)
  (NonEmpty StreamFile)
  (NonEmpty StreamFile)
  (NonEmpty StreamFile)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The description of the stream.
streamInfo_description :: Lens.Lens' StreamInfo (Prelude.Maybe Prelude.Text)
streamInfo_description :: (Maybe Text -> f (Maybe Text)) -> StreamInfo -> f StreamInfo
streamInfo_description = (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
description :: Maybe Text
$sel:description:StreamInfo' :: StreamInfo -> Maybe Text
description} -> Maybe Text
description) (\s :: StreamInfo
s@StreamInfo' {} Maybe Text
a -> StreamInfo
s {$sel:description:StreamInfo' :: Maybe Text
description = Maybe Text
a} :: StreamInfo)

-- | The stream ID.
streamInfo_streamId :: Lens.Lens' StreamInfo (Prelude.Maybe Prelude.Text)
streamInfo_streamId :: (Maybe Text -> f (Maybe Text)) -> StreamInfo -> f StreamInfo
streamInfo_streamId = (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
streamId :: Maybe Text
$sel:streamId:StreamInfo' :: StreamInfo -> Maybe Text
streamId} -> Maybe Text
streamId) (\s :: StreamInfo
s@StreamInfo' {} Maybe Text
a -> StreamInfo
s {$sel:streamId:StreamInfo' :: Maybe Text
streamId = Maybe Text
a} :: StreamInfo)

-- | An IAM role IoT assumes to access your S3 files.
streamInfo_roleArn :: Lens.Lens' StreamInfo (Prelude.Maybe Prelude.Text)
streamInfo_roleArn :: (Maybe Text -> f (Maybe Text)) -> StreamInfo -> f StreamInfo
streamInfo_roleArn = (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
roleArn :: Maybe Text
$sel:roleArn:StreamInfo' :: StreamInfo -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: StreamInfo
s@StreamInfo' {} Maybe Text
a -> StreamInfo
s {$sel:roleArn:StreamInfo' :: Maybe Text
roleArn = 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 POSIX
-> Maybe Natural
-> Maybe Text
-> Maybe (NonEmpty StreamFile)
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> StreamInfo
StreamInfo'
            (Maybe POSIX
 -> Maybe POSIX
 -> Maybe Natural
 -> Maybe Text
 -> Maybe (NonEmpty StreamFile)
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> StreamInfo)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX
      -> Maybe Natural
      -> Maybe Text
      -> Maybe (NonEmpty StreamFile)
      -> 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
"lastUpdatedAt")
            Parser
  (Maybe POSIX
   -> Maybe Natural
   -> Maybe Text
   -> Maybe (NonEmpty StreamFile)
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> StreamInfo)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Natural
      -> Maybe Text
      -> Maybe (NonEmpty StreamFile)
      -> 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 POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"createdAt")
            Parser
  (Maybe Natural
   -> Maybe Text
   -> Maybe (NonEmpty StreamFile)
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> StreamInfo)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Text
      -> Maybe (NonEmpty StreamFile)
      -> 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
"streamVersion")
            Parser
  (Maybe Text
   -> Maybe (NonEmpty StreamFile)
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> StreamInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe (NonEmpty StreamFile)
      -> 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 (NonEmpty StreamFile)
   -> Maybe Text -> Maybe Text -> Maybe Text -> StreamInfo)
-> Parser (Maybe (NonEmpty StreamFile))
-> 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 (NonEmpty StreamFile))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"files")
            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
"description")
            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
"streamId")
            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
"roleArn")
      )

instance Prelude.Hashable StreamInfo

instance Prelude.NFData StreamInfo