{-# 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.Budgets.Types.Budget where
import Amazonka.Budgets.Types.BudgetType
import Amazonka.Budgets.Types.CalculatedSpend
import Amazonka.Budgets.Types.CostTypes
import Amazonka.Budgets.Types.Spend
import Amazonka.Budgets.Types.TimePeriod
import Amazonka.Budgets.Types.TimeUnit
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Budget = Budget'
{
Budget -> Maybe CalculatedSpend
calculatedSpend :: Prelude.Maybe CalculatedSpend,
Budget -> Maybe (HashMap Text Spend)
plannedBudgetLimits :: Prelude.Maybe (Prelude.HashMap Prelude.Text Spend),
Budget -> Maybe POSIX
lastUpdatedTime :: Prelude.Maybe Core.POSIX,
Budget -> Maybe Spend
budgetLimit :: Prelude.Maybe Spend,
Budget -> Maybe TimePeriod
timePeriod :: Prelude.Maybe TimePeriod,
Budget -> Maybe CostTypes
costTypes :: Prelude.Maybe CostTypes,
Budget -> Maybe (HashMap Text [Text])
costFilters :: Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]),
Budget -> Text
budgetName :: Prelude.Text,
Budget -> TimeUnit
timeUnit :: TimeUnit,
Budget -> BudgetType
budgetType :: BudgetType
}
deriving (Budget -> Budget -> Bool
(Budget -> Budget -> Bool)
-> (Budget -> Budget -> Bool) -> Eq Budget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Budget -> Budget -> Bool
$c/= :: Budget -> Budget -> Bool
== :: Budget -> Budget -> Bool
$c== :: Budget -> Budget -> Bool
Prelude.Eq, ReadPrec [Budget]
ReadPrec Budget
Int -> ReadS Budget
ReadS [Budget]
(Int -> ReadS Budget)
-> ReadS [Budget]
-> ReadPrec Budget
-> ReadPrec [Budget]
-> Read Budget
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Budget]
$creadListPrec :: ReadPrec [Budget]
readPrec :: ReadPrec Budget
$creadPrec :: ReadPrec Budget
readList :: ReadS [Budget]
$creadList :: ReadS [Budget]
readsPrec :: Int -> ReadS Budget
$creadsPrec :: Int -> ReadS Budget
Prelude.Read, Int -> Budget -> ShowS
[Budget] -> ShowS
Budget -> String
(Int -> Budget -> ShowS)
-> (Budget -> String) -> ([Budget] -> ShowS) -> Show Budget
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Budget] -> ShowS
$cshowList :: [Budget] -> ShowS
show :: Budget -> String
$cshow :: Budget -> String
showsPrec :: Int -> Budget -> ShowS
$cshowsPrec :: Int -> Budget -> ShowS
Prelude.Show, (forall x. Budget -> Rep Budget x)
-> (forall x. Rep Budget x -> Budget) -> Generic Budget
forall x. Rep Budget x -> Budget
forall x. Budget -> Rep Budget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Budget x -> Budget
$cfrom :: forall x. Budget -> Rep Budget x
Prelude.Generic)
newBudget ::
Prelude.Text ->
TimeUnit ->
BudgetType ->
Budget
newBudget :: Text -> TimeUnit -> BudgetType -> Budget
newBudget Text
pBudgetName_ TimeUnit
pTimeUnit_ BudgetType
pBudgetType_ =
Budget' :: Maybe CalculatedSpend
-> Maybe (HashMap Text Spend)
-> Maybe POSIX
-> Maybe Spend
-> Maybe TimePeriod
-> Maybe CostTypes
-> Maybe (HashMap Text [Text])
-> Text
-> TimeUnit
-> BudgetType
-> Budget
Budget'
{ $sel:calculatedSpend:Budget' :: Maybe CalculatedSpend
calculatedSpend = Maybe CalculatedSpend
forall a. Maybe a
Prelude.Nothing,
$sel:plannedBudgetLimits:Budget' :: Maybe (HashMap Text Spend)
plannedBudgetLimits = Maybe (HashMap Text Spend)
forall a. Maybe a
Prelude.Nothing,
$sel:lastUpdatedTime:Budget' :: Maybe POSIX
lastUpdatedTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:budgetLimit:Budget' :: Maybe Spend
budgetLimit = Maybe Spend
forall a. Maybe a
Prelude.Nothing,
$sel:timePeriod:Budget' :: Maybe TimePeriod
timePeriod = Maybe TimePeriod
forall a. Maybe a
Prelude.Nothing,
$sel:costTypes:Budget' :: Maybe CostTypes
costTypes = Maybe CostTypes
forall a. Maybe a
Prelude.Nothing,
$sel:costFilters:Budget' :: Maybe (HashMap Text [Text])
costFilters = Maybe (HashMap Text [Text])
forall a. Maybe a
Prelude.Nothing,
$sel:budgetName:Budget' :: Text
budgetName = Text
pBudgetName_,
$sel:timeUnit:Budget' :: TimeUnit
timeUnit = TimeUnit
pTimeUnit_,
$sel:budgetType:Budget' :: BudgetType
budgetType = BudgetType
pBudgetType_
}
budget_calculatedSpend :: Lens.Lens' Budget (Prelude.Maybe CalculatedSpend)
budget_calculatedSpend :: (Maybe CalculatedSpend -> f (Maybe CalculatedSpend))
-> Budget -> f Budget
budget_calculatedSpend = (Budget -> Maybe CalculatedSpend)
-> (Budget -> Maybe CalculatedSpend -> Budget)
-> Lens
Budget Budget (Maybe CalculatedSpend) (Maybe CalculatedSpend)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Budget' {Maybe CalculatedSpend
calculatedSpend :: Maybe CalculatedSpend
$sel:calculatedSpend:Budget' :: Budget -> Maybe CalculatedSpend
calculatedSpend} -> Maybe CalculatedSpend
calculatedSpend) (\s :: Budget
s@Budget' {} Maybe CalculatedSpend
a -> Budget
s {$sel:calculatedSpend:Budget' :: Maybe CalculatedSpend
calculatedSpend = Maybe CalculatedSpend
a} :: Budget)
budget_plannedBudgetLimits :: Lens.Lens' Budget (Prelude.Maybe (Prelude.HashMap Prelude.Text Spend))
budget_plannedBudgetLimits :: (Maybe (HashMap Text Spend) -> f (Maybe (HashMap Text Spend)))
-> Budget -> f Budget
budget_plannedBudgetLimits = (Budget -> Maybe (HashMap Text Spend))
-> (Budget -> Maybe (HashMap Text Spend) -> Budget)
-> Lens
Budget
Budget
(Maybe (HashMap Text Spend))
(Maybe (HashMap Text Spend))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Budget' {Maybe (HashMap Text Spend)
plannedBudgetLimits :: Maybe (HashMap Text Spend)
$sel:plannedBudgetLimits:Budget' :: Budget -> Maybe (HashMap Text Spend)
plannedBudgetLimits} -> Maybe (HashMap Text Spend)
plannedBudgetLimits) (\s :: Budget
s@Budget' {} Maybe (HashMap Text Spend)
a -> Budget
s {$sel:plannedBudgetLimits:Budget' :: Maybe (HashMap Text Spend)
plannedBudgetLimits = Maybe (HashMap Text Spend)
a} :: Budget) ((Maybe (HashMap Text Spend) -> f (Maybe (HashMap Text Spend)))
-> Budget -> f Budget)
-> ((Maybe (HashMap Text Spend) -> f (Maybe (HashMap Text Spend)))
-> Maybe (HashMap Text Spend) -> f (Maybe (HashMap Text Spend)))
-> (Maybe (HashMap Text Spend) -> f (Maybe (HashMap Text Spend)))
-> Budget
-> f Budget
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Spend)
(HashMap Text Spend)
(HashMap Text Spend)
(HashMap Text Spend)
-> Iso
(Maybe (HashMap Text Spend))
(Maybe (HashMap Text Spend))
(Maybe (HashMap Text Spend))
(Maybe (HashMap Text Spend))
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 Spend)
(HashMap Text Spend)
(HashMap Text Spend)
(HashMap Text Spend)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
budget_lastUpdatedTime :: Lens.Lens' Budget (Prelude.Maybe Prelude.UTCTime)
budget_lastUpdatedTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Budget -> f Budget
budget_lastUpdatedTime = (Budget -> Maybe POSIX)
-> (Budget -> Maybe POSIX -> Budget)
-> Lens Budget Budget (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Budget' {Maybe POSIX
lastUpdatedTime :: Maybe POSIX
$sel:lastUpdatedTime:Budget' :: Budget -> Maybe POSIX
lastUpdatedTime} -> Maybe POSIX
lastUpdatedTime) (\s :: Budget
s@Budget' {} Maybe POSIX
a -> Budget
s {$sel:lastUpdatedTime:Budget' :: Maybe POSIX
lastUpdatedTime = Maybe POSIX
a} :: Budget) ((Maybe POSIX -> f (Maybe POSIX)) -> Budget -> f Budget)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Budget
-> f Budget
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
budget_budgetLimit :: Lens.Lens' Budget (Prelude.Maybe Spend)
budget_budgetLimit :: (Maybe Spend -> f (Maybe Spend)) -> Budget -> f Budget
budget_budgetLimit = (Budget -> Maybe Spend)
-> (Budget -> Maybe Spend -> Budget)
-> Lens Budget Budget (Maybe Spend) (Maybe Spend)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Budget' {Maybe Spend
budgetLimit :: Maybe Spend
$sel:budgetLimit:Budget' :: Budget -> Maybe Spend
budgetLimit} -> Maybe Spend
budgetLimit) (\s :: Budget
s@Budget' {} Maybe Spend
a -> Budget
s {$sel:budgetLimit:Budget' :: Maybe Spend
budgetLimit = Maybe Spend
a} :: Budget)
budget_timePeriod :: Lens.Lens' Budget (Prelude.Maybe TimePeriod)
budget_timePeriod :: (Maybe TimePeriod -> f (Maybe TimePeriod)) -> Budget -> f Budget
budget_timePeriod = (Budget -> Maybe TimePeriod)
-> (Budget -> Maybe TimePeriod -> Budget)
-> Lens Budget Budget (Maybe TimePeriod) (Maybe TimePeriod)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Budget' {Maybe TimePeriod
timePeriod :: Maybe TimePeriod
$sel:timePeriod:Budget' :: Budget -> Maybe TimePeriod
timePeriod} -> Maybe TimePeriod
timePeriod) (\s :: Budget
s@Budget' {} Maybe TimePeriod
a -> Budget
s {$sel:timePeriod:Budget' :: Maybe TimePeriod
timePeriod = Maybe TimePeriod
a} :: Budget)
budget_costTypes :: Lens.Lens' Budget (Prelude.Maybe CostTypes)
budget_costTypes :: (Maybe CostTypes -> f (Maybe CostTypes)) -> Budget -> f Budget
budget_costTypes = (Budget -> Maybe CostTypes)
-> (Budget -> Maybe CostTypes -> Budget)
-> Lens Budget Budget (Maybe CostTypes) (Maybe CostTypes)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Budget' {Maybe CostTypes
costTypes :: Maybe CostTypes
$sel:costTypes:Budget' :: Budget -> Maybe CostTypes
costTypes} -> Maybe CostTypes
costTypes) (\s :: Budget
s@Budget' {} Maybe CostTypes
a -> Budget
s {$sel:costTypes:Budget' :: Maybe CostTypes
costTypes = Maybe CostTypes
a} :: Budget)
budget_costFilters :: Lens.Lens' Budget (Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]))
budget_costFilters :: (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> Budget -> f Budget
budget_costFilters = (Budget -> Maybe (HashMap Text [Text]))
-> (Budget -> Maybe (HashMap Text [Text]) -> Budget)
-> Lens
Budget
Budget
(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 (\Budget' {Maybe (HashMap Text [Text])
costFilters :: Maybe (HashMap Text [Text])
$sel:costFilters:Budget' :: Budget -> Maybe (HashMap Text [Text])
costFilters} -> Maybe (HashMap Text [Text])
costFilters) (\s :: Budget
s@Budget' {} Maybe (HashMap Text [Text])
a -> Budget
s {$sel:costFilters:Budget' :: Maybe (HashMap Text [Text])
costFilters = Maybe (HashMap Text [Text])
a} :: Budget) ((Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> Budget -> f Budget)
-> ((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])))
-> Budget
-> f Budget
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
budget_budgetName :: Lens.Lens' Budget Prelude.Text
budget_budgetName :: (Text -> f Text) -> Budget -> f Budget
budget_budgetName = (Budget -> Text)
-> (Budget -> Text -> Budget) -> Lens Budget Budget Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Budget' {Text
budgetName :: Text
$sel:budgetName:Budget' :: Budget -> Text
budgetName} -> Text
budgetName) (\s :: Budget
s@Budget' {} Text
a -> Budget
s {$sel:budgetName:Budget' :: Text
budgetName = Text
a} :: Budget)
budget_timeUnit :: Lens.Lens' Budget TimeUnit
budget_timeUnit :: (TimeUnit -> f TimeUnit) -> Budget -> f Budget
budget_timeUnit = (Budget -> TimeUnit)
-> (Budget -> TimeUnit -> Budget)
-> Lens Budget Budget TimeUnit TimeUnit
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Budget' {TimeUnit
timeUnit :: TimeUnit
$sel:timeUnit:Budget' :: Budget -> TimeUnit
timeUnit} -> TimeUnit
timeUnit) (\s :: Budget
s@Budget' {} TimeUnit
a -> Budget
s {$sel:timeUnit:Budget' :: TimeUnit
timeUnit = TimeUnit
a} :: Budget)
budget_budgetType :: Lens.Lens' Budget BudgetType
budget_budgetType :: (BudgetType -> f BudgetType) -> Budget -> f Budget
budget_budgetType = (Budget -> BudgetType)
-> (Budget -> BudgetType -> Budget)
-> Lens Budget Budget BudgetType BudgetType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Budget' {BudgetType
budgetType :: BudgetType
$sel:budgetType:Budget' :: Budget -> BudgetType
budgetType} -> BudgetType
budgetType) (\s :: Budget
s@Budget' {} BudgetType
a -> Budget
s {$sel:budgetType:Budget' :: BudgetType
budgetType = BudgetType
a} :: Budget)
instance Core.FromJSON Budget where
parseJSON :: Value -> Parser Budget
parseJSON =
String -> (Object -> Parser Budget) -> Value -> Parser Budget
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Budget"
( \Object
x ->
Maybe CalculatedSpend
-> Maybe (HashMap Text Spend)
-> Maybe POSIX
-> Maybe Spend
-> Maybe TimePeriod
-> Maybe CostTypes
-> Maybe (HashMap Text [Text])
-> Text
-> TimeUnit
-> BudgetType
-> Budget
Budget'
(Maybe CalculatedSpend
-> Maybe (HashMap Text Spend)
-> Maybe POSIX
-> Maybe Spend
-> Maybe TimePeriod
-> Maybe CostTypes
-> Maybe (HashMap Text [Text])
-> Text
-> TimeUnit
-> BudgetType
-> Budget)
-> Parser (Maybe CalculatedSpend)
-> Parser
(Maybe (HashMap Text Spend)
-> Maybe POSIX
-> Maybe Spend
-> Maybe TimePeriod
-> Maybe CostTypes
-> Maybe (HashMap Text [Text])
-> Text
-> TimeUnit
-> BudgetType
-> Budget)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CalculatedSpend)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CalculatedSpend")
Parser
(Maybe (HashMap Text Spend)
-> Maybe POSIX
-> Maybe Spend
-> Maybe TimePeriod
-> Maybe CostTypes
-> Maybe (HashMap Text [Text])
-> Text
-> TimeUnit
-> BudgetType
-> Budget)
-> Parser (Maybe (HashMap Text Spend))
-> Parser
(Maybe POSIX
-> Maybe Spend
-> Maybe TimePeriod
-> Maybe CostTypes
-> Maybe (HashMap Text [Text])
-> Text
-> TimeUnit
-> BudgetType
-> Budget)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Spend)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PlannedBudgetLimits"
Parser (Maybe (Maybe (HashMap Text Spend)))
-> Maybe (HashMap Text Spend)
-> Parser (Maybe (HashMap Text Spend))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Spend)
forall a. Monoid a => a
Prelude.mempty
)
Parser
(Maybe POSIX
-> Maybe Spend
-> Maybe TimePeriod
-> Maybe CostTypes
-> Maybe (HashMap Text [Text])
-> Text
-> TimeUnit
-> BudgetType
-> Budget)
-> Parser (Maybe POSIX)
-> Parser
(Maybe Spend
-> Maybe TimePeriod
-> Maybe CostTypes
-> Maybe (HashMap Text [Text])
-> Text
-> TimeUnit
-> BudgetType
-> Budget)
forall (f :: * -> *) a b. Applicative f => 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
"LastUpdatedTime")
Parser
(Maybe Spend
-> Maybe TimePeriod
-> Maybe CostTypes
-> Maybe (HashMap Text [Text])
-> Text
-> TimeUnit
-> BudgetType
-> Budget)
-> Parser (Maybe Spend)
-> Parser
(Maybe TimePeriod
-> Maybe CostTypes
-> Maybe (HashMap Text [Text])
-> Text
-> TimeUnit
-> BudgetType
-> Budget)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Spend)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BudgetLimit")
Parser
(Maybe TimePeriod
-> Maybe CostTypes
-> Maybe (HashMap Text [Text])
-> Text
-> TimeUnit
-> BudgetType
-> Budget)
-> Parser (Maybe TimePeriod)
-> Parser
(Maybe CostTypes
-> Maybe (HashMap Text [Text])
-> Text
-> TimeUnit
-> BudgetType
-> Budget)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TimePeriod)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TimePeriod")
Parser
(Maybe CostTypes
-> Maybe (HashMap Text [Text])
-> Text
-> TimeUnit
-> BudgetType
-> Budget)
-> Parser (Maybe CostTypes)
-> Parser
(Maybe (HashMap Text [Text])
-> Text -> TimeUnit -> BudgetType -> Budget)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CostTypes)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CostTypes")
Parser
(Maybe (HashMap Text [Text])
-> Text -> TimeUnit -> BudgetType -> Budget)
-> Parser (Maybe (HashMap Text [Text]))
-> Parser (Text -> TimeUnit -> BudgetType -> Budget)
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
"CostFilters" 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 (Text -> TimeUnit -> BudgetType -> Budget)
-> Parser Text -> Parser (TimeUnit -> BudgetType -> Budget)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"BudgetName")
Parser (TimeUnit -> BudgetType -> Budget)
-> Parser TimeUnit -> Parser (BudgetType -> Budget)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser TimeUnit
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TimeUnit")
Parser (BudgetType -> Budget) -> Parser BudgetType -> Parser Budget
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser BudgetType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"BudgetType")
)
instance Prelude.Hashable Budget
instance Prelude.NFData Budget
instance Core.ToJSON Budget where
toJSON :: Budget -> Value
toJSON Budget' {Maybe (HashMap Text [Text])
Maybe (HashMap Text Spend)
Maybe POSIX
Maybe CostTypes
Maybe Spend
Maybe CalculatedSpend
Maybe TimePeriod
Text
BudgetType
TimeUnit
budgetType :: BudgetType
timeUnit :: TimeUnit
budgetName :: Text
costFilters :: Maybe (HashMap Text [Text])
costTypes :: Maybe CostTypes
timePeriod :: Maybe TimePeriod
budgetLimit :: Maybe Spend
lastUpdatedTime :: Maybe POSIX
plannedBudgetLimits :: Maybe (HashMap Text Spend)
calculatedSpend :: Maybe CalculatedSpend
$sel:budgetType:Budget' :: Budget -> BudgetType
$sel:timeUnit:Budget' :: Budget -> TimeUnit
$sel:budgetName:Budget' :: Budget -> Text
$sel:costFilters:Budget' :: Budget -> Maybe (HashMap Text [Text])
$sel:costTypes:Budget' :: Budget -> Maybe CostTypes
$sel:timePeriod:Budget' :: Budget -> Maybe TimePeriod
$sel:budgetLimit:Budget' :: Budget -> Maybe Spend
$sel:lastUpdatedTime:Budget' :: Budget -> Maybe POSIX
$sel:plannedBudgetLimits:Budget' :: Budget -> Maybe (HashMap Text Spend)
$sel:calculatedSpend:Budget' :: Budget -> Maybe CalculatedSpend
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"CalculatedSpend" Text -> CalculatedSpend -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(CalculatedSpend -> Pair) -> Maybe CalculatedSpend -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CalculatedSpend
calculatedSpend,
(Text
"PlannedBudgetLimits" Text -> HashMap Text Spend -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(HashMap Text Spend -> Pair)
-> Maybe (HashMap Text Spend) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Spend)
plannedBudgetLimits,
(Text
"LastUpdatedTime" 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
lastUpdatedTime,
(Text
"BudgetLimit" Text -> Spend -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Spend -> Pair) -> Maybe Spend -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Spend
budgetLimit,
(Text
"TimePeriod" Text -> TimePeriod -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (TimePeriod -> Pair) -> Maybe TimePeriod -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TimePeriod
timePeriod,
(Text
"CostTypes" Text -> CostTypes -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CostTypes -> Pair) -> Maybe CostTypes -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CostTypes
costTypes,
(Text
"CostFilters" 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])
costFilters,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"BudgetName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
budgetName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TimeUnit" Text -> TimeUnit -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TimeUnit
timeUnit),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"BudgetType" Text -> BudgetType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= BudgetType
budgetType)
]
)