{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaTailor.Types.AvailMatchingCriteria
import qualified Amazonka.Prelude as Prelude
data PrefetchConsumption = PrefetchConsumption'
{
PrefetchConsumption -> Maybe [AvailMatchingCriteria]
availMatchingCriteria :: Prelude.Maybe [AvailMatchingCriteria],
PrefetchConsumption -> Maybe POSIX
startTime :: Prelude.Maybe Data.POSIX,
PrefetchConsumption -> POSIX
endTime :: Data.POSIX
}
deriving (PrefetchConsumption -> PrefetchConsumption -> Bool
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]
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
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. 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'
{ $sel:availMatchingCriteria:PrefetchConsumption' :: Maybe [AvailMatchingCriteria]
availMatchingCriteria =
forall a. Maybe a
Prelude.Nothing,
$sel:startTime:PrefetchConsumption' :: Maybe POSIX
startTime = forall a. Maybe a
Prelude.Nothing,
$sel:endTime:PrefetchConsumption' :: POSIX
endTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEndTime_
}
prefetchConsumption_availMatchingCriteria :: Lens.Lens' PrefetchConsumption (Prelude.Maybe [AvailMatchingCriteria])
prefetchConsumption_availMatchingCriteria :: Lens' PrefetchConsumption (Maybe [AvailMatchingCriteria])
prefetchConsumption_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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
prefetchConsumption_startTime :: Lens.Lens' PrefetchConsumption (Prelude.Maybe Prelude.UTCTime)
prefetchConsumption_startTime :: Lens' PrefetchConsumption (Maybe UTCTime)
prefetchConsumption_startTime = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
prefetchConsumption_endTime :: Lens.Lens' PrefetchConsumption Prelude.UTCTime
prefetchConsumption_endTime :: Lens' PrefetchConsumption UTCTime
prefetchConsumption_endTime = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
instance Data.FromJSON PrefetchConsumption where
parseJSON :: Value -> Parser PrefetchConsumption
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"PrefetchConsumption"
( \Object
x ->
Maybe [AvailMatchingCriteria]
-> Maybe POSIX -> POSIX -> PrefetchConsumption
PrefetchConsumption'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AvailMatchingCriteria"
forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StartTime")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"EndTime")
)
instance Prelude.Hashable PrefetchConsumption where
hashWithSalt :: Int -> PrefetchConsumption -> Int
hashWithSalt Int
_salt PrefetchConsumption' {Maybe [AvailMatchingCriteria]
Maybe POSIX
POSIX
endTime :: POSIX
startTime :: Maybe POSIX
availMatchingCriteria :: Maybe [AvailMatchingCriteria]
$sel:endTime:PrefetchConsumption' :: PrefetchConsumption -> POSIX
$sel:startTime:PrefetchConsumption' :: PrefetchConsumption -> Maybe POSIX
$sel:availMatchingCriteria:PrefetchConsumption' :: PrefetchConsumption -> Maybe [AvailMatchingCriteria]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [AvailMatchingCriteria]
availMatchingCriteria
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
startTime
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
endTime
instance Prelude.NFData PrefetchConsumption where
rnf :: PrefetchConsumption -> ()
rnf PrefetchConsumption' {Maybe [AvailMatchingCriteria]
Maybe POSIX
POSIX
endTime :: POSIX
startTime :: Maybe POSIX
availMatchingCriteria :: Maybe [AvailMatchingCriteria]
$sel:endTime:PrefetchConsumption' :: PrefetchConsumption -> POSIX
$sel:startTime:PrefetchConsumption' :: PrefetchConsumption -> Maybe POSIX
$sel:availMatchingCriteria:PrefetchConsumption' :: PrefetchConsumption -> Maybe [AvailMatchingCriteria]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [AvailMatchingCriteria]
availMatchingCriteria
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
startTime
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
endTime
instance Data.ToJSON PrefetchConsumption where
toJSON :: PrefetchConsumption -> Value
toJSON PrefetchConsumption' {Maybe [AvailMatchingCriteria]
Maybe POSIX
POSIX
endTime :: POSIX
startTime :: Maybe POSIX
availMatchingCriteria :: Maybe [AvailMatchingCriteria]
$sel:endTime:PrefetchConsumption' :: PrefetchConsumption -> POSIX
$sel:startTime:PrefetchConsumption' :: PrefetchConsumption -> Maybe POSIX
$sel:availMatchingCriteria:PrefetchConsumption' :: PrefetchConsumption -> Maybe [AvailMatchingCriteria]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"AvailMatchingCriteria" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AvailMatchingCriteria]
availMatchingCriteria,
(Key
"StartTime" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
startTime,
forall a. a -> Maybe a
Prelude.Just (Key
"EndTime" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= POSIX
endTime)
]
)