{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

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

-- |
-- Module      : Amazonka.Budgets.UpdateBudgetAction
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates a budget action.
module Amazonka.Budgets.UpdateBudgetAction
  ( -- * Creating a Request
    UpdateBudgetAction (..),
    newUpdateBudgetAction,

    -- * Request Lenses
    updateBudgetAction_actionThreshold,
    updateBudgetAction_approvalModel,
    updateBudgetAction_definition,
    updateBudgetAction_executionRoleArn,
    updateBudgetAction_notificationType,
    updateBudgetAction_subscribers,
    updateBudgetAction_accountId,
    updateBudgetAction_budgetName,
    updateBudgetAction_actionId,

    -- * Destructuring the Response
    UpdateBudgetActionResponse (..),
    newUpdateBudgetActionResponse,

    -- * Response Lenses
    updateBudgetActionResponse_httpStatus,
    updateBudgetActionResponse_accountId,
    updateBudgetActionResponse_budgetName,
    updateBudgetActionResponse_oldAction,
    updateBudgetActionResponse_newAction,
  )
where

import Amazonka.Budgets.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newUpdateBudgetAction' smart constructor.
data UpdateBudgetAction = UpdateBudgetAction'
  { UpdateBudgetAction -> Maybe ActionThreshold
actionThreshold :: Prelude.Maybe ActionThreshold,
    -- | This specifies if the action needs manual or automatic approval.
    UpdateBudgetAction -> Maybe ApprovalModel
approvalModel :: Prelude.Maybe ApprovalModel,
    UpdateBudgetAction -> Maybe Definition
definition :: Prelude.Maybe Definition,
    -- | The role passed for action execution and reversion. Roles and actions
    -- must be in the same account.
    UpdateBudgetAction -> Maybe Text
executionRoleArn :: Prelude.Maybe Prelude.Text,
    UpdateBudgetAction -> Maybe NotificationType
notificationType :: Prelude.Maybe NotificationType,
    UpdateBudgetAction -> Maybe (NonEmpty Subscriber)
subscribers :: Prelude.Maybe (Prelude.NonEmpty Subscriber),
    UpdateBudgetAction -> Text
accountId :: Prelude.Text,
    UpdateBudgetAction -> Text
budgetName :: Prelude.Text,
    -- | A system-generated universally unique identifier (UUID) for the action.
    UpdateBudgetAction -> Text
actionId :: Prelude.Text
  }
  deriving (UpdateBudgetAction -> UpdateBudgetAction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateBudgetAction -> UpdateBudgetAction -> Bool
$c/= :: UpdateBudgetAction -> UpdateBudgetAction -> Bool
== :: UpdateBudgetAction -> UpdateBudgetAction -> Bool
$c== :: UpdateBudgetAction -> UpdateBudgetAction -> Bool
Prelude.Eq, Int -> UpdateBudgetAction -> ShowS
[UpdateBudgetAction] -> ShowS
UpdateBudgetAction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateBudgetAction] -> ShowS
$cshowList :: [UpdateBudgetAction] -> ShowS
show :: UpdateBudgetAction -> String
$cshow :: UpdateBudgetAction -> String
showsPrec :: Int -> UpdateBudgetAction -> ShowS
$cshowsPrec :: Int -> UpdateBudgetAction -> ShowS
Prelude.Show, forall x. Rep UpdateBudgetAction x -> UpdateBudgetAction
forall x. UpdateBudgetAction -> Rep UpdateBudgetAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateBudgetAction x -> UpdateBudgetAction
$cfrom :: forall x. UpdateBudgetAction -> Rep UpdateBudgetAction x
Prelude.Generic)

-- |
-- Create a value of 'UpdateBudgetAction' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'actionThreshold', 'updateBudgetAction_actionThreshold' - Undocumented member.
--
-- 'approvalModel', 'updateBudgetAction_approvalModel' - This specifies if the action needs manual or automatic approval.
--
-- 'definition', 'updateBudgetAction_definition' - Undocumented member.
--
-- 'executionRoleArn', 'updateBudgetAction_executionRoleArn' - The role passed for action execution and reversion. Roles and actions
-- must be in the same account.
--
-- 'notificationType', 'updateBudgetAction_notificationType' - Undocumented member.
--
-- 'subscribers', 'updateBudgetAction_subscribers' - Undocumented member.
--
-- 'accountId', 'updateBudgetAction_accountId' - Undocumented member.
--
-- 'budgetName', 'updateBudgetAction_budgetName' - Undocumented member.
--
-- 'actionId', 'updateBudgetAction_actionId' - A system-generated universally unique identifier (UUID) for the action.
newUpdateBudgetAction ::
  -- | 'accountId'
  Prelude.Text ->
  -- | 'budgetName'
  Prelude.Text ->
  -- | 'actionId'
  Prelude.Text ->
  UpdateBudgetAction
newUpdateBudgetAction :: Text -> Text -> Text -> UpdateBudgetAction
newUpdateBudgetAction
  Text
pAccountId_
  Text
pBudgetName_
  Text
pActionId_ =
    UpdateBudgetAction'
      { $sel:actionThreshold:UpdateBudgetAction' :: Maybe ActionThreshold
actionThreshold =
          forall a. Maybe a
Prelude.Nothing,
        $sel:approvalModel:UpdateBudgetAction' :: Maybe ApprovalModel
approvalModel = forall a. Maybe a
Prelude.Nothing,
        $sel:definition:UpdateBudgetAction' :: Maybe Definition
definition = forall a. Maybe a
Prelude.Nothing,
        $sel:executionRoleArn:UpdateBudgetAction' :: Maybe Text
executionRoleArn = forall a. Maybe a
Prelude.Nothing,
        $sel:notificationType:UpdateBudgetAction' :: Maybe NotificationType
notificationType = forall a. Maybe a
Prelude.Nothing,
        $sel:subscribers:UpdateBudgetAction' :: Maybe (NonEmpty Subscriber)
subscribers = forall a. Maybe a
Prelude.Nothing,
        $sel:accountId:UpdateBudgetAction' :: Text
accountId = Text
pAccountId_,
        $sel:budgetName:UpdateBudgetAction' :: Text
budgetName = Text
pBudgetName_,
        $sel:actionId:UpdateBudgetAction' :: Text
actionId = Text
pActionId_
      }

-- | Undocumented member.
updateBudgetAction_actionThreshold :: Lens.Lens' UpdateBudgetAction (Prelude.Maybe ActionThreshold)
updateBudgetAction_actionThreshold :: Lens' UpdateBudgetAction (Maybe ActionThreshold)
updateBudgetAction_actionThreshold = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBudgetAction' {Maybe ActionThreshold
actionThreshold :: Maybe ActionThreshold
$sel:actionThreshold:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe ActionThreshold
actionThreshold} -> Maybe ActionThreshold
actionThreshold) (\s :: UpdateBudgetAction
s@UpdateBudgetAction' {} Maybe ActionThreshold
a -> UpdateBudgetAction
s {$sel:actionThreshold:UpdateBudgetAction' :: Maybe ActionThreshold
actionThreshold = Maybe ActionThreshold
a} :: UpdateBudgetAction)

-- | This specifies if the action needs manual or automatic approval.
updateBudgetAction_approvalModel :: Lens.Lens' UpdateBudgetAction (Prelude.Maybe ApprovalModel)
updateBudgetAction_approvalModel :: Lens' UpdateBudgetAction (Maybe ApprovalModel)
updateBudgetAction_approvalModel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBudgetAction' {Maybe ApprovalModel
approvalModel :: Maybe ApprovalModel
$sel:approvalModel:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe ApprovalModel
approvalModel} -> Maybe ApprovalModel
approvalModel) (\s :: UpdateBudgetAction
s@UpdateBudgetAction' {} Maybe ApprovalModel
a -> UpdateBudgetAction
s {$sel:approvalModel:UpdateBudgetAction' :: Maybe ApprovalModel
approvalModel = Maybe ApprovalModel
a} :: UpdateBudgetAction)

-- | Undocumented member.
updateBudgetAction_definition :: Lens.Lens' UpdateBudgetAction (Prelude.Maybe Definition)
updateBudgetAction_definition :: Lens' UpdateBudgetAction (Maybe Definition)
updateBudgetAction_definition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBudgetAction' {Maybe Definition
definition :: Maybe Definition
$sel:definition:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe Definition
definition} -> Maybe Definition
definition) (\s :: UpdateBudgetAction
s@UpdateBudgetAction' {} Maybe Definition
a -> UpdateBudgetAction
s {$sel:definition:UpdateBudgetAction' :: Maybe Definition
definition = Maybe Definition
a} :: UpdateBudgetAction)

-- | The role passed for action execution and reversion. Roles and actions
-- must be in the same account.
updateBudgetAction_executionRoleArn :: Lens.Lens' UpdateBudgetAction (Prelude.Maybe Prelude.Text)
updateBudgetAction_executionRoleArn :: Lens' UpdateBudgetAction (Maybe Text)
updateBudgetAction_executionRoleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBudgetAction' {Maybe Text
executionRoleArn :: Maybe Text
$sel:executionRoleArn:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe Text
executionRoleArn} -> Maybe Text
executionRoleArn) (\s :: UpdateBudgetAction
s@UpdateBudgetAction' {} Maybe Text
a -> UpdateBudgetAction
s {$sel:executionRoleArn:UpdateBudgetAction' :: Maybe Text
executionRoleArn = Maybe Text
a} :: UpdateBudgetAction)

-- | Undocumented member.
updateBudgetAction_notificationType :: Lens.Lens' UpdateBudgetAction (Prelude.Maybe NotificationType)
updateBudgetAction_notificationType :: Lens' UpdateBudgetAction (Maybe NotificationType)
updateBudgetAction_notificationType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBudgetAction' {Maybe NotificationType
notificationType :: Maybe NotificationType
$sel:notificationType:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe NotificationType
notificationType} -> Maybe NotificationType
notificationType) (\s :: UpdateBudgetAction
s@UpdateBudgetAction' {} Maybe NotificationType
a -> UpdateBudgetAction
s {$sel:notificationType:UpdateBudgetAction' :: Maybe NotificationType
notificationType = Maybe NotificationType
a} :: UpdateBudgetAction)

-- | Undocumented member.
updateBudgetAction_subscribers :: Lens.Lens' UpdateBudgetAction (Prelude.Maybe (Prelude.NonEmpty Subscriber))
updateBudgetAction_subscribers :: Lens' UpdateBudgetAction (Maybe (NonEmpty Subscriber))
updateBudgetAction_subscribers = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBudgetAction' {Maybe (NonEmpty Subscriber)
subscribers :: Maybe (NonEmpty Subscriber)
$sel:subscribers:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe (NonEmpty Subscriber)
subscribers} -> Maybe (NonEmpty Subscriber)
subscribers) (\s :: UpdateBudgetAction
s@UpdateBudgetAction' {} Maybe (NonEmpty Subscriber)
a -> UpdateBudgetAction
s {$sel:subscribers:UpdateBudgetAction' :: Maybe (NonEmpty Subscriber)
subscribers = Maybe (NonEmpty Subscriber)
a} :: UpdateBudgetAction) 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

-- | Undocumented member.
updateBudgetAction_accountId :: Lens.Lens' UpdateBudgetAction Prelude.Text
updateBudgetAction_accountId :: Lens' UpdateBudgetAction Text
updateBudgetAction_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBudgetAction' {Text
accountId :: Text
$sel:accountId:UpdateBudgetAction' :: UpdateBudgetAction -> Text
accountId} -> Text
accountId) (\s :: UpdateBudgetAction
s@UpdateBudgetAction' {} Text
a -> UpdateBudgetAction
s {$sel:accountId:UpdateBudgetAction' :: Text
accountId = Text
a} :: UpdateBudgetAction)

-- | Undocumented member.
updateBudgetAction_budgetName :: Lens.Lens' UpdateBudgetAction Prelude.Text
updateBudgetAction_budgetName :: Lens' UpdateBudgetAction Text
updateBudgetAction_budgetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBudgetAction' {Text
budgetName :: Text
$sel:budgetName:UpdateBudgetAction' :: UpdateBudgetAction -> Text
budgetName} -> Text
budgetName) (\s :: UpdateBudgetAction
s@UpdateBudgetAction' {} Text
a -> UpdateBudgetAction
s {$sel:budgetName:UpdateBudgetAction' :: Text
budgetName = Text
a} :: UpdateBudgetAction)

-- | A system-generated universally unique identifier (UUID) for the action.
updateBudgetAction_actionId :: Lens.Lens' UpdateBudgetAction Prelude.Text
updateBudgetAction_actionId :: Lens' UpdateBudgetAction Text
updateBudgetAction_actionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBudgetAction' {Text
actionId :: Text
$sel:actionId:UpdateBudgetAction' :: UpdateBudgetAction -> Text
actionId} -> Text
actionId) (\s :: UpdateBudgetAction
s@UpdateBudgetAction' {} Text
a -> UpdateBudgetAction
s {$sel:actionId:UpdateBudgetAction' :: Text
actionId = Text
a} :: UpdateBudgetAction)

instance Core.AWSRequest UpdateBudgetAction where
  type
    AWSResponse UpdateBudgetAction =
      UpdateBudgetActionResponse
  request :: (Service -> Service)
-> UpdateBudgetAction -> Request UpdateBudgetAction
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateBudgetAction
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateBudgetAction)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int
-> Text -> Text -> Action -> Action -> UpdateBudgetActionResponse
UpdateBudgetActionResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"AccountId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"BudgetName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"OldAction")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"NewAction")
      )

instance Prelude.Hashable UpdateBudgetAction where
  hashWithSalt :: Int -> UpdateBudgetAction -> Int
hashWithSalt Int
_salt UpdateBudgetAction' {Maybe (NonEmpty Subscriber)
Maybe Text
Maybe ApprovalModel
Maybe NotificationType
Maybe Definition
Maybe ActionThreshold
Text
actionId :: Text
budgetName :: Text
accountId :: Text
subscribers :: Maybe (NonEmpty Subscriber)
notificationType :: Maybe NotificationType
executionRoleArn :: Maybe Text
definition :: Maybe Definition
approvalModel :: Maybe ApprovalModel
actionThreshold :: Maybe ActionThreshold
$sel:actionId:UpdateBudgetAction' :: UpdateBudgetAction -> Text
$sel:budgetName:UpdateBudgetAction' :: UpdateBudgetAction -> Text
$sel:accountId:UpdateBudgetAction' :: UpdateBudgetAction -> Text
$sel:subscribers:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe (NonEmpty Subscriber)
$sel:notificationType:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe NotificationType
$sel:executionRoleArn:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe Text
$sel:definition:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe Definition
$sel:approvalModel:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe ApprovalModel
$sel:actionThreshold:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe ActionThreshold
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ActionThreshold
actionThreshold
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ApprovalModel
approvalModel
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Definition
definition
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
executionRoleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NotificationType
notificationType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Subscriber)
subscribers
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
budgetName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
actionId

instance Prelude.NFData UpdateBudgetAction where
  rnf :: UpdateBudgetAction -> ()
rnf UpdateBudgetAction' {Maybe (NonEmpty Subscriber)
Maybe Text
Maybe ApprovalModel
Maybe NotificationType
Maybe Definition
Maybe ActionThreshold
Text
actionId :: Text
budgetName :: Text
accountId :: Text
subscribers :: Maybe (NonEmpty Subscriber)
notificationType :: Maybe NotificationType
executionRoleArn :: Maybe Text
definition :: Maybe Definition
approvalModel :: Maybe ApprovalModel
actionThreshold :: Maybe ActionThreshold
$sel:actionId:UpdateBudgetAction' :: UpdateBudgetAction -> Text
$sel:budgetName:UpdateBudgetAction' :: UpdateBudgetAction -> Text
$sel:accountId:UpdateBudgetAction' :: UpdateBudgetAction -> Text
$sel:subscribers:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe (NonEmpty Subscriber)
$sel:notificationType:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe NotificationType
$sel:executionRoleArn:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe Text
$sel:definition:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe Definition
$sel:approvalModel:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe ApprovalModel
$sel:actionThreshold:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe ActionThreshold
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ActionThreshold
actionThreshold
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ApprovalModel
approvalModel
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Definition
definition
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
executionRoleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe NotificationType
notificationType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Subscriber)
subscribers
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
budgetName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
actionId

instance Data.ToHeaders UpdateBudgetAction where
  toHeaders :: UpdateBudgetAction -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSBudgetServiceGateway.UpdateBudgetAction" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON UpdateBudgetAction where
  toJSON :: UpdateBudgetAction -> Value
toJSON UpdateBudgetAction' {Maybe (NonEmpty Subscriber)
Maybe Text
Maybe ApprovalModel
Maybe NotificationType
Maybe Definition
Maybe ActionThreshold
Text
actionId :: Text
budgetName :: Text
accountId :: Text
subscribers :: Maybe (NonEmpty Subscriber)
notificationType :: Maybe NotificationType
executionRoleArn :: Maybe Text
definition :: Maybe Definition
approvalModel :: Maybe ApprovalModel
actionThreshold :: Maybe ActionThreshold
$sel:actionId:UpdateBudgetAction' :: UpdateBudgetAction -> Text
$sel:budgetName:UpdateBudgetAction' :: UpdateBudgetAction -> Text
$sel:accountId:UpdateBudgetAction' :: UpdateBudgetAction -> Text
$sel:subscribers:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe (NonEmpty Subscriber)
$sel:notificationType:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe NotificationType
$sel:executionRoleArn:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe Text
$sel:definition:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe Definition
$sel:approvalModel:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe ApprovalModel
$sel:actionThreshold:UpdateBudgetAction' :: UpdateBudgetAction -> Maybe ActionThreshold
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ActionThreshold" 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 ActionThreshold
actionThreshold,
            (Key
"ApprovalModel" 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 ApprovalModel
approvalModel,
            (Key
"Definition" 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 Definition
definition,
            (Key
"ExecutionRoleArn" 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 Text
executionRoleArn,
            (Key
"NotificationType" 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 NotificationType
notificationType,
            (Key
"Subscribers" 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 (NonEmpty Subscriber)
subscribers,
            forall a. a -> Maybe a
Prelude.Just (Key
"AccountId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
accountId),
            forall a. a -> Maybe a
Prelude.Just (Key
"BudgetName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
budgetName),
            forall a. a -> Maybe a
Prelude.Just (Key
"ActionId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
actionId)
          ]
      )

instance Data.ToPath UpdateBudgetAction where
  toPath :: UpdateBudgetAction -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery UpdateBudgetAction where
  toQuery :: UpdateBudgetAction -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newUpdateBudgetActionResponse' smart constructor.
data UpdateBudgetActionResponse = UpdateBudgetActionResponse'
  { -- | The response's http status code.
    UpdateBudgetActionResponse -> Int
httpStatus :: Prelude.Int,
    UpdateBudgetActionResponse -> Text
accountId :: Prelude.Text,
    UpdateBudgetActionResponse -> Text
budgetName :: Prelude.Text,
    -- | The previous action resource information.
    UpdateBudgetActionResponse -> Action
oldAction :: Action,
    -- | The updated action resource information.
    UpdateBudgetActionResponse -> Action
newAction' :: Action
  }
  deriving (UpdateBudgetActionResponse -> UpdateBudgetActionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateBudgetActionResponse -> UpdateBudgetActionResponse -> Bool
$c/= :: UpdateBudgetActionResponse -> UpdateBudgetActionResponse -> Bool
== :: UpdateBudgetActionResponse -> UpdateBudgetActionResponse -> Bool
$c== :: UpdateBudgetActionResponse -> UpdateBudgetActionResponse -> Bool
Prelude.Eq, Int -> UpdateBudgetActionResponse -> ShowS
[UpdateBudgetActionResponse] -> ShowS
UpdateBudgetActionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateBudgetActionResponse] -> ShowS
$cshowList :: [UpdateBudgetActionResponse] -> ShowS
show :: UpdateBudgetActionResponse -> String
$cshow :: UpdateBudgetActionResponse -> String
showsPrec :: Int -> UpdateBudgetActionResponse -> ShowS
$cshowsPrec :: Int -> UpdateBudgetActionResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateBudgetActionResponse x -> UpdateBudgetActionResponse
forall x.
UpdateBudgetActionResponse -> Rep UpdateBudgetActionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateBudgetActionResponse x -> UpdateBudgetActionResponse
$cfrom :: forall x.
UpdateBudgetActionResponse -> Rep UpdateBudgetActionResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateBudgetActionResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'httpStatus', 'updateBudgetActionResponse_httpStatus' - The response's http status code.
--
-- 'accountId', 'updateBudgetActionResponse_accountId' - Undocumented member.
--
-- 'budgetName', 'updateBudgetActionResponse_budgetName' - Undocumented member.
--
-- 'oldAction', 'updateBudgetActionResponse_oldAction' - The previous action resource information.
--
-- 'newAction'', 'updateBudgetActionResponse_newAction' - The updated action resource information.
newUpdateBudgetActionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'accountId'
  Prelude.Text ->
  -- | 'budgetName'
  Prelude.Text ->
  -- | 'oldAction'
  Action ->
  -- | 'newAction''
  Action ->
  UpdateBudgetActionResponse
newUpdateBudgetActionResponse :: Int
-> Text -> Text -> Action -> Action -> UpdateBudgetActionResponse
newUpdateBudgetActionResponse
  Int
pHttpStatus_
  Text
pAccountId_
  Text
pBudgetName_
  Action
pOldAction_
  Action
pNewAction_ =
    UpdateBudgetActionResponse'
      { $sel:httpStatus:UpdateBudgetActionResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:accountId:UpdateBudgetActionResponse' :: Text
accountId = Text
pAccountId_,
        $sel:budgetName:UpdateBudgetActionResponse' :: Text
budgetName = Text
pBudgetName_,
        $sel:oldAction:UpdateBudgetActionResponse' :: Action
oldAction = Action
pOldAction_,
        $sel:newAction':UpdateBudgetActionResponse' :: Action
newAction' = Action
pNewAction_
      }

-- | The response's http status code.
updateBudgetActionResponse_httpStatus :: Lens.Lens' UpdateBudgetActionResponse Prelude.Int
updateBudgetActionResponse_httpStatus :: Lens' UpdateBudgetActionResponse Int
updateBudgetActionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBudgetActionResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateBudgetActionResponse' :: UpdateBudgetActionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateBudgetActionResponse
s@UpdateBudgetActionResponse' {} Int
a -> UpdateBudgetActionResponse
s {$sel:httpStatus:UpdateBudgetActionResponse' :: Int
httpStatus = Int
a} :: UpdateBudgetActionResponse)

-- | Undocumented member.
updateBudgetActionResponse_accountId :: Lens.Lens' UpdateBudgetActionResponse Prelude.Text
updateBudgetActionResponse_accountId :: Lens' UpdateBudgetActionResponse Text
updateBudgetActionResponse_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBudgetActionResponse' {Text
accountId :: Text
$sel:accountId:UpdateBudgetActionResponse' :: UpdateBudgetActionResponse -> Text
accountId} -> Text
accountId) (\s :: UpdateBudgetActionResponse
s@UpdateBudgetActionResponse' {} Text
a -> UpdateBudgetActionResponse
s {$sel:accountId:UpdateBudgetActionResponse' :: Text
accountId = Text
a} :: UpdateBudgetActionResponse)

-- | Undocumented member.
updateBudgetActionResponse_budgetName :: Lens.Lens' UpdateBudgetActionResponse Prelude.Text
updateBudgetActionResponse_budgetName :: Lens' UpdateBudgetActionResponse Text
updateBudgetActionResponse_budgetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBudgetActionResponse' {Text
budgetName :: Text
$sel:budgetName:UpdateBudgetActionResponse' :: UpdateBudgetActionResponse -> Text
budgetName} -> Text
budgetName) (\s :: UpdateBudgetActionResponse
s@UpdateBudgetActionResponse' {} Text
a -> UpdateBudgetActionResponse
s {$sel:budgetName:UpdateBudgetActionResponse' :: Text
budgetName = Text
a} :: UpdateBudgetActionResponse)

-- | The previous action resource information.
updateBudgetActionResponse_oldAction :: Lens.Lens' UpdateBudgetActionResponse Action
updateBudgetActionResponse_oldAction :: Lens' UpdateBudgetActionResponse Action
updateBudgetActionResponse_oldAction = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBudgetActionResponse' {Action
oldAction :: Action
$sel:oldAction:UpdateBudgetActionResponse' :: UpdateBudgetActionResponse -> Action
oldAction} -> Action
oldAction) (\s :: UpdateBudgetActionResponse
s@UpdateBudgetActionResponse' {} Action
a -> UpdateBudgetActionResponse
s {$sel:oldAction:UpdateBudgetActionResponse' :: Action
oldAction = Action
a} :: UpdateBudgetActionResponse)

-- | The updated action resource information.
updateBudgetActionResponse_newAction :: Lens.Lens' UpdateBudgetActionResponse Action
updateBudgetActionResponse_newAction :: Lens' UpdateBudgetActionResponse Action
updateBudgetActionResponse_newAction = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBudgetActionResponse' {Action
newAction' :: Action
$sel:newAction':UpdateBudgetActionResponse' :: UpdateBudgetActionResponse -> Action
newAction'} -> Action
newAction') (\s :: UpdateBudgetActionResponse
s@UpdateBudgetActionResponse' {} Action
a -> UpdateBudgetActionResponse
s {$sel:newAction':UpdateBudgetActionResponse' :: Action
newAction' = Action
a} :: UpdateBudgetActionResponse)

instance Prelude.NFData UpdateBudgetActionResponse where
  rnf :: UpdateBudgetActionResponse -> ()
rnf UpdateBudgetActionResponse' {Int
Text
Action
newAction' :: Action
oldAction :: Action
budgetName :: Text
accountId :: Text
httpStatus :: Int
$sel:newAction':UpdateBudgetActionResponse' :: UpdateBudgetActionResponse -> Action
$sel:oldAction:UpdateBudgetActionResponse' :: UpdateBudgetActionResponse -> Action
$sel:budgetName:UpdateBudgetActionResponse' :: UpdateBudgetActionResponse -> Text
$sel:accountId:UpdateBudgetActionResponse' :: UpdateBudgetActionResponse -> Text
$sel:httpStatus:UpdateBudgetActionResponse' :: UpdateBudgetActionResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
budgetName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Action
oldAction
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Action
newAction'