{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates a budget action.
module Amazonka.Budgets.UpdateBudgetAction
  ( -- * Creating a Request
    UpdateBudgetAction (..),
    newUpdateBudgetAction,

    -- * Request Lenses
    updateBudgetAction_definition,
    updateBudgetAction_executionRoleArn,
    updateBudgetAction_actionThreshold,
    updateBudgetAction_notificationType,
    updateBudgetAction_approvalModel,
    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.Lens as Lens
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 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 ActionThreshold
actionThreshold :: Prelude.Maybe ActionThreshold,
    UpdateBudgetAction -> Maybe NotificationType
notificationType :: Prelude.Maybe NotificationType,
    -- | This specifies if the action needs manual or automatic approval.
    UpdateBudgetAction -> Maybe ApprovalModel
approvalModel :: Prelude.Maybe ApprovalModel,
    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
(UpdateBudgetAction -> UpdateBudgetAction -> Bool)
-> (UpdateBudgetAction -> UpdateBudgetAction -> Bool)
-> Eq UpdateBudgetAction
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
(Int -> UpdateBudgetAction -> ShowS)
-> (UpdateBudgetAction -> String)
-> ([UpdateBudgetAction] -> ShowS)
-> Show UpdateBudgetAction
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. UpdateBudgetAction -> Rep UpdateBudgetAction x)
-> (forall x. Rep UpdateBudgetAction x -> UpdateBudgetAction)
-> Generic UpdateBudgetAction
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:
--
-- '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.
--
-- 'actionThreshold', 'updateBudgetAction_actionThreshold' - Undocumented member.
--
-- 'notificationType', 'updateBudgetAction_notificationType' - Undocumented member.
--
-- 'approvalModel', 'updateBudgetAction_approvalModel' - This specifies if the action needs manual or automatic approval.
--
-- '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' :: Maybe Definition
-> Maybe Text
-> Maybe ActionThreshold
-> Maybe NotificationType
-> Maybe ApprovalModel
-> Maybe (NonEmpty Subscriber)
-> Text
-> Text
-> Text
-> UpdateBudgetAction
UpdateBudgetAction'
      { $sel:definition:UpdateBudgetAction' :: Maybe Definition
definition = Maybe Definition
forall a. Maybe a
Prelude.Nothing,
        $sel:executionRoleArn:UpdateBudgetAction' :: Maybe Text
executionRoleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:actionThreshold:UpdateBudgetAction' :: Maybe ActionThreshold
actionThreshold = Maybe ActionThreshold
forall a. Maybe a
Prelude.Nothing,
        $sel:notificationType:UpdateBudgetAction' :: Maybe NotificationType
notificationType = Maybe NotificationType
forall a. Maybe a
Prelude.Nothing,
        $sel:approvalModel:UpdateBudgetAction' :: Maybe ApprovalModel
approvalModel = Maybe ApprovalModel
forall a. Maybe a
Prelude.Nothing,
        $sel:subscribers:UpdateBudgetAction' :: Maybe (NonEmpty Subscriber)
subscribers = Maybe (NonEmpty Subscriber)
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_definition :: Lens.Lens' UpdateBudgetAction (Prelude.Maybe Definition)
updateBudgetAction_definition :: (Maybe Definition -> f (Maybe Definition))
-> UpdateBudgetAction -> f UpdateBudgetAction
updateBudgetAction_definition = (UpdateBudgetAction -> Maybe Definition)
-> (UpdateBudgetAction -> Maybe Definition -> UpdateBudgetAction)
-> Lens
     UpdateBudgetAction
     UpdateBudgetAction
     (Maybe Definition)
     (Maybe 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 :: (Maybe Text -> f (Maybe Text))
-> UpdateBudgetAction -> f UpdateBudgetAction
updateBudgetAction_executionRoleArn = (UpdateBudgetAction -> Maybe Text)
-> (UpdateBudgetAction -> Maybe Text -> UpdateBudgetAction)
-> Lens
     UpdateBudgetAction UpdateBudgetAction (Maybe Text) (Maybe Text)
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_actionThreshold :: Lens.Lens' UpdateBudgetAction (Prelude.Maybe ActionThreshold)
updateBudgetAction_actionThreshold :: (Maybe ActionThreshold -> f (Maybe ActionThreshold))
-> UpdateBudgetAction -> f UpdateBudgetAction
updateBudgetAction_actionThreshold = (UpdateBudgetAction -> Maybe ActionThreshold)
-> (UpdateBudgetAction
    -> Maybe ActionThreshold -> UpdateBudgetAction)
-> Lens
     UpdateBudgetAction
     UpdateBudgetAction
     (Maybe ActionThreshold)
     (Maybe 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)

-- | Undocumented member.
updateBudgetAction_notificationType :: Lens.Lens' UpdateBudgetAction (Prelude.Maybe NotificationType)
updateBudgetAction_notificationType :: (Maybe NotificationType -> f (Maybe NotificationType))
-> UpdateBudgetAction -> f UpdateBudgetAction
updateBudgetAction_notificationType = (UpdateBudgetAction -> Maybe NotificationType)
-> (UpdateBudgetAction
    -> Maybe NotificationType -> UpdateBudgetAction)
-> Lens
     UpdateBudgetAction
     UpdateBudgetAction
     (Maybe NotificationType)
     (Maybe 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)

-- | This specifies if the action needs manual or automatic approval.
updateBudgetAction_approvalModel :: Lens.Lens' UpdateBudgetAction (Prelude.Maybe ApprovalModel)
updateBudgetAction_approvalModel :: (Maybe ApprovalModel -> f (Maybe ApprovalModel))
-> UpdateBudgetAction -> f UpdateBudgetAction
updateBudgetAction_approvalModel = (UpdateBudgetAction -> Maybe ApprovalModel)
-> (UpdateBudgetAction
    -> Maybe ApprovalModel -> UpdateBudgetAction)
-> Lens
     UpdateBudgetAction
     UpdateBudgetAction
     (Maybe ApprovalModel)
     (Maybe 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_subscribers :: Lens.Lens' UpdateBudgetAction (Prelude.Maybe (Prelude.NonEmpty Subscriber))
updateBudgetAction_subscribers :: (Maybe (NonEmpty Subscriber) -> f (Maybe (NonEmpty Subscriber)))
-> UpdateBudgetAction -> f UpdateBudgetAction
updateBudgetAction_subscribers = (UpdateBudgetAction -> Maybe (NonEmpty Subscriber))
-> (UpdateBudgetAction
    -> Maybe (NonEmpty Subscriber) -> UpdateBudgetAction)
-> Lens
     UpdateBudgetAction
     UpdateBudgetAction
     (Maybe (NonEmpty Subscriber))
     (Maybe (NonEmpty Subscriber))
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) ((Maybe (NonEmpty Subscriber) -> f (Maybe (NonEmpty Subscriber)))
 -> UpdateBudgetAction -> f UpdateBudgetAction)
-> ((Maybe (NonEmpty Subscriber)
     -> f (Maybe (NonEmpty Subscriber)))
    -> Maybe (NonEmpty Subscriber) -> f (Maybe (NonEmpty Subscriber)))
-> (Maybe (NonEmpty Subscriber) -> f (Maybe (NonEmpty Subscriber)))
-> UpdateBudgetAction
-> f UpdateBudgetAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Subscriber)
  (NonEmpty Subscriber)
  (NonEmpty Subscriber)
  (NonEmpty Subscriber)
-> Iso
     (Maybe (NonEmpty Subscriber))
     (Maybe (NonEmpty Subscriber))
     (Maybe (NonEmpty Subscriber))
     (Maybe (NonEmpty Subscriber))
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
  (NonEmpty Subscriber)
  (NonEmpty Subscriber)
  (NonEmpty Subscriber)
  (NonEmpty Subscriber)
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 :: (Text -> f Text) -> UpdateBudgetAction -> f UpdateBudgetAction
updateBudgetAction_accountId = (UpdateBudgetAction -> Text)
-> (UpdateBudgetAction -> Text -> UpdateBudgetAction)
-> Lens UpdateBudgetAction UpdateBudgetAction Text Text
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 :: (Text -> f Text) -> UpdateBudgetAction -> f UpdateBudgetAction
updateBudgetAction_budgetName = (UpdateBudgetAction -> Text)
-> (UpdateBudgetAction -> Text -> UpdateBudgetAction)
-> Lens UpdateBudgetAction UpdateBudgetAction Text Text
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 :: (Text -> f Text) -> UpdateBudgetAction -> f UpdateBudgetAction
updateBudgetAction_actionId = (UpdateBudgetAction -> Text)
-> (UpdateBudgetAction -> Text -> UpdateBudgetAction)
-> Lens UpdateBudgetAction UpdateBudgetAction Text Text
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 :: UpdateBudgetAction -> Request UpdateBudgetAction
request = Service -> UpdateBudgetAction -> Request UpdateBudgetAction
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateBudgetAction
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateBudgetAction)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateBudgetAction))
-> Logger
-> Service
-> Proxy UpdateBudgetAction
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateBudgetAction)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> 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'
            (Int
 -> Text -> Text -> Action -> Action -> UpdateBudgetActionResponse)
-> Either String Int
-> Either
     String
     (Text -> Text -> Action -> Action -> UpdateBudgetActionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either
  String
  (Text -> Text -> Action -> Action -> UpdateBudgetActionResponse)
-> Either String Text
-> Either
     String (Text -> Action -> Action -> UpdateBudgetActionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"AccountId")
            Either
  String (Text -> Action -> Action -> UpdateBudgetActionResponse)
-> Either String Text
-> Either String (Action -> Action -> UpdateBudgetActionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"BudgetName")
            Either String (Action -> Action -> UpdateBudgetActionResponse)
-> Either String Action
-> Either String (Action -> UpdateBudgetActionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Action
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"OldAction")
            Either String (Action -> UpdateBudgetActionResponse)
-> Either String Action -> Either String UpdateBudgetActionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Action
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"NewAction")
      )

instance Prelude.Hashable UpdateBudgetAction

instance Prelude.NFData UpdateBudgetAction

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

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

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

instance Core.ToQuery UpdateBudgetAction where
  toQuery :: UpdateBudgetAction -> QueryString
toQuery = QueryString -> UpdateBudgetAction -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(UpdateBudgetActionResponse -> UpdateBudgetActionResponse -> Bool)
-> (UpdateBudgetActionResponse
    -> UpdateBudgetActionResponse -> Bool)
-> Eq UpdateBudgetActionResponse
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
(Int -> UpdateBudgetActionResponse -> ShowS)
-> (UpdateBudgetActionResponse -> String)
-> ([UpdateBudgetActionResponse] -> ShowS)
-> Show UpdateBudgetActionResponse
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.
 UpdateBudgetActionResponse -> Rep UpdateBudgetActionResponse x)
-> (forall x.
    Rep UpdateBudgetActionResponse x -> UpdateBudgetActionResponse)
-> Generic UpdateBudgetActionResponse
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' :: Int
-> Text -> Text -> Action -> Action -> UpdateBudgetActionResponse
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 :: (Int -> f Int)
-> UpdateBudgetActionResponse -> f UpdateBudgetActionResponse
updateBudgetActionResponse_httpStatus = (UpdateBudgetActionResponse -> Int)
-> (UpdateBudgetActionResponse
    -> Int -> UpdateBudgetActionResponse)
-> Lens
     UpdateBudgetActionResponse UpdateBudgetActionResponse Int Int
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 :: (Text -> f Text)
-> UpdateBudgetActionResponse -> f UpdateBudgetActionResponse
updateBudgetActionResponse_accountId = (UpdateBudgetActionResponse -> Text)
-> (UpdateBudgetActionResponse
    -> Text -> UpdateBudgetActionResponse)
-> Lens
     UpdateBudgetActionResponse UpdateBudgetActionResponse Text Text
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 :: (Text -> f Text)
-> UpdateBudgetActionResponse -> f UpdateBudgetActionResponse
updateBudgetActionResponse_budgetName = (UpdateBudgetActionResponse -> Text)
-> (UpdateBudgetActionResponse
    -> Text -> UpdateBudgetActionResponse)
-> Lens
     UpdateBudgetActionResponse UpdateBudgetActionResponse Text Text
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 :: (Action -> f Action)
-> UpdateBudgetActionResponse -> f UpdateBudgetActionResponse
updateBudgetActionResponse_oldAction = (UpdateBudgetActionResponse -> Action)
-> (UpdateBudgetActionResponse
    -> Action -> UpdateBudgetActionResponse)
-> Lens
     UpdateBudgetActionResponse UpdateBudgetActionResponse Action Action
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 :: (Action -> f Action)
-> UpdateBudgetActionResponse -> f UpdateBudgetActionResponse
updateBudgetActionResponse_newAction = (UpdateBudgetActionResponse -> Action)
-> (UpdateBudgetActionResponse
    -> Action -> UpdateBudgetActionResponse)
-> Lens
     UpdateBudgetActionResponse UpdateBudgetActionResponse Action Action
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