{-# 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.CaptionSource where
import qualified Amazonka.Core as Core
import Amazonka.ElasticTranscoder.Types.Encryption
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CaptionSource = CaptionSource'
{
CaptionSource -> Maybe Text
timeOffset :: Prelude.Maybe Prelude.Text,
CaptionSource -> Maybe Encryption
encryption :: Prelude.Maybe Encryption,
CaptionSource -> Maybe Text
key :: Prelude.Maybe Prelude.Text,
CaptionSource -> Maybe Text
language :: Prelude.Maybe Prelude.Text,
CaptionSource -> Maybe Text
label :: Prelude.Maybe Prelude.Text
}
deriving (CaptionSource -> CaptionSource -> Bool
(CaptionSource -> CaptionSource -> Bool)
-> (CaptionSource -> CaptionSource -> Bool) -> Eq CaptionSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CaptionSource -> CaptionSource -> Bool
$c/= :: CaptionSource -> CaptionSource -> Bool
== :: CaptionSource -> CaptionSource -> Bool
$c== :: CaptionSource -> CaptionSource -> Bool
Prelude.Eq, ReadPrec [CaptionSource]
ReadPrec CaptionSource
Int -> ReadS CaptionSource
ReadS [CaptionSource]
(Int -> ReadS CaptionSource)
-> ReadS [CaptionSource]
-> ReadPrec CaptionSource
-> ReadPrec [CaptionSource]
-> Read CaptionSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CaptionSource]
$creadListPrec :: ReadPrec [CaptionSource]
readPrec :: ReadPrec CaptionSource
$creadPrec :: ReadPrec CaptionSource
readList :: ReadS [CaptionSource]
$creadList :: ReadS [CaptionSource]
readsPrec :: Int -> ReadS CaptionSource
$creadsPrec :: Int -> ReadS CaptionSource
Prelude.Read, Int -> CaptionSource -> ShowS
[CaptionSource] -> ShowS
CaptionSource -> String
(Int -> CaptionSource -> ShowS)
-> (CaptionSource -> String)
-> ([CaptionSource] -> ShowS)
-> Show CaptionSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CaptionSource] -> ShowS
$cshowList :: [CaptionSource] -> ShowS
show :: CaptionSource -> String
$cshow :: CaptionSource -> String
showsPrec :: Int -> CaptionSource -> ShowS
$cshowsPrec :: Int -> CaptionSource -> ShowS
Prelude.Show, (forall x. CaptionSource -> Rep CaptionSource x)
-> (forall x. Rep CaptionSource x -> CaptionSource)
-> Generic CaptionSource
forall x. Rep CaptionSource x -> CaptionSource
forall x. CaptionSource -> Rep CaptionSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CaptionSource x -> CaptionSource
$cfrom :: forall x. CaptionSource -> Rep CaptionSource x
Prelude.Generic)
newCaptionSource ::
CaptionSource
newCaptionSource :: CaptionSource
newCaptionSource =
CaptionSource' :: Maybe Text
-> Maybe Encryption
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> CaptionSource
CaptionSource'
{ $sel:timeOffset:CaptionSource' :: Maybe Text
timeOffset = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:encryption:CaptionSource' :: Maybe Encryption
encryption = Maybe Encryption
forall a. Maybe a
Prelude.Nothing,
$sel:key:CaptionSource' :: Maybe Text
key = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:language:CaptionSource' :: Maybe Text
language = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:label:CaptionSource' :: Maybe Text
label = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
captionSource_timeOffset :: Lens.Lens' CaptionSource (Prelude.Maybe Prelude.Text)
captionSource_timeOffset :: (Maybe Text -> f (Maybe Text)) -> CaptionSource -> f CaptionSource
captionSource_timeOffset = (CaptionSource -> Maybe Text)
-> (CaptionSource -> Maybe Text -> CaptionSource)
-> Lens CaptionSource CaptionSource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionSource' {Maybe Text
timeOffset :: Maybe Text
$sel:timeOffset:CaptionSource' :: CaptionSource -> Maybe Text
timeOffset} -> Maybe Text
timeOffset) (\s :: CaptionSource
s@CaptionSource' {} Maybe Text
a -> CaptionSource
s {$sel:timeOffset:CaptionSource' :: Maybe Text
timeOffset = Maybe Text
a} :: CaptionSource)
captionSource_encryption :: Lens.Lens' CaptionSource (Prelude.Maybe Encryption)
captionSource_encryption :: (Maybe Encryption -> f (Maybe Encryption))
-> CaptionSource -> f CaptionSource
captionSource_encryption = (CaptionSource -> Maybe Encryption)
-> (CaptionSource -> Maybe Encryption -> CaptionSource)
-> Lens
CaptionSource CaptionSource (Maybe Encryption) (Maybe Encryption)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionSource' {Maybe Encryption
encryption :: Maybe Encryption
$sel:encryption:CaptionSource' :: CaptionSource -> Maybe Encryption
encryption} -> Maybe Encryption
encryption) (\s :: CaptionSource
s@CaptionSource' {} Maybe Encryption
a -> CaptionSource
s {$sel:encryption:CaptionSource' :: Maybe Encryption
encryption = Maybe Encryption
a} :: CaptionSource)
captionSource_key :: Lens.Lens' CaptionSource (Prelude.Maybe Prelude.Text)
captionSource_key :: (Maybe Text -> f (Maybe Text)) -> CaptionSource -> f CaptionSource
captionSource_key = (CaptionSource -> Maybe Text)
-> (CaptionSource -> Maybe Text -> CaptionSource)
-> Lens CaptionSource CaptionSource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionSource' {Maybe Text
key :: Maybe Text
$sel:key:CaptionSource' :: CaptionSource -> Maybe Text
key} -> Maybe Text
key) (\s :: CaptionSource
s@CaptionSource' {} Maybe Text
a -> CaptionSource
s {$sel:key:CaptionSource' :: Maybe Text
key = Maybe Text
a} :: CaptionSource)
captionSource_language :: Lens.Lens' CaptionSource (Prelude.Maybe Prelude.Text)
captionSource_language :: (Maybe Text -> f (Maybe Text)) -> CaptionSource -> f CaptionSource
captionSource_language = (CaptionSource -> Maybe Text)
-> (CaptionSource -> Maybe Text -> CaptionSource)
-> Lens CaptionSource CaptionSource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionSource' {Maybe Text
language :: Maybe Text
$sel:language:CaptionSource' :: CaptionSource -> Maybe Text
language} -> Maybe Text
language) (\s :: CaptionSource
s@CaptionSource' {} Maybe Text
a -> CaptionSource
s {$sel:language:CaptionSource' :: Maybe Text
language = Maybe Text
a} :: CaptionSource)
captionSource_label :: Lens.Lens' CaptionSource (Prelude.Maybe Prelude.Text)
captionSource_label :: (Maybe Text -> f (Maybe Text)) -> CaptionSource -> f CaptionSource
captionSource_label = (CaptionSource -> Maybe Text)
-> (CaptionSource -> Maybe Text -> CaptionSource)
-> Lens CaptionSource CaptionSource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptionSource' {Maybe Text
label :: Maybe Text
$sel:label:CaptionSource' :: CaptionSource -> Maybe Text
label} -> Maybe Text
label) (\s :: CaptionSource
s@CaptionSource' {} Maybe Text
a -> CaptionSource
s {$sel:label:CaptionSource' :: Maybe Text
label = Maybe Text
a} :: CaptionSource)
instance Core.FromJSON CaptionSource where
parseJSON :: Value -> Parser CaptionSource
parseJSON =
String
-> (Object -> Parser CaptionSource)
-> Value
-> Parser CaptionSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CaptionSource"
( \Object
x ->
Maybe Text
-> Maybe Encryption
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> CaptionSource
CaptionSource'
(Maybe Text
-> Maybe Encryption
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> CaptionSource)
-> Parser (Maybe Text)
-> Parser
(Maybe Encryption
-> Maybe Text -> Maybe Text -> Maybe Text -> CaptionSource)
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
"TimeOffset")
Parser
(Maybe Encryption
-> Maybe Text -> Maybe Text -> Maybe Text -> CaptionSource)
-> Parser (Maybe Encryption)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> CaptionSource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Encryption)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Encryption")
Parser (Maybe Text -> Maybe Text -> Maybe Text -> CaptionSource)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> CaptionSource)
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
"Key")
Parser (Maybe Text -> Maybe Text -> CaptionSource)
-> Parser (Maybe Text) -> Parser (Maybe Text -> CaptionSource)
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
"Language")
Parser (Maybe Text -> CaptionSource)
-> Parser (Maybe Text) -> Parser CaptionSource
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
"Label")
)
instance Prelude.Hashable CaptionSource
instance Prelude.NFData CaptionSource
instance Core.ToJSON CaptionSource where
toJSON :: CaptionSource -> Value
toJSON CaptionSource' {Maybe Text
Maybe Encryption
label :: Maybe Text
language :: Maybe Text
key :: Maybe Text
encryption :: Maybe Encryption
timeOffset :: Maybe Text
$sel:label:CaptionSource' :: CaptionSource -> Maybe Text
$sel:language:CaptionSource' :: CaptionSource -> Maybe Text
$sel:key:CaptionSource' :: CaptionSource -> Maybe Text
$sel:encryption:CaptionSource' :: CaptionSource -> Maybe Encryption
$sel:timeOffset:CaptionSource' :: CaptionSource -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"TimeOffset" 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
timeOffset,
(Text
"Encryption" Text -> Encryption -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Encryption -> Pair) -> Maybe Encryption -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Encryption
encryption,
(Text
"Key" 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
key,
(Text
"Language" 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
language,
(Text
"Label" 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
label
]
)