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

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

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

-- | The date when the stream was created.
streamInfo_createdAt :: Lens.Lens' StreamInfo (Prelude.Maybe Prelude.UTCTime)
streamInfo_createdAt :: Lens' StreamInfo (Maybe UTCTime)
streamInfo_createdAt = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The description of the stream.
streamInfo_description :: Lens.Lens' StreamInfo (Prelude.Maybe Prelude.Text)
streamInfo_description :: Lens' StreamInfo (Maybe Text)
streamInfo_description = 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 files to stream.
streamInfo_files :: Lens.Lens' StreamInfo (Prelude.Maybe (Prelude.NonEmpty StreamFile))
streamInfo_files :: Lens' StreamInfo (Maybe (NonEmpty StreamFile))
streamInfo_files = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The date when the stream was last updated.
streamInfo_lastUpdatedAt :: Lens.Lens' StreamInfo (Prelude.Maybe Prelude.UTCTime)
streamInfo_lastUpdatedAt :: Lens' StreamInfo (Maybe UTCTime)
streamInfo_lastUpdatedAt = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | An IAM role IoT assumes to access your S3 files.
streamInfo_roleArn :: Lens.Lens' StreamInfo (Prelude.Maybe Prelude.Text)
streamInfo_roleArn :: Lens' StreamInfo (Maybe Text)
streamInfo_roleArn = 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)

-- | The stream ARN.
streamInfo_streamArn :: Lens.Lens' StreamInfo (Prelude.Maybe Prelude.Text)
streamInfo_streamArn :: Lens' StreamInfo (Maybe Text)
streamInfo_streamArn = 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 stream ID.
streamInfo_streamId :: Lens.Lens' StreamInfo (Prelude.Maybe Prelude.Text)
streamInfo_streamId :: Lens' StreamInfo (Maybe Text)
streamInfo_streamId = 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)

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

instance Data.FromJSON StreamInfo where
  parseJSON :: Value -> Parser StreamInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StreamInfo"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe (NonEmpty StreamFile)
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> StreamInfo
StreamInfo'
            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
"createdAt")
            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
"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
"files")
            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
"lastUpdatedAt")
            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
"roleArn")
            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 StreamInfo where
  hashWithSalt :: Int -> StreamInfo -> Int
hashWithSalt Int
_salt StreamInfo' {Maybe Natural
Maybe (NonEmpty StreamFile)
Maybe Text
Maybe POSIX
streamVersion :: Maybe Natural
streamId :: Maybe Text
streamArn :: Maybe Text
roleArn :: Maybe Text
lastUpdatedAt :: Maybe POSIX
files :: Maybe (NonEmpty StreamFile)
description :: Maybe Text
createdAt :: Maybe POSIX
$sel:streamVersion:StreamInfo' :: StreamInfo -> Maybe Natural
$sel:streamId:StreamInfo' :: StreamInfo -> Maybe Text
$sel:streamArn:StreamInfo' :: StreamInfo -> Maybe Text
$sel:roleArn:StreamInfo' :: StreamInfo -> Maybe Text
$sel:lastUpdatedAt:StreamInfo' :: StreamInfo -> Maybe POSIX
$sel:files:StreamInfo' :: StreamInfo -> Maybe (NonEmpty StreamFile)
$sel:description:StreamInfo' :: StreamInfo -> Maybe Text
$sel:createdAt:StreamInfo' :: StreamInfo -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty StreamFile)
files
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
roleArn
      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 StreamInfo where
  rnf :: StreamInfo -> ()
rnf StreamInfo' {Maybe Natural
Maybe (NonEmpty StreamFile)
Maybe Text
Maybe POSIX
streamVersion :: Maybe Natural
streamId :: Maybe Text
streamArn :: Maybe Text
roleArn :: Maybe Text
lastUpdatedAt :: Maybe POSIX
files :: Maybe (NonEmpty StreamFile)
description :: Maybe Text
createdAt :: Maybe POSIX
$sel:streamVersion:StreamInfo' :: StreamInfo -> Maybe Natural
$sel:streamId:StreamInfo' :: StreamInfo -> Maybe Text
$sel:streamArn:StreamInfo' :: StreamInfo -> Maybe Text
$sel:roleArn:StreamInfo' :: StreamInfo -> Maybe Text
$sel:lastUpdatedAt:StreamInfo' :: StreamInfo -> Maybe POSIX
$sel:files:StreamInfo' :: StreamInfo -> Maybe (NonEmpty StreamFile)
$sel:description:StreamInfo' :: StreamInfo -> Maybe Text
$sel:createdAt:StreamInfo' :: StreamInfo -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 (NonEmpty StreamFile)
files
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
roleArn
      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