{-# 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.KinesisVideoArchivedMedia.Types.Fragment where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Fragment = Fragment'
{
Fragment -> Maybe Integer
fragmentLengthInMilliseconds :: Prelude.Maybe Prelude.Integer,
Fragment -> Maybe POSIX
serverTimestamp :: Prelude.Maybe Core.POSIX,
Fragment -> Maybe Integer
fragmentSizeInBytes :: Prelude.Maybe Prelude.Integer,
Fragment -> Maybe Text
fragmentNumber :: Prelude.Maybe Prelude.Text,
Fragment -> Maybe POSIX
producerTimestamp :: Prelude.Maybe Core.POSIX
}
deriving (Fragment -> Fragment -> Bool
(Fragment -> Fragment -> Bool)
-> (Fragment -> Fragment -> Bool) -> Eq Fragment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Fragment -> Fragment -> Bool
$c/= :: Fragment -> Fragment -> Bool
== :: Fragment -> Fragment -> Bool
$c== :: Fragment -> Fragment -> Bool
Prelude.Eq, ReadPrec [Fragment]
ReadPrec Fragment
Int -> ReadS Fragment
ReadS [Fragment]
(Int -> ReadS Fragment)
-> ReadS [Fragment]
-> ReadPrec Fragment
-> ReadPrec [Fragment]
-> Read Fragment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Fragment]
$creadListPrec :: ReadPrec [Fragment]
readPrec :: ReadPrec Fragment
$creadPrec :: ReadPrec Fragment
readList :: ReadS [Fragment]
$creadList :: ReadS [Fragment]
readsPrec :: Int -> ReadS Fragment
$creadsPrec :: Int -> ReadS Fragment
Prelude.Read, Int -> Fragment -> ShowS
[Fragment] -> ShowS
Fragment -> String
(Int -> Fragment -> ShowS)
-> (Fragment -> String) -> ([Fragment] -> ShowS) -> Show Fragment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Fragment] -> ShowS
$cshowList :: [Fragment] -> ShowS
show :: Fragment -> String
$cshow :: Fragment -> String
showsPrec :: Int -> Fragment -> ShowS
$cshowsPrec :: Int -> Fragment -> ShowS
Prelude.Show, (forall x. Fragment -> Rep Fragment x)
-> (forall x. Rep Fragment x -> Fragment) -> Generic Fragment
forall x. Rep Fragment x -> Fragment
forall x. Fragment -> Rep Fragment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Fragment x -> Fragment
$cfrom :: forall x. Fragment -> Rep Fragment x
Prelude.Generic)
newFragment ::
Fragment
newFragment :: Fragment
newFragment =
Fragment' :: Maybe Integer
-> Maybe POSIX
-> Maybe Integer
-> Maybe Text
-> Maybe POSIX
-> Fragment
Fragment'
{ $sel:fragmentLengthInMilliseconds:Fragment' :: Maybe Integer
fragmentLengthInMilliseconds =
Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:serverTimestamp:Fragment' :: Maybe POSIX
serverTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:fragmentSizeInBytes:Fragment' :: Maybe Integer
fragmentSizeInBytes = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:fragmentNumber:Fragment' :: Maybe Text
fragmentNumber = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:producerTimestamp:Fragment' :: Maybe POSIX
producerTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
}
fragment_fragmentLengthInMilliseconds :: Lens.Lens' Fragment (Prelude.Maybe Prelude.Integer)
fragment_fragmentLengthInMilliseconds :: (Maybe Integer -> f (Maybe Integer)) -> Fragment -> f Fragment
fragment_fragmentLengthInMilliseconds = (Fragment -> Maybe Integer)
-> (Fragment -> Maybe Integer -> Fragment)
-> Lens Fragment Fragment (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Fragment' {Maybe Integer
fragmentLengthInMilliseconds :: Maybe Integer
$sel:fragmentLengthInMilliseconds:Fragment' :: Fragment -> Maybe Integer
fragmentLengthInMilliseconds} -> Maybe Integer
fragmentLengthInMilliseconds) (\s :: Fragment
s@Fragment' {} Maybe Integer
a -> Fragment
s {$sel:fragmentLengthInMilliseconds:Fragment' :: Maybe Integer
fragmentLengthInMilliseconds = Maybe Integer
a} :: Fragment)
fragment_serverTimestamp :: Lens.Lens' Fragment (Prelude.Maybe Prelude.UTCTime)
fragment_serverTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Fragment -> f Fragment
fragment_serverTimestamp = (Fragment -> Maybe POSIX)
-> (Fragment -> Maybe POSIX -> Fragment)
-> Lens Fragment Fragment (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Fragment' {Maybe POSIX
serverTimestamp :: Maybe POSIX
$sel:serverTimestamp:Fragment' :: Fragment -> Maybe POSIX
serverTimestamp} -> Maybe POSIX
serverTimestamp) (\s :: Fragment
s@Fragment' {} Maybe POSIX
a -> Fragment
s {$sel:serverTimestamp:Fragment' :: Maybe POSIX
serverTimestamp = Maybe POSIX
a} :: Fragment) ((Maybe POSIX -> f (Maybe POSIX)) -> Fragment -> f Fragment)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Fragment
-> f Fragment
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
fragment_fragmentSizeInBytes :: Lens.Lens' Fragment (Prelude.Maybe Prelude.Integer)
fragment_fragmentSizeInBytes :: (Maybe Integer -> f (Maybe Integer)) -> Fragment -> f Fragment
fragment_fragmentSizeInBytes = (Fragment -> Maybe Integer)
-> (Fragment -> Maybe Integer -> Fragment)
-> Lens Fragment Fragment (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Fragment' {Maybe Integer
fragmentSizeInBytes :: Maybe Integer
$sel:fragmentSizeInBytes:Fragment' :: Fragment -> Maybe Integer
fragmentSizeInBytes} -> Maybe Integer
fragmentSizeInBytes) (\s :: Fragment
s@Fragment' {} Maybe Integer
a -> Fragment
s {$sel:fragmentSizeInBytes:Fragment' :: Maybe Integer
fragmentSizeInBytes = Maybe Integer
a} :: Fragment)
fragment_fragmentNumber :: Lens.Lens' Fragment (Prelude.Maybe Prelude.Text)
fragment_fragmentNumber :: (Maybe Text -> f (Maybe Text)) -> Fragment -> f Fragment
fragment_fragmentNumber = (Fragment -> Maybe Text)
-> (Fragment -> Maybe Text -> Fragment)
-> Lens Fragment Fragment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Fragment' {Maybe Text
fragmentNumber :: Maybe Text
$sel:fragmentNumber:Fragment' :: Fragment -> Maybe Text
fragmentNumber} -> Maybe Text
fragmentNumber) (\s :: Fragment
s@Fragment' {} Maybe Text
a -> Fragment
s {$sel:fragmentNumber:Fragment' :: Maybe Text
fragmentNumber = Maybe Text
a} :: Fragment)
fragment_producerTimestamp :: Lens.Lens' Fragment (Prelude.Maybe Prelude.UTCTime)
fragment_producerTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Fragment -> f Fragment
fragment_producerTimestamp = (Fragment -> Maybe POSIX)
-> (Fragment -> Maybe POSIX -> Fragment)
-> Lens Fragment Fragment (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Fragment' {Maybe POSIX
producerTimestamp :: Maybe POSIX
$sel:producerTimestamp:Fragment' :: Fragment -> Maybe POSIX
producerTimestamp} -> Maybe POSIX
producerTimestamp) (\s :: Fragment
s@Fragment' {} Maybe POSIX
a -> Fragment
s {$sel:producerTimestamp:Fragment' :: Maybe POSIX
producerTimestamp = Maybe POSIX
a} :: Fragment) ((Maybe POSIX -> f (Maybe POSIX)) -> Fragment -> f Fragment)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Fragment
-> f Fragment
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
instance Core.FromJSON Fragment where
parseJSON :: Value -> Parser Fragment
parseJSON =
String -> (Object -> Parser Fragment) -> Value -> Parser Fragment
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Fragment"
( \Object
x ->
Maybe Integer
-> Maybe POSIX
-> Maybe Integer
-> Maybe Text
-> Maybe POSIX
-> Fragment
Fragment'
(Maybe Integer
-> Maybe POSIX
-> Maybe Integer
-> Maybe Text
-> Maybe POSIX
-> Fragment)
-> Parser (Maybe Integer)
-> Parser
(Maybe POSIX
-> Maybe Integer -> Maybe Text -> Maybe POSIX -> Fragment)
forall (f :: * -> *) a b. Functor 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
"FragmentLengthInMilliseconds")
Parser
(Maybe POSIX
-> Maybe Integer -> Maybe Text -> Maybe POSIX -> Fragment)
-> Parser (Maybe POSIX)
-> Parser (Maybe Integer -> Maybe Text -> Maybe POSIX -> Fragment)
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
"ServerTimestamp")
Parser (Maybe Integer -> Maybe Text -> Maybe POSIX -> Fragment)
-> Parser (Maybe Integer)
-> Parser (Maybe Text -> Maybe POSIX -> Fragment)
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
"FragmentSizeInBytes")
Parser (Maybe Text -> Maybe POSIX -> Fragment)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> Fragment)
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
"FragmentNumber")
Parser (Maybe POSIX -> Fragment)
-> Parser (Maybe POSIX) -> Parser Fragment
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
"ProducerTimestamp")
)
instance Prelude.Hashable Fragment
instance Prelude.NFData Fragment