{-# 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.CostExplorer.Types.UtilizationByTime where
import qualified Amazonka.Core as Core
import Amazonka.CostExplorer.Types.DateInterval
import Amazonka.CostExplorer.Types.ReservationAggregates
import Amazonka.CostExplorer.Types.ReservationUtilizationGroup
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data UtilizationByTime = UtilizationByTime'
{
UtilizationByTime -> Maybe [ReservationUtilizationGroup]
groups :: Prelude.Maybe [ReservationUtilizationGroup],
UtilizationByTime -> Maybe DateInterval
timePeriod :: Prelude.Maybe DateInterval,
UtilizationByTime -> Maybe ReservationAggregates
total :: Prelude.Maybe ReservationAggregates
}
deriving (UtilizationByTime -> UtilizationByTime -> Bool
(UtilizationByTime -> UtilizationByTime -> Bool)
-> (UtilizationByTime -> UtilizationByTime -> Bool)
-> Eq UtilizationByTime
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UtilizationByTime -> UtilizationByTime -> Bool
$c/= :: UtilizationByTime -> UtilizationByTime -> Bool
== :: UtilizationByTime -> UtilizationByTime -> Bool
$c== :: UtilizationByTime -> UtilizationByTime -> Bool
Prelude.Eq, ReadPrec [UtilizationByTime]
ReadPrec UtilizationByTime
Int -> ReadS UtilizationByTime
ReadS [UtilizationByTime]
(Int -> ReadS UtilizationByTime)
-> ReadS [UtilizationByTime]
-> ReadPrec UtilizationByTime
-> ReadPrec [UtilizationByTime]
-> Read UtilizationByTime
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UtilizationByTime]
$creadListPrec :: ReadPrec [UtilizationByTime]
readPrec :: ReadPrec UtilizationByTime
$creadPrec :: ReadPrec UtilizationByTime
readList :: ReadS [UtilizationByTime]
$creadList :: ReadS [UtilizationByTime]
readsPrec :: Int -> ReadS UtilizationByTime
$creadsPrec :: Int -> ReadS UtilizationByTime
Prelude.Read, Int -> UtilizationByTime -> ShowS
[UtilizationByTime] -> ShowS
UtilizationByTime -> String
(Int -> UtilizationByTime -> ShowS)
-> (UtilizationByTime -> String)
-> ([UtilizationByTime] -> ShowS)
-> Show UtilizationByTime
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UtilizationByTime] -> ShowS
$cshowList :: [UtilizationByTime] -> ShowS
show :: UtilizationByTime -> String
$cshow :: UtilizationByTime -> String
showsPrec :: Int -> UtilizationByTime -> ShowS
$cshowsPrec :: Int -> UtilizationByTime -> ShowS
Prelude.Show, (forall x. UtilizationByTime -> Rep UtilizationByTime x)
-> (forall x. Rep UtilizationByTime x -> UtilizationByTime)
-> Generic UtilizationByTime
forall x. Rep UtilizationByTime x -> UtilizationByTime
forall x. UtilizationByTime -> Rep UtilizationByTime x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UtilizationByTime x -> UtilizationByTime
$cfrom :: forall x. UtilizationByTime -> Rep UtilizationByTime x
Prelude.Generic)
newUtilizationByTime ::
UtilizationByTime
newUtilizationByTime :: UtilizationByTime
newUtilizationByTime =
UtilizationByTime' :: Maybe [ReservationUtilizationGroup]
-> Maybe DateInterval
-> Maybe ReservationAggregates
-> UtilizationByTime
UtilizationByTime'
{ $sel:groups:UtilizationByTime' :: Maybe [ReservationUtilizationGroup]
groups = Maybe [ReservationUtilizationGroup]
forall a. Maybe a
Prelude.Nothing,
$sel:timePeriod:UtilizationByTime' :: Maybe DateInterval
timePeriod = Maybe DateInterval
forall a. Maybe a
Prelude.Nothing,
$sel:total:UtilizationByTime' :: Maybe ReservationAggregates
total = Maybe ReservationAggregates
forall a. Maybe a
Prelude.Nothing
}
utilizationByTime_groups :: Lens.Lens' UtilizationByTime (Prelude.Maybe [ReservationUtilizationGroup])
utilizationByTime_groups :: (Maybe [ReservationUtilizationGroup]
-> f (Maybe [ReservationUtilizationGroup]))
-> UtilizationByTime -> f UtilizationByTime
utilizationByTime_groups = (UtilizationByTime -> Maybe [ReservationUtilizationGroup])
-> (UtilizationByTime
-> Maybe [ReservationUtilizationGroup] -> UtilizationByTime)
-> Lens
UtilizationByTime
UtilizationByTime
(Maybe [ReservationUtilizationGroup])
(Maybe [ReservationUtilizationGroup])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UtilizationByTime' {Maybe [ReservationUtilizationGroup]
groups :: Maybe [ReservationUtilizationGroup]
$sel:groups:UtilizationByTime' :: UtilizationByTime -> Maybe [ReservationUtilizationGroup]
groups} -> Maybe [ReservationUtilizationGroup]
groups) (\s :: UtilizationByTime
s@UtilizationByTime' {} Maybe [ReservationUtilizationGroup]
a -> UtilizationByTime
s {$sel:groups:UtilizationByTime' :: Maybe [ReservationUtilizationGroup]
groups = Maybe [ReservationUtilizationGroup]
a} :: UtilizationByTime) ((Maybe [ReservationUtilizationGroup]
-> f (Maybe [ReservationUtilizationGroup]))
-> UtilizationByTime -> f UtilizationByTime)
-> ((Maybe [ReservationUtilizationGroup]
-> f (Maybe [ReservationUtilizationGroup]))
-> Maybe [ReservationUtilizationGroup]
-> f (Maybe [ReservationUtilizationGroup]))
-> (Maybe [ReservationUtilizationGroup]
-> f (Maybe [ReservationUtilizationGroup]))
-> UtilizationByTime
-> f UtilizationByTime
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[ReservationUtilizationGroup]
[ReservationUtilizationGroup]
[ReservationUtilizationGroup]
[ReservationUtilizationGroup]
-> Iso
(Maybe [ReservationUtilizationGroup])
(Maybe [ReservationUtilizationGroup])
(Maybe [ReservationUtilizationGroup])
(Maybe [ReservationUtilizationGroup])
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
[ReservationUtilizationGroup]
[ReservationUtilizationGroup]
[ReservationUtilizationGroup]
[ReservationUtilizationGroup]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
utilizationByTime_timePeriod :: Lens.Lens' UtilizationByTime (Prelude.Maybe DateInterval)
utilizationByTime_timePeriod :: (Maybe DateInterval -> f (Maybe DateInterval))
-> UtilizationByTime -> f UtilizationByTime
utilizationByTime_timePeriod = (UtilizationByTime -> Maybe DateInterval)
-> (UtilizationByTime -> Maybe DateInterval -> UtilizationByTime)
-> Lens
UtilizationByTime
UtilizationByTime
(Maybe DateInterval)
(Maybe DateInterval)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UtilizationByTime' {Maybe DateInterval
timePeriod :: Maybe DateInterval
$sel:timePeriod:UtilizationByTime' :: UtilizationByTime -> Maybe DateInterval
timePeriod} -> Maybe DateInterval
timePeriod) (\s :: UtilizationByTime
s@UtilizationByTime' {} Maybe DateInterval
a -> UtilizationByTime
s {$sel:timePeriod:UtilizationByTime' :: Maybe DateInterval
timePeriod = Maybe DateInterval
a} :: UtilizationByTime)
utilizationByTime_total :: Lens.Lens' UtilizationByTime (Prelude.Maybe ReservationAggregates)
utilizationByTime_total :: (Maybe ReservationAggregates -> f (Maybe ReservationAggregates))
-> UtilizationByTime -> f UtilizationByTime
utilizationByTime_total = (UtilizationByTime -> Maybe ReservationAggregates)
-> (UtilizationByTime
-> Maybe ReservationAggregates -> UtilizationByTime)
-> Lens
UtilizationByTime
UtilizationByTime
(Maybe ReservationAggregates)
(Maybe ReservationAggregates)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UtilizationByTime' {Maybe ReservationAggregates
total :: Maybe ReservationAggregates
$sel:total:UtilizationByTime' :: UtilizationByTime -> Maybe ReservationAggregates
total} -> Maybe ReservationAggregates
total) (\s :: UtilizationByTime
s@UtilizationByTime' {} Maybe ReservationAggregates
a -> UtilizationByTime
s {$sel:total:UtilizationByTime' :: Maybe ReservationAggregates
total = Maybe ReservationAggregates
a} :: UtilizationByTime)
instance Core.FromJSON UtilizationByTime where
parseJSON :: Value -> Parser UtilizationByTime
parseJSON =
String
-> (Object -> Parser UtilizationByTime)
-> Value
-> Parser UtilizationByTime
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"UtilizationByTime"
( \Object
x ->
Maybe [ReservationUtilizationGroup]
-> Maybe DateInterval
-> Maybe ReservationAggregates
-> UtilizationByTime
UtilizationByTime'
(Maybe [ReservationUtilizationGroup]
-> Maybe DateInterval
-> Maybe ReservationAggregates
-> UtilizationByTime)
-> Parser (Maybe [ReservationUtilizationGroup])
-> Parser
(Maybe DateInterval
-> Maybe ReservationAggregates -> UtilizationByTime)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe (Maybe [ReservationUtilizationGroup]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Groups" Parser (Maybe (Maybe [ReservationUtilizationGroup]))
-> Maybe [ReservationUtilizationGroup]
-> Parser (Maybe [ReservationUtilizationGroup])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ReservationUtilizationGroup]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe DateInterval
-> Maybe ReservationAggregates -> UtilizationByTime)
-> Parser (Maybe DateInterval)
-> Parser (Maybe ReservationAggregates -> UtilizationByTime)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DateInterval)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TimePeriod")
Parser (Maybe ReservationAggregates -> UtilizationByTime)
-> Parser (Maybe ReservationAggregates) -> Parser UtilizationByTime
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ReservationAggregates)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Total")
)
instance Prelude.Hashable UtilizationByTime
instance Prelude.NFData UtilizationByTime