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