{-# 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.PrefetchConsumption where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaTailor.Types.AvailMatchingCriteria
import qualified Amazonka.Prelude as Prelude
data PrefetchConsumption = PrefetchConsumption'
{
PrefetchConsumption -> Maybe POSIX
startTime :: Prelude.Maybe Core.POSIX,
PrefetchConsumption -> Maybe [AvailMatchingCriteria]
availMatchingCriteria :: Prelude.Maybe [AvailMatchingCriteria],
PrefetchConsumption -> POSIX
endTime :: Core.POSIX
}
deriving (PrefetchConsumption -> PrefetchConsumption -> Bool
(PrefetchConsumption -> PrefetchConsumption -> Bool)
-> (PrefetchConsumption -> PrefetchConsumption -> Bool)
-> Eq PrefetchConsumption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PrefetchConsumption -> PrefetchConsumption -> Bool
$c/= :: PrefetchConsumption -> PrefetchConsumption -> Bool
== :: PrefetchConsumption -> PrefetchConsumption -> Bool
$c== :: PrefetchConsumption -> PrefetchConsumption -> Bool
Prelude.Eq, ReadPrec [PrefetchConsumption]
ReadPrec PrefetchConsumption
Int -> ReadS PrefetchConsumption
ReadS [PrefetchConsumption]
(Int -> ReadS PrefetchConsumption)
-> ReadS [PrefetchConsumption]
-> ReadPrec PrefetchConsumption
-> ReadPrec [PrefetchConsumption]
-> Read PrefetchConsumption
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PrefetchConsumption]
$creadListPrec :: ReadPrec [PrefetchConsumption]
readPrec :: ReadPrec PrefetchConsumption
$creadPrec :: ReadPrec PrefetchConsumption
readList :: ReadS [PrefetchConsumption]
$creadList :: ReadS [PrefetchConsumption]
readsPrec :: Int -> ReadS PrefetchConsumption
$creadsPrec :: Int -> ReadS PrefetchConsumption
Prelude.Read, Int -> PrefetchConsumption -> ShowS
[PrefetchConsumption] -> ShowS
PrefetchConsumption -> String
(Int -> PrefetchConsumption -> ShowS)
-> (PrefetchConsumption -> String)
-> ([PrefetchConsumption] -> ShowS)
-> Show PrefetchConsumption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PrefetchConsumption] -> ShowS
$cshowList :: [PrefetchConsumption] -> ShowS
show :: PrefetchConsumption -> String
$cshow :: PrefetchConsumption -> String
showsPrec :: Int -> PrefetchConsumption -> ShowS
$cshowsPrec :: Int -> PrefetchConsumption -> ShowS
Prelude.Show, (forall x. PrefetchConsumption -> Rep PrefetchConsumption x)
-> (forall x. Rep PrefetchConsumption x -> PrefetchConsumption)
-> Generic PrefetchConsumption
forall x. Rep PrefetchConsumption x -> PrefetchConsumption
forall x. PrefetchConsumption -> Rep PrefetchConsumption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PrefetchConsumption x -> PrefetchConsumption
$cfrom :: forall x. PrefetchConsumption -> Rep PrefetchConsumption x
Prelude.Generic)
newPrefetchConsumption ::
Prelude.UTCTime ->
PrefetchConsumption
newPrefetchConsumption :: UTCTime -> PrefetchConsumption
newPrefetchConsumption UTCTime
pEndTime_ =
PrefetchConsumption' :: Maybe POSIX
-> Maybe [AvailMatchingCriteria] -> POSIX -> PrefetchConsumption
PrefetchConsumption'
{ $sel:startTime:PrefetchConsumption' :: Maybe POSIX
startTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:availMatchingCriteria:PrefetchConsumption' :: Maybe [AvailMatchingCriteria]
availMatchingCriteria = Maybe [AvailMatchingCriteria]
forall a. Maybe a
Prelude.Nothing,
$sel:endTime:PrefetchConsumption' :: 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_
}
prefetchConsumption_startTime :: Lens.Lens' PrefetchConsumption (Prelude.Maybe Prelude.UTCTime)
prefetchConsumption_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PrefetchConsumption -> f PrefetchConsumption
prefetchConsumption_startTime = (PrefetchConsumption -> Maybe POSIX)
-> (PrefetchConsumption -> Maybe POSIX -> PrefetchConsumption)
-> Lens
PrefetchConsumption PrefetchConsumption (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrefetchConsumption' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:PrefetchConsumption' :: PrefetchConsumption -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: PrefetchConsumption
s@PrefetchConsumption' {} Maybe POSIX
a -> PrefetchConsumption
s {$sel:startTime:PrefetchConsumption' :: Maybe POSIX
startTime = Maybe POSIX
a} :: PrefetchConsumption) ((Maybe POSIX -> f (Maybe POSIX))
-> PrefetchConsumption -> f PrefetchConsumption)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PrefetchConsumption
-> f PrefetchConsumption
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
prefetchConsumption_availMatchingCriteria :: Lens.Lens' PrefetchConsumption (Prelude.Maybe [AvailMatchingCriteria])
prefetchConsumption_availMatchingCriteria :: (Maybe [AvailMatchingCriteria]
-> f (Maybe [AvailMatchingCriteria]))
-> PrefetchConsumption -> f PrefetchConsumption
prefetchConsumption_availMatchingCriteria = (PrefetchConsumption -> Maybe [AvailMatchingCriteria])
-> (PrefetchConsumption
-> Maybe [AvailMatchingCriteria] -> PrefetchConsumption)
-> Lens
PrefetchConsumption
PrefetchConsumption
(Maybe [AvailMatchingCriteria])
(Maybe [AvailMatchingCriteria])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrefetchConsumption' {Maybe [AvailMatchingCriteria]
availMatchingCriteria :: Maybe [AvailMatchingCriteria]
$sel:availMatchingCriteria:PrefetchConsumption' :: PrefetchConsumption -> Maybe [AvailMatchingCriteria]
availMatchingCriteria} -> Maybe [AvailMatchingCriteria]
availMatchingCriteria) (\s :: PrefetchConsumption
s@PrefetchConsumption' {} Maybe [AvailMatchingCriteria]
a -> PrefetchConsumption
s {$sel:availMatchingCriteria:PrefetchConsumption' :: Maybe [AvailMatchingCriteria]
availMatchingCriteria = Maybe [AvailMatchingCriteria]
a} :: PrefetchConsumption) ((Maybe [AvailMatchingCriteria]
-> f (Maybe [AvailMatchingCriteria]))
-> PrefetchConsumption -> f PrefetchConsumption)
-> ((Maybe [AvailMatchingCriteria]
-> f (Maybe [AvailMatchingCriteria]))
-> Maybe [AvailMatchingCriteria]
-> f (Maybe [AvailMatchingCriteria]))
-> (Maybe [AvailMatchingCriteria]
-> f (Maybe [AvailMatchingCriteria]))
-> PrefetchConsumption
-> f PrefetchConsumption
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[AvailMatchingCriteria]
[AvailMatchingCriteria]
[AvailMatchingCriteria]
[AvailMatchingCriteria]
-> Iso
(Maybe [AvailMatchingCriteria])
(Maybe [AvailMatchingCriteria])
(Maybe [AvailMatchingCriteria])
(Maybe [AvailMatchingCriteria])
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
[AvailMatchingCriteria]
[AvailMatchingCriteria]
[AvailMatchingCriteria]
[AvailMatchingCriteria]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
prefetchConsumption_endTime :: Lens.Lens' PrefetchConsumption Prelude.UTCTime
prefetchConsumption_endTime :: (UTCTime -> f UTCTime)
-> PrefetchConsumption -> f PrefetchConsumption
prefetchConsumption_endTime = (PrefetchConsumption -> POSIX)
-> (PrefetchConsumption -> POSIX -> PrefetchConsumption)
-> Lens PrefetchConsumption PrefetchConsumption POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrefetchConsumption' {POSIX
endTime :: POSIX
$sel:endTime:PrefetchConsumption' :: PrefetchConsumption -> POSIX
endTime} -> POSIX
endTime) (\s :: PrefetchConsumption
s@PrefetchConsumption' {} POSIX
a -> PrefetchConsumption
s {$sel:endTime:PrefetchConsumption' :: POSIX
endTime = POSIX
a} :: PrefetchConsumption) ((POSIX -> f POSIX)
-> PrefetchConsumption -> f PrefetchConsumption)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> PrefetchConsumption
-> f PrefetchConsumption
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 PrefetchConsumption where
parseJSON :: Value -> Parser PrefetchConsumption
parseJSON =
String
-> (Object -> Parser PrefetchConsumption)
-> Value
-> Parser PrefetchConsumption
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PrefetchConsumption"
( \Object
x ->
Maybe POSIX
-> Maybe [AvailMatchingCriteria] -> POSIX -> PrefetchConsumption
PrefetchConsumption'
(Maybe POSIX
-> Maybe [AvailMatchingCriteria] -> POSIX -> PrefetchConsumption)
-> Parser (Maybe POSIX)
-> Parser
(Maybe [AvailMatchingCriteria] -> POSIX -> PrefetchConsumption)
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 [AvailMatchingCriteria] -> POSIX -> PrefetchConsumption)
-> Parser (Maybe [AvailMatchingCriteria])
-> Parser (POSIX -> PrefetchConsumption)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [AvailMatchingCriteria]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AvailMatchingCriteria"
Parser (Maybe (Maybe [AvailMatchingCriteria]))
-> Maybe [AvailMatchingCriteria]
-> Parser (Maybe [AvailMatchingCriteria])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AvailMatchingCriteria]
forall a. Monoid a => a
Prelude.mempty
)
Parser (POSIX -> PrefetchConsumption)
-> Parser POSIX -> Parser PrefetchConsumption
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 PrefetchConsumption
instance Prelude.NFData PrefetchConsumption
instance Core.ToJSON PrefetchConsumption where
toJSON :: PrefetchConsumption -> Value
toJSON PrefetchConsumption' {Maybe [AvailMatchingCriteria]
Maybe POSIX
POSIX
endTime :: POSIX
availMatchingCriteria :: Maybe [AvailMatchingCriteria]
startTime :: Maybe POSIX
$sel:endTime:PrefetchConsumption' :: PrefetchConsumption -> POSIX
$sel:availMatchingCriteria:PrefetchConsumption' :: PrefetchConsumption -> Maybe [AvailMatchingCriteria]
$sel:startTime:PrefetchConsumption' :: PrefetchConsumption -> 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
"AvailMatchingCriteria" Text -> [AvailMatchingCriteria] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([AvailMatchingCriteria] -> Pair)
-> Maybe [AvailMatchingCriteria] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AvailMatchingCriteria]
availMatchingCriteria,
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)
]
)