{-# 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.ElasticTranscoder.Types.TimeSpan where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data TimeSpan = TimeSpan'
{
TimeSpan -> Maybe Text
startTime :: Prelude.Maybe Prelude.Text,
TimeSpan -> Maybe Text
duration :: Prelude.Maybe Prelude.Text
}
deriving (TimeSpan -> TimeSpan -> Bool
(TimeSpan -> TimeSpan -> Bool)
-> (TimeSpan -> TimeSpan -> Bool) -> Eq TimeSpan
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimeSpan -> TimeSpan -> Bool
$c/= :: TimeSpan -> TimeSpan -> Bool
== :: TimeSpan -> TimeSpan -> Bool
$c== :: TimeSpan -> TimeSpan -> Bool
Prelude.Eq, ReadPrec [TimeSpan]
ReadPrec TimeSpan
Int -> ReadS TimeSpan
ReadS [TimeSpan]
(Int -> ReadS TimeSpan)
-> ReadS [TimeSpan]
-> ReadPrec TimeSpan
-> ReadPrec [TimeSpan]
-> Read TimeSpan
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TimeSpan]
$creadListPrec :: ReadPrec [TimeSpan]
readPrec :: ReadPrec TimeSpan
$creadPrec :: ReadPrec TimeSpan
readList :: ReadS [TimeSpan]
$creadList :: ReadS [TimeSpan]
readsPrec :: Int -> ReadS TimeSpan
$creadsPrec :: Int -> ReadS TimeSpan
Prelude.Read, Int -> TimeSpan -> ShowS
[TimeSpan] -> ShowS
TimeSpan -> String
(Int -> TimeSpan -> ShowS)
-> (TimeSpan -> String) -> ([TimeSpan] -> ShowS) -> Show TimeSpan
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TimeSpan] -> ShowS
$cshowList :: [TimeSpan] -> ShowS
show :: TimeSpan -> String
$cshow :: TimeSpan -> String
showsPrec :: Int -> TimeSpan -> ShowS
$cshowsPrec :: Int -> TimeSpan -> ShowS
Prelude.Show, (forall x. TimeSpan -> Rep TimeSpan x)
-> (forall x. Rep TimeSpan x -> TimeSpan) -> Generic TimeSpan
forall x. Rep TimeSpan x -> TimeSpan
forall x. TimeSpan -> Rep TimeSpan x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TimeSpan x -> TimeSpan
$cfrom :: forall x. TimeSpan -> Rep TimeSpan x
Prelude.Generic)
newTimeSpan ::
TimeSpan
newTimeSpan :: TimeSpan
newTimeSpan =
TimeSpan' :: Maybe Text -> Maybe Text -> TimeSpan
TimeSpan'
{ $sel:startTime:TimeSpan' :: Maybe Text
startTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:duration:TimeSpan' :: Maybe Text
duration = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
timeSpan_startTime :: Lens.Lens' TimeSpan (Prelude.Maybe Prelude.Text)
timeSpan_startTime :: (Maybe Text -> f (Maybe Text)) -> TimeSpan -> f TimeSpan
timeSpan_startTime = (TimeSpan -> Maybe Text)
-> (TimeSpan -> Maybe Text -> TimeSpan)
-> Lens TimeSpan TimeSpan (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimeSpan' {Maybe Text
startTime :: Maybe Text
$sel:startTime:TimeSpan' :: TimeSpan -> Maybe Text
startTime} -> Maybe Text
startTime) (\s :: TimeSpan
s@TimeSpan' {} Maybe Text
a -> TimeSpan
s {$sel:startTime:TimeSpan' :: Maybe Text
startTime = Maybe Text
a} :: TimeSpan)
timeSpan_duration :: Lens.Lens' TimeSpan (Prelude.Maybe Prelude.Text)
timeSpan_duration :: (Maybe Text -> f (Maybe Text)) -> TimeSpan -> f TimeSpan
timeSpan_duration = (TimeSpan -> Maybe Text)
-> (TimeSpan -> Maybe Text -> TimeSpan)
-> Lens TimeSpan TimeSpan (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimeSpan' {Maybe Text
duration :: Maybe Text
$sel:duration:TimeSpan' :: TimeSpan -> Maybe Text
duration} -> Maybe Text
duration) (\s :: TimeSpan
s@TimeSpan' {} Maybe Text
a -> TimeSpan
s {$sel:duration:TimeSpan' :: Maybe Text
duration = Maybe Text
a} :: TimeSpan)
instance Core.FromJSON TimeSpan where
parseJSON :: Value -> Parser TimeSpan
parseJSON =
String -> (Object -> Parser TimeSpan) -> Value -> Parser TimeSpan
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"TimeSpan"
( \Object
x ->
Maybe Text -> Maybe Text -> TimeSpan
TimeSpan'
(Maybe Text -> Maybe Text -> TimeSpan)
-> Parser (Maybe Text) -> Parser (Maybe Text -> TimeSpan)
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
"StartTime")
Parser (Maybe Text -> TimeSpan)
-> Parser (Maybe Text) -> Parser TimeSpan
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
"Duration")
)
instance Prelude.Hashable TimeSpan
instance Prelude.NFData TimeSpan
instance Core.ToJSON TimeSpan where
toJSON :: TimeSpan -> Value
toJSON TimeSpan' {Maybe Text
duration :: Maybe Text
startTime :: Maybe Text
$sel:duration:TimeSpan' :: TimeSpan -> Maybe Text
$sel:startTime:TimeSpan' :: TimeSpan -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"StartTime" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
startTime,
(Text
"Duration" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
duration
]
)