{-# LANGUAGE DisambiguateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Budgets.Types
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Budgets.Types
  ( -- * Service Configuration
    defaultService,

    -- * Errors
    _AccessDeniedException,
    _CreationLimitExceededException,
    _DuplicateRecordException,
    _ExpiredNextTokenException,
    _InternalErrorException,
    _InvalidNextTokenException,
    _InvalidParameterException,
    _NotFoundException,
    _ResourceLockedException,
    _ThrottlingException,

    -- * ActionStatus
    ActionStatus (..),

    -- * ActionSubType
    ActionSubType (..),

    -- * ActionType
    ActionType (..),

    -- * ApprovalModel
    ApprovalModel (..),

    -- * AutoAdjustType
    AutoAdjustType (..),

    -- * BudgetType
    BudgetType (..),

    -- * ComparisonOperator
    ComparisonOperator (..),

    -- * EventType
    EventType (..),

    -- * ExecutionType
    ExecutionType (..),

    -- * NotificationState
    NotificationState (..),

    -- * NotificationType
    NotificationType (..),

    -- * SubscriptionType
    SubscriptionType (..),

    -- * ThresholdType
    ThresholdType (..),

    -- * TimeUnit
    TimeUnit (..),

    -- * Action
    Action (..),
    newAction,
    action_actionId,
    action_budgetName,
    action_notificationType,
    action_actionType,
    action_actionThreshold,
    action_definition,
    action_executionRoleArn,
    action_approvalModel,
    action_status,
    action_subscribers,

    -- * ActionHistory
    ActionHistory (..),
    newActionHistory,
    actionHistory_timestamp,
    actionHistory_status,
    actionHistory_eventType,
    actionHistory_actionHistoryDetails,

    -- * ActionHistoryDetails
    ActionHistoryDetails (..),
    newActionHistoryDetails,
    actionHistoryDetails_message,
    actionHistoryDetails_action,

    -- * ActionThreshold
    ActionThreshold (..),
    newActionThreshold,
    actionThreshold_actionThresholdValue,
    actionThreshold_actionThresholdType,

    -- * AutoAdjustData
    AutoAdjustData (..),
    newAutoAdjustData,
    autoAdjustData_historicalOptions,
    autoAdjustData_lastAutoAdjustTime,
    autoAdjustData_autoAdjustType,

    -- * Budget
    Budget (..),
    newBudget,
    budget_autoAdjustData,
    budget_budgetLimit,
    budget_calculatedSpend,
    budget_costFilters,
    budget_costTypes,
    budget_lastUpdatedTime,
    budget_plannedBudgetLimits,
    budget_timePeriod,
    budget_budgetName,
    budget_timeUnit,
    budget_budgetType,

    -- * BudgetNotificationsForAccount
    BudgetNotificationsForAccount (..),
    newBudgetNotificationsForAccount,
    budgetNotificationsForAccount_budgetName,
    budgetNotificationsForAccount_notifications,

    -- * BudgetPerformanceHistory
    BudgetPerformanceHistory (..),
    newBudgetPerformanceHistory,
    budgetPerformanceHistory_budgetName,
    budgetPerformanceHistory_budgetType,
    budgetPerformanceHistory_budgetedAndActualAmountsList,
    budgetPerformanceHistory_costFilters,
    budgetPerformanceHistory_costTypes,
    budgetPerformanceHistory_timeUnit,

    -- * BudgetedAndActualAmounts
    BudgetedAndActualAmounts (..),
    newBudgetedAndActualAmounts,
    budgetedAndActualAmounts_actualAmount,
    budgetedAndActualAmounts_budgetedAmount,
    budgetedAndActualAmounts_timePeriod,

    -- * CalculatedSpend
    CalculatedSpend (..),
    newCalculatedSpend,
    calculatedSpend_forecastedSpend,
    calculatedSpend_actualSpend,

    -- * CostTypes
    CostTypes (..),
    newCostTypes,
    costTypes_includeCredit,
    costTypes_includeDiscount,
    costTypes_includeOtherSubscription,
    costTypes_includeRecurring,
    costTypes_includeRefund,
    costTypes_includeSubscription,
    costTypes_includeSupport,
    costTypes_includeTax,
    costTypes_includeUpfront,
    costTypes_useAmortized,
    costTypes_useBlended,

    -- * Definition
    Definition (..),
    newDefinition,
    definition_iamActionDefinition,
    definition_scpActionDefinition,
    definition_ssmActionDefinition,

    -- * HistoricalOptions
    HistoricalOptions (..),
    newHistoricalOptions,
    historicalOptions_lookBackAvailablePeriods,
    historicalOptions_budgetAdjustmentPeriod,

    -- * IamActionDefinition
    IamActionDefinition (..),
    newIamActionDefinition,
    iamActionDefinition_groups,
    iamActionDefinition_roles,
    iamActionDefinition_users,
    iamActionDefinition_policyArn,

    -- * Notification
    Notification (..),
    newNotification,
    notification_notificationState,
    notification_thresholdType,
    notification_notificationType,
    notification_comparisonOperator,
    notification_threshold,

    -- * NotificationWithSubscribers
    NotificationWithSubscribers (..),
    newNotificationWithSubscribers,
    notificationWithSubscribers_notification,
    notificationWithSubscribers_subscribers,

    -- * ScpActionDefinition
    ScpActionDefinition (..),
    newScpActionDefinition,
    scpActionDefinition_policyId,
    scpActionDefinition_targetIds,

    -- * Spend
    Spend (..),
    newSpend,
    spend_amount,
    spend_unit,

    -- * SsmActionDefinition
    SsmActionDefinition (..),
    newSsmActionDefinition,
    ssmActionDefinition_actionSubType,
    ssmActionDefinition_region,
    ssmActionDefinition_instanceIds,

    -- * Subscriber
    Subscriber (..),
    newSubscriber,
    subscriber_subscriptionType,
    subscriber_address,

    -- * TimePeriod
    TimePeriod (..),
    newTimePeriod,
    timePeriod_end,
    timePeriod_start,
  )
where

import Amazonka.Budgets.Types.Action
import Amazonka.Budgets.Types.ActionHistory
import Amazonka.Budgets.Types.ActionHistoryDetails
import Amazonka.Budgets.Types.ActionStatus
import Amazonka.Budgets.Types.ActionSubType
import Amazonka.Budgets.Types.ActionThreshold
import Amazonka.Budgets.Types.ActionType
import Amazonka.Budgets.Types.ApprovalModel
import Amazonka.Budgets.Types.AutoAdjustData
import Amazonka.Budgets.Types.AutoAdjustType
import Amazonka.Budgets.Types.Budget
import Amazonka.Budgets.Types.BudgetNotificationsForAccount
import Amazonka.Budgets.Types.BudgetPerformanceHistory
import Amazonka.Budgets.Types.BudgetType
import Amazonka.Budgets.Types.BudgetedAndActualAmounts
import Amazonka.Budgets.Types.CalculatedSpend
import Amazonka.Budgets.Types.ComparisonOperator
import Amazonka.Budgets.Types.CostTypes
import Amazonka.Budgets.Types.Definition
import Amazonka.Budgets.Types.EventType
import Amazonka.Budgets.Types.ExecutionType
import Amazonka.Budgets.Types.HistoricalOptions
import Amazonka.Budgets.Types.IamActionDefinition
import Amazonka.Budgets.Types.Notification
import Amazonka.Budgets.Types.NotificationState
import Amazonka.Budgets.Types.NotificationType
import Amazonka.Budgets.Types.NotificationWithSubscribers
import Amazonka.Budgets.Types.ScpActionDefinition
import Amazonka.Budgets.Types.Spend
import Amazonka.Budgets.Types.SsmActionDefinition
import Amazonka.Budgets.Types.Subscriber
import Amazonka.Budgets.Types.SubscriptionType
import Amazonka.Budgets.Types.ThresholdType
import Amazonka.Budgets.Types.TimePeriod
import Amazonka.Budgets.Types.TimeUnit
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Sign.V4 as Sign

-- | API version @2016-10-20@ of the Amazon Budgets SDK configuration.
defaultService :: Core.Service
defaultService :: Service
defaultService =
  Core.Service
    { $sel:abbrev:Service :: Abbrev
Core.abbrev = Abbrev
"Budgets",
      $sel:signer:Service :: Signer
Core.signer = Signer
Sign.v4,
      $sel:endpointPrefix:Service :: ByteString
Core.endpointPrefix = ByteString
"budgets",
      $sel:signingName:Service :: ByteString
Core.signingName = ByteString
"budgets",
      $sel:version:Service :: ByteString
Core.version = ByteString
"2016-10-20",
      $sel:s3AddressingStyle:Service :: S3AddressingStyle
Core.s3AddressingStyle = S3AddressingStyle
Core.S3AddressingStyleAuto,
      $sel:endpoint:Service :: Region -> Endpoint
Core.endpoint = Service -> Region -> Endpoint
Core.defaultEndpoint Service
defaultService,
      $sel:timeout:Service :: Maybe Seconds
Core.timeout = forall a. a -> Maybe a
Prelude.Just Seconds
70,
      $sel:check:Service :: Status -> Bool
Core.check = Status -> Bool
Core.statusSuccess,
      $sel:error:Service :: Status -> [Header] -> ByteStringLazy -> Error
Core.error = Abbrev -> Status -> [Header] -> ByteStringLazy -> Error
Core.parseJSONError Abbrev
"Budgets",
      $sel:retry:Service :: Retry
Core.retry = Retry
retry
    }
  where
    retry :: Retry
retry =
      Core.Exponential
        { $sel:base:Exponential :: Double
Core.base = Double
5.0e-2,
          $sel:growth:Exponential :: Int
Core.growth = Int
2,
          $sel:attempts:Exponential :: Int
Core.attempts = Int
5,
          $sel:check:Exponential :: ServiceError -> Maybe Text
Core.check = forall {a}. IsString a => ServiceError -> Maybe a
check
        }
    check :: ServiceError -> Maybe a
check ServiceError
e
      | forall s a. Getting Any s a -> s -> Bool
Lens.has (forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
502) ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"bad_gateway"
      | forall s a. Getting Any s a -> s -> Bool
Lens.has (forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
504) ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"gateway_timeout"
      | forall s a. Getting Any s a -> s -> Bool
Lens.has (forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
500) ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"general_server_error"
      | forall s a. Getting Any s a -> s -> Bool
Lens.has (forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
509) ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"limit_exceeded"
      | forall s a. Getting Any s a -> s -> Bool
Lens.has
          ( forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
ErrorCode -> Optic' p f ServiceError ServiceError
Core.hasCode ErrorCode
"RequestThrottledException"
              forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
400
          )
          ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"request_throttled_exception"
      | forall s a. Getting Any s a -> s -> Bool
Lens.has (forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
503) ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"service_unavailable"
      | forall s a. Getting Any s a -> s -> Bool
Lens.has
          ( forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
ErrorCode -> Optic' p f ServiceError ServiceError
Core.hasCode ErrorCode
"ThrottledException"
              forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
400
          )
          ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"throttled_exception"
      | forall s a. Getting Any s a -> s -> Bool
Lens.has
          ( forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
ErrorCode -> Optic' p f ServiceError ServiceError
Core.hasCode ErrorCode
"Throttling"
              forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
400
          )
          ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"throttling"
      | forall s a. Getting Any s a -> s -> Bool
Lens.has
          ( forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
ErrorCode -> Optic' p f ServiceError ServiceError
Core.hasCode ErrorCode
"ThrottlingException"
              forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
400
          )
          ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"throttling_exception"
      | forall s a. Getting Any s a -> s -> Bool
Lens.has
          ( forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
ErrorCode -> Optic' p f ServiceError ServiceError
Core.hasCode
              ErrorCode
"ProvisionedThroughputExceededException"
              forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
400
          )
          ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"throughput_exceeded"
      | forall s a. Getting Any s a -> s -> Bool
Lens.has (forall (f :: * -> *) (p :: * -> * -> *).
(Applicative f, Choice p) =>
Int -> Optic' p f ServiceError ServiceError
Core.hasStatus Int
429) ServiceError
e =
          forall a. a -> Maybe a
Prelude.Just a
"too_many_requests"
      | Bool
Prelude.otherwise = forall a. Maybe a
Prelude.Nothing

-- | You are not authorized to use this operation with the given parameters.
_AccessDeniedException :: (Core.AsError a) => Lens.Fold a Core.ServiceError
_AccessDeniedException :: forall a. AsError a => Fold a ServiceError
_AccessDeniedException =
  forall a. AsError a => Service -> ErrorCode -> Fold a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"AccessDeniedException"

-- | You\'ve exceeded the notification or subscriber limit.
_CreationLimitExceededException :: (Core.AsError a) => Lens.Fold a Core.ServiceError
_CreationLimitExceededException :: forall a. AsError a => Fold a ServiceError
_CreationLimitExceededException =
  forall a. AsError a => Service -> ErrorCode -> Fold a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"CreationLimitExceededException"

-- | The budget name already exists. Budget names must be unique within an
-- account.
_DuplicateRecordException :: (Core.AsError a) => Lens.Fold a Core.ServiceError
_DuplicateRecordException :: forall a. AsError a => Fold a ServiceError
_DuplicateRecordException =
  forall a. AsError a => Service -> ErrorCode -> Fold a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"DuplicateRecordException"

-- | The pagination token expired.
_ExpiredNextTokenException :: (Core.AsError a) => Lens.Fold a Core.ServiceError
_ExpiredNextTokenException :: forall a. AsError a => Fold a ServiceError
_ExpiredNextTokenException =
  forall a. AsError a => Service -> ErrorCode -> Fold a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"ExpiredNextTokenException"

-- | An error on the server occurred during the processing of your request.
-- Try again later.
_InternalErrorException :: (Core.AsError a) => Lens.Fold a Core.ServiceError
_InternalErrorException :: forall a. AsError a => Fold a ServiceError
_InternalErrorException =
  forall a. AsError a => Service -> ErrorCode -> Fold a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"InternalErrorException"

-- | The pagination token is invalid.
_InvalidNextTokenException :: (Core.AsError a) => Lens.Fold a Core.ServiceError
_InvalidNextTokenException :: forall a. AsError a => Fold a ServiceError
_InvalidNextTokenException =
  forall a. AsError a => Service -> ErrorCode -> Fold a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"InvalidNextTokenException"

-- | An error on the client occurred. Typically, the cause is an invalid
-- input value.
_InvalidParameterException :: (Core.AsError a) => Lens.Fold a Core.ServiceError
_InvalidParameterException :: forall a. AsError a => Fold a ServiceError
_InvalidParameterException =
  forall a. AsError a => Service -> ErrorCode -> Fold a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"InvalidParameterException"

-- | We can’t locate the resource that you specified.
_NotFoundException :: (Core.AsError a) => Lens.Fold a Core.ServiceError
_NotFoundException :: forall a. AsError a => Fold a ServiceError
_NotFoundException =
  forall a. AsError a => Service -> ErrorCode -> Fold a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"NotFoundException"

-- | The request was received and recognized by the server, but the server
-- rejected that particular method for the requested resource.
_ResourceLockedException :: (Core.AsError a) => Lens.Fold a Core.ServiceError
_ResourceLockedException :: forall a. AsError a => Fold a ServiceError
_ResourceLockedException =
  forall a. AsError a => Service -> ErrorCode -> Fold a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"ResourceLockedException"

-- | The number of API requests has exceeded the maximum allowed API request
-- throttling limit for the account.
_ThrottlingException :: (Core.AsError a) => Lens.Fold a Core.ServiceError
_ThrottlingException :: forall a. AsError a => Fold a ServiceError
_ThrottlingException =
  forall a. AsError a => Service -> ErrorCode -> Fold a ServiceError
Core._MatchServiceError
    Service
defaultService
    ErrorCode
"ThrottlingException"