module Network.AWS.Budgets.Types.Product where
import Network.AWS.Budgets.Types.Sum
import Network.AWS.Lens
import Network.AWS.Prelude
data Budget = Budget'
{ _bCalculatedSpend :: !(Maybe CalculatedSpend)
, _bCostFilters :: !(Maybe (Map Text [Text]))
, _bBudgetName :: !Text
, _bBudgetLimit :: !Spend
, _bCostTypes :: !CostTypes
, _bTimeUnit :: !TimeUnit
, _bTimePeriod :: !TimePeriod
, _bBudgetType :: !BudgetType
} deriving (Eq, Read, Show, Data, Typeable, Generic)
budget
:: Text
-> Spend
-> CostTypes
-> TimeUnit
-> TimePeriod
-> BudgetType
-> Budget
budget pBudgetName_ pBudgetLimit_ pCostTypes_ pTimeUnit_ pTimePeriod_ pBudgetType_ =
Budget'
{ _bCalculatedSpend = Nothing
, _bCostFilters = Nothing
, _bBudgetName = pBudgetName_
, _bBudgetLimit = pBudgetLimit_
, _bCostTypes = pCostTypes_
, _bTimeUnit = pTimeUnit_
, _bTimePeriod = pTimePeriod_
, _bBudgetType = pBudgetType_
}
bCalculatedSpend :: Lens' Budget (Maybe CalculatedSpend)
bCalculatedSpend = lens _bCalculatedSpend (\ s a -> s{_bCalculatedSpend = a});
bCostFilters :: Lens' Budget (HashMap Text [Text])
bCostFilters = lens _bCostFilters (\ s a -> s{_bCostFilters = a}) . _Default . _Map;
bBudgetName :: Lens' Budget Text
bBudgetName = lens _bBudgetName (\ s a -> s{_bBudgetName = a});
bBudgetLimit :: Lens' Budget Spend
bBudgetLimit = lens _bBudgetLimit (\ s a -> s{_bBudgetLimit = a});
bCostTypes :: Lens' Budget CostTypes
bCostTypes = lens _bCostTypes (\ s a -> s{_bCostTypes = a});
bTimeUnit :: Lens' Budget TimeUnit
bTimeUnit = lens _bTimeUnit (\ s a -> s{_bTimeUnit = a});
bTimePeriod :: Lens' Budget TimePeriod
bTimePeriod = lens _bTimePeriod (\ s a -> s{_bTimePeriod = a});
bBudgetType :: Lens' Budget BudgetType
bBudgetType = lens _bBudgetType (\ s a -> s{_bBudgetType = a});
instance FromJSON Budget where
parseJSON
= withObject "Budget"
(\ x ->
Budget' <$>
(x .:? "CalculatedSpend") <*>
(x .:? "CostFilters" .!= mempty)
<*> (x .: "BudgetName")
<*> (x .: "BudgetLimit")
<*> (x .: "CostTypes")
<*> (x .: "TimeUnit")
<*> (x .: "TimePeriod")
<*> (x .: "BudgetType"))
instance Hashable Budget where
instance NFData Budget where
instance ToJSON Budget where
toJSON Budget'{..}
= object
(catMaybes
[("CalculatedSpend" .=) <$> _bCalculatedSpend,
("CostFilters" .=) <$> _bCostFilters,
Just ("BudgetName" .= _bBudgetName),
Just ("BudgetLimit" .= _bBudgetLimit),
Just ("CostTypes" .= _bCostTypes),
Just ("TimeUnit" .= _bTimeUnit),
Just ("TimePeriod" .= _bTimePeriod),
Just ("BudgetType" .= _bBudgetType)])
data CalculatedSpend = CalculatedSpend'
{ _csForecastedSpend :: !(Maybe Spend)
, _csActualSpend :: !Spend
} deriving (Eq, Read, Show, Data, Typeable, Generic)
calculatedSpend
:: Spend
-> CalculatedSpend
calculatedSpend pActualSpend_ =
CalculatedSpend'
{_csForecastedSpend = Nothing, _csActualSpend = pActualSpend_}
csForecastedSpend :: Lens' CalculatedSpend (Maybe Spend)
csForecastedSpend = lens _csForecastedSpend (\ s a -> s{_csForecastedSpend = a});
csActualSpend :: Lens' CalculatedSpend Spend
csActualSpend = lens _csActualSpend (\ s a -> s{_csActualSpend = a});
instance FromJSON CalculatedSpend where
parseJSON
= withObject "CalculatedSpend"
(\ x ->
CalculatedSpend' <$>
(x .:? "ForecastedSpend") <*> (x .: "ActualSpend"))
instance Hashable CalculatedSpend where
instance NFData CalculatedSpend where
instance ToJSON CalculatedSpend where
toJSON CalculatedSpend'{..}
= object
(catMaybes
[("ForecastedSpend" .=) <$> _csForecastedSpend,
Just ("ActualSpend" .= _csActualSpend)])
data CostTypes = CostTypes'
{ _ctIncludeTax :: !Bool
, _ctIncludeSubscription :: !Bool
, _ctUseBlended :: !Bool
} deriving (Eq, Read, Show, Data, Typeable, Generic)
costTypes
:: Bool
-> Bool
-> Bool
-> CostTypes
costTypes pIncludeTax_ pIncludeSubscription_ pUseBlended_ =
CostTypes'
{ _ctIncludeTax = pIncludeTax_
, _ctIncludeSubscription = pIncludeSubscription_
, _ctUseBlended = pUseBlended_
}
ctIncludeTax :: Lens' CostTypes Bool
ctIncludeTax = lens _ctIncludeTax (\ s a -> s{_ctIncludeTax = a});
ctIncludeSubscription :: Lens' CostTypes Bool
ctIncludeSubscription = lens _ctIncludeSubscription (\ s a -> s{_ctIncludeSubscription = a});
ctUseBlended :: Lens' CostTypes Bool
ctUseBlended = lens _ctUseBlended (\ s a -> s{_ctUseBlended = a});
instance FromJSON CostTypes where
parseJSON
= withObject "CostTypes"
(\ x ->
CostTypes' <$>
(x .: "IncludeTax") <*> (x .: "IncludeSubscription")
<*> (x .: "UseBlended"))
instance Hashable CostTypes where
instance NFData CostTypes where
instance ToJSON CostTypes where
toJSON CostTypes'{..}
= object
(catMaybes
[Just ("IncludeTax" .= _ctIncludeTax),
Just
("IncludeSubscription" .= _ctIncludeSubscription),
Just ("UseBlended" .= _ctUseBlended)])
data Notification = Notification'
{ _nThresholdType :: !(Maybe ThresholdType)
, _nNotificationType :: !NotificationType
, _nComparisonOperator :: !ComparisonOperator
, _nThreshold :: !Double
} deriving (Eq, Read, Show, Data, Typeable, Generic)
notification
:: NotificationType
-> ComparisonOperator
-> Double
-> Notification
notification pNotificationType_ pComparisonOperator_ pThreshold_ =
Notification'
{ _nThresholdType = Nothing
, _nNotificationType = pNotificationType_
, _nComparisonOperator = pComparisonOperator_
, _nThreshold = pThreshold_
}
nThresholdType :: Lens' Notification (Maybe ThresholdType)
nThresholdType = lens _nThresholdType (\ s a -> s{_nThresholdType = a});
nNotificationType :: Lens' Notification NotificationType
nNotificationType = lens _nNotificationType (\ s a -> s{_nNotificationType = a});
nComparisonOperator :: Lens' Notification ComparisonOperator
nComparisonOperator = lens _nComparisonOperator (\ s a -> s{_nComparisonOperator = a});
nThreshold :: Lens' Notification Double
nThreshold = lens _nThreshold (\ s a -> s{_nThreshold = a});
instance FromJSON Notification where
parseJSON
= withObject "Notification"
(\ x ->
Notification' <$>
(x .:? "ThresholdType") <*> (x .: "NotificationType")
<*> (x .: "ComparisonOperator")
<*> (x .: "Threshold"))
instance Hashable Notification where
instance NFData Notification where
instance ToJSON Notification where
toJSON Notification'{..}
= object
(catMaybes
[("ThresholdType" .=) <$> _nThresholdType,
Just ("NotificationType" .= _nNotificationType),
Just ("ComparisonOperator" .= _nComparisonOperator),
Just ("Threshold" .= _nThreshold)])
data NotificationWithSubscribers = NotificationWithSubscribers'
{ _nwsNotification :: !Notification
, _nwsSubscribers :: !(List1 Subscriber)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
notificationWithSubscribers
:: Notification
-> NonEmpty Subscriber
-> NotificationWithSubscribers
notificationWithSubscribers pNotification_ pSubscribers_ =
NotificationWithSubscribers'
{_nwsNotification = pNotification_, _nwsSubscribers = _List1 # pSubscribers_}
nwsNotification :: Lens' NotificationWithSubscribers Notification
nwsNotification = lens _nwsNotification (\ s a -> s{_nwsNotification = a});
nwsSubscribers :: Lens' NotificationWithSubscribers (NonEmpty Subscriber)
nwsSubscribers = lens _nwsSubscribers (\ s a -> s{_nwsSubscribers = a}) . _List1;
instance Hashable NotificationWithSubscribers where
instance NFData NotificationWithSubscribers where
instance ToJSON NotificationWithSubscribers where
toJSON NotificationWithSubscribers'{..}
= object
(catMaybes
[Just ("Notification" .= _nwsNotification),
Just ("Subscribers" .= _nwsSubscribers)])
data Spend = Spend'
{ _sAmount :: !Text
, _sUnit :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
spend
:: Text
-> Text
-> Spend
spend pAmount_ pUnit_ = Spend' {_sAmount = pAmount_, _sUnit = pUnit_}
sAmount :: Lens' Spend Text
sAmount = lens _sAmount (\ s a -> s{_sAmount = a});
sUnit :: Lens' Spend Text
sUnit = lens _sUnit (\ s a -> s{_sUnit = a});
instance FromJSON Spend where
parseJSON
= withObject "Spend"
(\ x -> Spend' <$> (x .: "Amount") <*> (x .: "Unit"))
instance Hashable Spend where
instance NFData Spend where
instance ToJSON Spend where
toJSON Spend'{..}
= object
(catMaybes
[Just ("Amount" .= _sAmount),
Just ("Unit" .= _sUnit)])
data Subscriber = Subscriber'
{ _sSubscriptionType :: !SubscriptionType
, _sAddress :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
subscriber
:: SubscriptionType
-> Text
-> Subscriber
subscriber pSubscriptionType_ pAddress_ =
Subscriber' {_sSubscriptionType = pSubscriptionType_, _sAddress = pAddress_}
sSubscriptionType :: Lens' Subscriber SubscriptionType
sSubscriptionType = lens _sSubscriptionType (\ s a -> s{_sSubscriptionType = a});
sAddress :: Lens' Subscriber Text
sAddress = lens _sAddress (\ s a -> s{_sAddress = a});
instance FromJSON Subscriber where
parseJSON
= withObject "Subscriber"
(\ x ->
Subscriber' <$>
(x .: "SubscriptionType") <*> (x .: "Address"))
instance Hashable Subscriber where
instance NFData Subscriber where
instance ToJSON Subscriber where
toJSON Subscriber'{..}
= object
(catMaybes
[Just ("SubscriptionType" .= _sSubscriptionType),
Just ("Address" .= _sAddress)])
data TimePeriod = TimePeriod'
{ _tpStart :: !POSIX
, _tpEnd :: !POSIX
} deriving (Eq, Read, Show, Data, Typeable, Generic)
timePeriod
:: UTCTime
-> UTCTime
-> TimePeriod
timePeriod pStart_ pEnd_ =
TimePeriod' {_tpStart = _Time # pStart_, _tpEnd = _Time # pEnd_}
tpStart :: Lens' TimePeriod UTCTime
tpStart = lens _tpStart (\ s a -> s{_tpStart = a}) . _Time;
tpEnd :: Lens' TimePeriod UTCTime
tpEnd = lens _tpEnd (\ s a -> s{_tpEnd = a}) . _Time;
instance FromJSON TimePeriod where
parseJSON
= withObject "TimePeriod"
(\ x ->
TimePeriod' <$> (x .: "Start") <*> (x .: "End"))
instance Hashable TimePeriod where
instance NFData TimePeriod where
instance ToJSON TimePeriod where
toJSON TimePeriod'{..}
= object
(catMaybes
[Just ("Start" .= _tpStart), Just ("End" .= _tpEnd)])