{-# 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.PrefetchRetrieval where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PrefetchRetrieval = PrefetchRetrieval'
{
PrefetchRetrieval -> Maybe POSIX
startTime :: Prelude.Maybe Core.POSIX,
PrefetchRetrieval -> Maybe (HashMap Text Text)
dynamicVariables :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
PrefetchRetrieval -> POSIX
endTime :: Core.POSIX
}
deriving (PrefetchRetrieval -> PrefetchRetrieval -> Bool
(PrefetchRetrieval -> PrefetchRetrieval -> Bool)
-> (PrefetchRetrieval -> PrefetchRetrieval -> Bool)
-> Eq PrefetchRetrieval
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PrefetchRetrieval -> PrefetchRetrieval -> Bool
$c/= :: PrefetchRetrieval -> PrefetchRetrieval -> Bool
== :: PrefetchRetrieval -> PrefetchRetrieval -> Bool
$c== :: PrefetchRetrieval -> PrefetchRetrieval -> Bool
Prelude.Eq, ReadPrec [PrefetchRetrieval]
ReadPrec PrefetchRetrieval
Int -> ReadS PrefetchRetrieval
ReadS [PrefetchRetrieval]
(Int -> ReadS PrefetchRetrieval)
-> ReadS [PrefetchRetrieval]
-> ReadPrec PrefetchRetrieval
-> ReadPrec [PrefetchRetrieval]
-> Read PrefetchRetrieval
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PrefetchRetrieval]
$creadListPrec :: ReadPrec [PrefetchRetrieval]
readPrec :: ReadPrec PrefetchRetrieval
$creadPrec :: ReadPrec PrefetchRetrieval
readList :: ReadS [PrefetchRetrieval]
$creadList :: ReadS [PrefetchRetrieval]
readsPrec :: Int -> ReadS PrefetchRetrieval
$creadsPrec :: Int -> ReadS PrefetchRetrieval
Prelude.Read, Int -> PrefetchRetrieval -> ShowS
[PrefetchRetrieval] -> ShowS
PrefetchRetrieval -> String
(Int -> PrefetchRetrieval -> ShowS)
-> (PrefetchRetrieval -> String)
-> ([PrefetchRetrieval] -> ShowS)
-> Show PrefetchRetrieval
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PrefetchRetrieval] -> ShowS
$cshowList :: [PrefetchRetrieval] -> ShowS
show :: PrefetchRetrieval -> String
$cshow :: PrefetchRetrieval -> String
showsPrec :: Int -> PrefetchRetrieval -> ShowS
$cshowsPrec :: Int -> PrefetchRetrieval -> ShowS
Prelude.Show, (forall x. PrefetchRetrieval -> Rep PrefetchRetrieval x)
-> (forall x. Rep PrefetchRetrieval x -> PrefetchRetrieval)
-> Generic PrefetchRetrieval
forall x. Rep PrefetchRetrieval x -> PrefetchRetrieval
forall x. PrefetchRetrieval -> Rep PrefetchRetrieval x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PrefetchRetrieval x -> PrefetchRetrieval
$cfrom :: forall x. PrefetchRetrieval -> Rep PrefetchRetrieval x
Prelude.Generic)
newPrefetchRetrieval ::
Prelude.UTCTime ->
PrefetchRetrieval
newPrefetchRetrieval :: UTCTime -> PrefetchRetrieval
newPrefetchRetrieval UTCTime
pEndTime_ =
PrefetchRetrieval' :: Maybe POSIX
-> Maybe (HashMap Text Text) -> POSIX -> PrefetchRetrieval
PrefetchRetrieval'
{ $sel:startTime:PrefetchRetrieval' :: Maybe POSIX
startTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:dynamicVariables:PrefetchRetrieval' :: Maybe (HashMap Text Text)
dynamicVariables = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:endTime:PrefetchRetrieval' :: POSIX
endTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
-> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEndTime_
}
prefetchRetrieval_startTime :: Lens.Lens' PrefetchRetrieval (Prelude.Maybe Prelude.UTCTime)
prefetchRetrieval_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PrefetchRetrieval -> f PrefetchRetrieval
prefetchRetrieval_startTime = (PrefetchRetrieval -> Maybe POSIX)
-> (PrefetchRetrieval -> Maybe POSIX -> PrefetchRetrieval)
-> Lens
PrefetchRetrieval PrefetchRetrieval (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrefetchRetrieval' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:PrefetchRetrieval' :: PrefetchRetrieval -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: PrefetchRetrieval
s@PrefetchRetrieval' {} Maybe POSIX
a -> PrefetchRetrieval
s {$sel:startTime:PrefetchRetrieval' :: Maybe POSIX
startTime = Maybe POSIX
a} :: PrefetchRetrieval) ((Maybe POSIX -> f (Maybe POSIX))
-> PrefetchRetrieval -> f PrefetchRetrieval)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PrefetchRetrieval
-> f PrefetchRetrieval
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
prefetchRetrieval_dynamicVariables :: Lens.Lens' PrefetchRetrieval (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
prefetchRetrieval_dynamicVariables :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> PrefetchRetrieval -> f PrefetchRetrieval
prefetchRetrieval_dynamicVariables = (PrefetchRetrieval -> Maybe (HashMap Text Text))
-> (PrefetchRetrieval
-> Maybe (HashMap Text Text) -> PrefetchRetrieval)
-> Lens
PrefetchRetrieval
PrefetchRetrieval
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrefetchRetrieval' {Maybe (HashMap Text Text)
dynamicVariables :: Maybe (HashMap Text Text)
$sel:dynamicVariables:PrefetchRetrieval' :: PrefetchRetrieval -> Maybe (HashMap Text Text)
dynamicVariables} -> Maybe (HashMap Text Text)
dynamicVariables) (\s :: PrefetchRetrieval
s@PrefetchRetrieval' {} Maybe (HashMap Text Text)
a -> PrefetchRetrieval
s {$sel:dynamicVariables:PrefetchRetrieval' :: Maybe (HashMap Text Text)
dynamicVariables = Maybe (HashMap Text Text)
a} :: PrefetchRetrieval) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> PrefetchRetrieval -> f PrefetchRetrieval)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> PrefetchRetrieval
-> f PrefetchRetrieval
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
prefetchRetrieval_endTime :: Lens.Lens' PrefetchRetrieval Prelude.UTCTime
prefetchRetrieval_endTime :: (UTCTime -> f UTCTime) -> PrefetchRetrieval -> f PrefetchRetrieval
prefetchRetrieval_endTime = (PrefetchRetrieval -> POSIX)
-> (PrefetchRetrieval -> POSIX -> PrefetchRetrieval)
-> Lens PrefetchRetrieval PrefetchRetrieval POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrefetchRetrieval' {POSIX
endTime :: POSIX
$sel:endTime:PrefetchRetrieval' :: PrefetchRetrieval -> POSIX
endTime} -> POSIX
endTime) (\s :: PrefetchRetrieval
s@PrefetchRetrieval' {} POSIX
a -> PrefetchRetrieval
s {$sel:endTime:PrefetchRetrieval' :: POSIX
endTime = POSIX
a} :: PrefetchRetrieval) ((POSIX -> f POSIX) -> PrefetchRetrieval -> f PrefetchRetrieval)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> PrefetchRetrieval
-> f PrefetchRetrieval
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Core.FromJSON PrefetchRetrieval where
parseJSON :: Value -> Parser PrefetchRetrieval
parseJSON =
String
-> (Object -> Parser PrefetchRetrieval)
-> Value
-> Parser PrefetchRetrieval
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PrefetchRetrieval"
( \Object
x ->
Maybe POSIX
-> Maybe (HashMap Text Text) -> POSIX -> PrefetchRetrieval
PrefetchRetrieval'
(Maybe POSIX
-> Maybe (HashMap Text Text) -> POSIX -> PrefetchRetrieval)
-> Parser (Maybe POSIX)
-> Parser (Maybe (HashMap Text Text) -> POSIX -> PrefetchRetrieval)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StartTime")
Parser (Maybe (HashMap Text Text) -> POSIX -> PrefetchRetrieval)
-> Parser (Maybe (HashMap Text Text))
-> Parser (POSIX -> PrefetchRetrieval)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DynamicVariables"
Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty
)
Parser (POSIX -> PrefetchRetrieval)
-> Parser POSIX -> Parser PrefetchRetrieval
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"EndTime")
)
instance Prelude.Hashable PrefetchRetrieval
instance Prelude.NFData PrefetchRetrieval
instance Core.ToJSON PrefetchRetrieval where
toJSON :: PrefetchRetrieval -> Value
toJSON PrefetchRetrieval' {Maybe (HashMap Text Text)
Maybe POSIX
POSIX
endTime :: POSIX
dynamicVariables :: Maybe (HashMap Text Text)
startTime :: Maybe POSIX
$sel:endTime:PrefetchRetrieval' :: PrefetchRetrieval -> POSIX
$sel:dynamicVariables:PrefetchRetrieval' :: PrefetchRetrieval -> Maybe (HashMap Text Text)
$sel:startTime:PrefetchRetrieval' :: PrefetchRetrieval -> Maybe POSIX
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"StartTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
startTime,
(Text
"DynamicVariables" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
dynamicVariables,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"EndTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= POSIX
endTime)
]
)