{-# 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.Bumper where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Bumper = Bumper'
{
Bumper -> Maybe Text
endUrl :: Prelude.Maybe Prelude.Text,
Bumper -> Maybe Text
startUrl :: Prelude.Maybe Prelude.Text
}
deriving (Bumper -> Bumper -> Bool
(Bumper -> Bumper -> Bool)
-> (Bumper -> Bumper -> Bool) -> Eq Bumper
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Bumper -> Bumper -> Bool
$c/= :: Bumper -> Bumper -> Bool
== :: Bumper -> Bumper -> Bool
$c== :: Bumper -> Bumper -> Bool
Prelude.Eq, ReadPrec [Bumper]
ReadPrec Bumper
Int -> ReadS Bumper
ReadS [Bumper]
(Int -> ReadS Bumper)
-> ReadS [Bumper]
-> ReadPrec Bumper
-> ReadPrec [Bumper]
-> Read Bumper
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Bumper]
$creadListPrec :: ReadPrec [Bumper]
readPrec :: ReadPrec Bumper
$creadPrec :: ReadPrec Bumper
readList :: ReadS [Bumper]
$creadList :: ReadS [Bumper]
readsPrec :: Int -> ReadS Bumper
$creadsPrec :: Int -> ReadS Bumper
Prelude.Read, Int -> Bumper -> ShowS
[Bumper] -> ShowS
Bumper -> String
(Int -> Bumper -> ShowS)
-> (Bumper -> String) -> ([Bumper] -> ShowS) -> Show Bumper
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Bumper] -> ShowS
$cshowList :: [Bumper] -> ShowS
show :: Bumper -> String
$cshow :: Bumper -> String
showsPrec :: Int -> Bumper -> ShowS
$cshowsPrec :: Int -> Bumper -> ShowS
Prelude.Show, (forall x. Bumper -> Rep Bumper x)
-> (forall x. Rep Bumper x -> Bumper) -> Generic Bumper
forall x. Rep Bumper x -> Bumper
forall x. Bumper -> Rep Bumper x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Bumper x -> Bumper
$cfrom :: forall x. Bumper -> Rep Bumper x
Prelude.Generic)
newBumper ::
Bumper
newBumper :: Bumper
newBumper =
Bumper' :: Maybe Text -> Maybe Text -> Bumper
Bumper'
{ $sel:endUrl:Bumper' :: Maybe Text
endUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:startUrl:Bumper' :: Maybe Text
startUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
bumper_endUrl :: Lens.Lens' Bumper (Prelude.Maybe Prelude.Text)
bumper_endUrl :: (Maybe Text -> f (Maybe Text)) -> Bumper -> f Bumper
bumper_endUrl = (Bumper -> Maybe Text)
-> (Bumper -> Maybe Text -> Bumper)
-> Lens Bumper Bumper (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bumper' {Maybe Text
endUrl :: Maybe Text
$sel:endUrl:Bumper' :: Bumper -> Maybe Text
endUrl} -> Maybe Text
endUrl) (\s :: Bumper
s@Bumper' {} Maybe Text
a -> Bumper
s {$sel:endUrl:Bumper' :: Maybe Text
endUrl = Maybe Text
a} :: Bumper)
bumper_startUrl :: Lens.Lens' Bumper (Prelude.Maybe Prelude.Text)
bumper_startUrl :: (Maybe Text -> f (Maybe Text)) -> Bumper -> f Bumper
bumper_startUrl = (Bumper -> Maybe Text)
-> (Bumper -> Maybe Text -> Bumper)
-> Lens Bumper Bumper (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bumper' {Maybe Text
startUrl :: Maybe Text
$sel:startUrl:Bumper' :: Bumper -> Maybe Text
startUrl} -> Maybe Text
startUrl) (\s :: Bumper
s@Bumper' {} Maybe Text
a -> Bumper
s {$sel:startUrl:Bumper' :: Maybe Text
startUrl = Maybe Text
a} :: Bumper)
instance Core.FromJSON Bumper where
parseJSON :: Value -> Parser Bumper
parseJSON =
String -> (Object -> Parser Bumper) -> Value -> Parser Bumper
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Bumper"
( \Object
x ->
Maybe Text -> Maybe Text -> Bumper
Bumper'
(Maybe Text -> Maybe Text -> Bumper)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Bumper)
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
"EndUrl")
Parser (Maybe Text -> Bumper)
-> Parser (Maybe Text) -> Parser Bumper
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
"StartUrl")
)
instance Prelude.Hashable Bumper
instance Prelude.NFData Bumper
instance Core.ToJSON Bumper where
toJSON :: Bumper -> Value
toJSON Bumper' {Maybe Text
startUrl :: Maybe Text
endUrl :: Maybe Text
$sel:startUrl:Bumper' :: Bumper -> Maybe Text
$sel:endUrl:Bumper' :: Bumper -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"EndUrl" 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
endUrl,
(Text
"StartUrl" 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
startUrl
]
)