{-# 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 #-}
module Amazonka.IVS.Types.Stream where
import qualified Amazonka.Core as Core
import Amazonka.IVS.Types.StreamHealth
import Amazonka.IVS.Types.StreamState
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Stream = Stream'
{
Stream -> Maybe Text
playbackUrl :: Prelude.Maybe Prelude.Text,
Stream -> Maybe StreamState
state :: Prelude.Maybe StreamState,
Stream -> Maybe POSIX
startTime :: Prelude.Maybe Core.POSIX,
Stream -> Maybe Text
channelArn :: Prelude.Maybe Prelude.Text,
Stream -> Maybe Integer
viewerCount :: Prelude.Maybe Prelude.Integer,
Stream -> Maybe StreamHealth
health :: Prelude.Maybe StreamHealth
}
deriving (Stream -> Stream -> Bool
(Stream -> Stream -> Bool)
-> (Stream -> Stream -> Bool) -> Eq Stream
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Stream -> Stream -> Bool
$c/= :: Stream -> Stream -> Bool
== :: Stream -> Stream -> Bool
$c== :: Stream -> Stream -> Bool
Prelude.Eq, ReadPrec [Stream]
ReadPrec Stream
Int -> ReadS Stream
ReadS [Stream]
(Int -> ReadS Stream)
-> ReadS [Stream]
-> ReadPrec Stream
-> ReadPrec [Stream]
-> Read Stream
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Stream]
$creadListPrec :: ReadPrec [Stream]
readPrec :: ReadPrec Stream
$creadPrec :: ReadPrec Stream
readList :: ReadS [Stream]
$creadList :: ReadS [Stream]
readsPrec :: Int -> ReadS Stream
$creadsPrec :: Int -> ReadS Stream
Prelude.Read, Int -> Stream -> ShowS
[Stream] -> ShowS
Stream -> String
(Int -> Stream -> ShowS)
-> (Stream -> String) -> ([Stream] -> ShowS) -> Show Stream
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Stream] -> ShowS
$cshowList :: [Stream] -> ShowS
show :: Stream -> String
$cshow :: Stream -> String
showsPrec :: Int -> Stream -> ShowS
$cshowsPrec :: Int -> Stream -> ShowS
Prelude.Show, (forall x. Stream -> Rep Stream x)
-> (forall x. Rep Stream x -> Stream) -> Generic Stream
forall x. Rep Stream x -> Stream
forall x. Stream -> Rep Stream x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Stream x -> Stream
$cfrom :: forall x. Stream -> Rep Stream x
Prelude.Generic)
newStream ::
Stream
newStream :: Stream
newStream =
Stream' :: Maybe Text
-> Maybe StreamState
-> Maybe POSIX
-> Maybe Text
-> Maybe Integer
-> Maybe StreamHealth
-> Stream
Stream'
{ $sel:playbackUrl:Stream' :: Maybe Text
playbackUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:state:Stream' :: Maybe StreamState
state = Maybe StreamState
forall a. Maybe a
Prelude.Nothing,
$sel:startTime:Stream' :: Maybe POSIX
startTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:channelArn:Stream' :: Maybe Text
channelArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:viewerCount:Stream' :: Maybe Integer
viewerCount = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:health:Stream' :: Maybe StreamHealth
health = Maybe StreamHealth
forall a. Maybe a
Prelude.Nothing
}
stream_playbackUrl :: Lens.Lens' Stream (Prelude.Maybe Prelude.Text)
stream_playbackUrl :: (Maybe Text -> f (Maybe Text)) -> Stream -> f Stream
stream_playbackUrl = (Stream -> Maybe Text)
-> (Stream -> Maybe Text -> Stream)
-> Lens Stream Stream (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Stream' {Maybe Text
playbackUrl :: Maybe Text
$sel:playbackUrl:Stream' :: Stream -> Maybe Text
playbackUrl} -> Maybe Text
playbackUrl) (\s :: Stream
s@Stream' {} Maybe Text
a -> Stream
s {$sel:playbackUrl:Stream' :: Maybe Text
playbackUrl = Maybe Text
a} :: Stream)
stream_state :: Lens.Lens' Stream (Prelude.Maybe StreamState)
stream_state :: (Maybe StreamState -> f (Maybe StreamState)) -> Stream -> f Stream
stream_state = (Stream -> Maybe StreamState)
-> (Stream -> Maybe StreamState -> Stream)
-> Lens Stream Stream (Maybe StreamState) (Maybe StreamState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Stream' {Maybe StreamState
state :: Maybe StreamState
$sel:state:Stream' :: Stream -> Maybe StreamState
state} -> Maybe StreamState
state) (\s :: Stream
s@Stream' {} Maybe StreamState
a -> Stream
s {$sel:state:Stream' :: Maybe StreamState
state = Maybe StreamState
a} :: Stream)
stream_startTime :: Lens.Lens' Stream (Prelude.Maybe Prelude.UTCTime)
stream_startTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Stream -> f Stream
stream_startTime = (Stream -> Maybe POSIX)
-> (Stream -> Maybe POSIX -> Stream)
-> Lens Stream Stream (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Stream' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:Stream' :: Stream -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: Stream
s@Stream' {} Maybe POSIX
a -> Stream
s {$sel:startTime:Stream' :: Maybe POSIX
startTime = Maybe POSIX
a} :: Stream) ((Maybe POSIX -> f (Maybe POSIX)) -> Stream -> f Stream)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Stream
-> f Stream
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
stream_channelArn :: Lens.Lens' Stream (Prelude.Maybe Prelude.Text)
stream_channelArn :: (Maybe Text -> f (Maybe Text)) -> Stream -> f Stream
stream_channelArn = (Stream -> Maybe Text)
-> (Stream -> Maybe Text -> Stream)
-> Lens Stream Stream (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Stream' {Maybe Text
channelArn :: Maybe Text
$sel:channelArn:Stream' :: Stream -> Maybe Text
channelArn} -> Maybe Text
channelArn) (\s :: Stream
s@Stream' {} Maybe Text
a -> Stream
s {$sel:channelArn:Stream' :: Maybe Text
channelArn = Maybe Text
a} :: Stream)
stream_viewerCount :: Lens.Lens' Stream (Prelude.Maybe Prelude.Integer)
stream_viewerCount :: (Maybe Integer -> f (Maybe Integer)) -> Stream -> f Stream
stream_viewerCount = (Stream -> Maybe Integer)
-> (Stream -> Maybe Integer -> Stream)
-> Lens Stream Stream (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Stream' {Maybe Integer
viewerCount :: Maybe Integer
$sel:viewerCount:Stream' :: Stream -> Maybe Integer
viewerCount} -> Maybe Integer
viewerCount) (\s :: Stream
s@Stream' {} Maybe Integer
a -> Stream
s {$sel:viewerCount:Stream' :: Maybe Integer
viewerCount = Maybe Integer
a} :: Stream)
stream_health :: Lens.Lens' Stream (Prelude.Maybe StreamHealth)
stream_health :: (Maybe StreamHealth -> f (Maybe StreamHealth))
-> Stream -> f Stream
stream_health = (Stream -> Maybe StreamHealth)
-> (Stream -> Maybe StreamHealth -> Stream)
-> Lens Stream Stream (Maybe StreamHealth) (Maybe StreamHealth)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Stream' {Maybe StreamHealth
health :: Maybe StreamHealth
$sel:health:Stream' :: Stream -> Maybe StreamHealth
health} -> Maybe StreamHealth
health) (\s :: Stream
s@Stream' {} Maybe StreamHealth
a -> Stream
s {$sel:health:Stream' :: Maybe StreamHealth
health = Maybe StreamHealth
a} :: Stream)
instance Core.FromJSON Stream where
parseJSON :: Value -> Parser Stream
parseJSON =
String -> (Object -> Parser Stream) -> Value -> Parser Stream
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Stream"
( \Object
x ->
Maybe Text
-> Maybe StreamState
-> Maybe POSIX
-> Maybe Text
-> Maybe Integer
-> Maybe StreamHealth
-> Stream
Stream'
(Maybe Text
-> Maybe StreamState
-> Maybe POSIX
-> Maybe Text
-> Maybe Integer
-> Maybe StreamHealth
-> Stream)
-> Parser (Maybe Text)
-> Parser
(Maybe StreamState
-> Maybe POSIX
-> Maybe Text
-> Maybe Integer
-> Maybe StreamHealth
-> Stream)
forall (f :: * -> *) a b. Functor 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
"playbackUrl")
Parser
(Maybe StreamState
-> Maybe POSIX
-> Maybe Text
-> Maybe Integer
-> Maybe StreamHealth
-> Stream)
-> Parser (Maybe StreamState)
-> Parser
(Maybe POSIX
-> Maybe Text -> Maybe Integer -> Maybe StreamHealth -> Stream)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe StreamState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"state")
Parser
(Maybe POSIX
-> Maybe Text -> Maybe Integer -> Maybe StreamHealth -> Stream)
-> Parser (Maybe POSIX)
-> Parser
(Maybe Text -> Maybe Integer -> Maybe StreamHealth -> Stream)
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
"startTime")
Parser
(Maybe Text -> Maybe Integer -> Maybe StreamHealth -> Stream)
-> Parser (Maybe Text)
-> Parser (Maybe Integer -> Maybe StreamHealth -> Stream)
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
"channelArn")
Parser (Maybe Integer -> Maybe StreamHealth -> Stream)
-> Parser (Maybe Integer) -> Parser (Maybe StreamHealth -> Stream)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"viewerCount")
Parser (Maybe StreamHealth -> Stream)
-> Parser (Maybe StreamHealth) -> Parser Stream
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe StreamHealth)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"health")
)
instance Prelude.Hashable Stream
instance Prelude.NFData Stream