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