{-# 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.CreateBudgetAction
-- 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)
--
-- Creates a budget action.
module Amazonka.Budgets.CreateBudgetAction
  ( -- * Creating a Request
    CreateBudgetAction (..),
    newCreateBudgetAction,

    -- * Request Lenses
    createBudgetAction_accountId,
    createBudgetAction_budgetName,
    createBudgetAction_notificationType,
    createBudgetAction_actionType,
    createBudgetAction_actionThreshold,
    createBudgetAction_definition,
    createBudgetAction_executionRoleArn,
    createBudgetAction_approvalModel,
    createBudgetAction_subscribers,

    -- * Destructuring the Response
    CreateBudgetActionResponse (..),
    newCreateBudgetActionResponse,

    -- * Response Lenses
    createBudgetActionResponse_httpStatus,
    createBudgetActionResponse_accountId,
    createBudgetActionResponse_budgetName,
    createBudgetActionResponse_actionId,
  )
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:/ 'newCreateBudgetAction' smart constructor.
data CreateBudgetAction = CreateBudgetAction'
  { CreateBudgetAction -> Text
accountId :: Prelude.Text,
    CreateBudgetAction -> Text
budgetName :: Prelude.Text,
    CreateBudgetAction -> NotificationType
notificationType :: NotificationType,
    -- | The type of action. This defines the type of tasks that can be carried
    -- out by this action. This field also determines the format for
    -- definition.
    CreateBudgetAction -> ActionType
actionType :: ActionType,
    CreateBudgetAction -> ActionThreshold
actionThreshold :: ActionThreshold,
    CreateBudgetAction -> Definition
definition :: Definition,
    -- | The role passed for action execution and reversion. Roles and actions
    -- must be in the same account.
    CreateBudgetAction -> Text
executionRoleArn :: Prelude.Text,
    -- | This specifies if the action needs manual or automatic approval.
    CreateBudgetAction -> ApprovalModel
approvalModel :: ApprovalModel,
    CreateBudgetAction -> NonEmpty Subscriber
subscribers :: Prelude.NonEmpty Subscriber
  }
  deriving (CreateBudgetAction -> CreateBudgetAction -> Bool
(CreateBudgetAction -> CreateBudgetAction -> Bool)
-> (CreateBudgetAction -> CreateBudgetAction -> Bool)
-> Eq CreateBudgetAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBudgetAction -> CreateBudgetAction -> Bool
$c/= :: CreateBudgetAction -> CreateBudgetAction -> Bool
== :: CreateBudgetAction -> CreateBudgetAction -> Bool
$c== :: CreateBudgetAction -> CreateBudgetAction -> Bool
Prelude.Eq, Int -> CreateBudgetAction -> ShowS
[CreateBudgetAction] -> ShowS
CreateBudgetAction -> String
(Int -> CreateBudgetAction -> ShowS)
-> (CreateBudgetAction -> String)
-> ([CreateBudgetAction] -> ShowS)
-> Show CreateBudgetAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBudgetAction] -> ShowS
$cshowList :: [CreateBudgetAction] -> ShowS
show :: CreateBudgetAction -> String
$cshow :: CreateBudgetAction -> String
showsPrec :: Int -> CreateBudgetAction -> ShowS
$cshowsPrec :: Int -> CreateBudgetAction -> ShowS
Prelude.Show, (forall x. CreateBudgetAction -> Rep CreateBudgetAction x)
-> (forall x. Rep CreateBudgetAction x -> CreateBudgetAction)
-> Generic CreateBudgetAction
forall x. Rep CreateBudgetAction x -> CreateBudgetAction
forall x. CreateBudgetAction -> Rep CreateBudgetAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateBudgetAction x -> CreateBudgetAction
$cfrom :: forall x. CreateBudgetAction -> Rep CreateBudgetAction x
Prelude.Generic)

-- |
-- Create a value of 'CreateBudgetAction' 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:
--
-- 'accountId', 'createBudgetAction_accountId' - Undocumented member.
--
-- 'budgetName', 'createBudgetAction_budgetName' - Undocumented member.
--
-- 'notificationType', 'createBudgetAction_notificationType' - Undocumented member.
--
-- 'actionType', 'createBudgetAction_actionType' - The type of action. This defines the type of tasks that can be carried
-- out by this action. This field also determines the format for
-- definition.
--
-- 'actionThreshold', 'createBudgetAction_actionThreshold' - Undocumented member.
--
-- 'definition', 'createBudgetAction_definition' - Undocumented member.
--
-- 'executionRoleArn', 'createBudgetAction_executionRoleArn' - The role passed for action execution and reversion. Roles and actions
-- must be in the same account.
--
-- 'approvalModel', 'createBudgetAction_approvalModel' - This specifies if the action needs manual or automatic approval.
--
-- 'subscribers', 'createBudgetAction_subscribers' - Undocumented member.
newCreateBudgetAction ::
  -- | 'accountId'
  Prelude.Text ->
  -- | 'budgetName'
  Prelude.Text ->
  -- | 'notificationType'
  NotificationType ->
  -- | 'actionType'
  ActionType ->
  -- | 'actionThreshold'
  ActionThreshold ->
  -- | 'definition'
  Definition ->
  -- | 'executionRoleArn'
  Prelude.Text ->
  -- | 'approvalModel'
  ApprovalModel ->
  -- | 'subscribers'
  Prelude.NonEmpty Subscriber ->
  CreateBudgetAction
newCreateBudgetAction :: Text
-> Text
-> NotificationType
-> ActionType
-> ActionThreshold
-> Definition
-> Text
-> ApprovalModel
-> NonEmpty Subscriber
-> CreateBudgetAction
newCreateBudgetAction
  Text
pAccountId_
  Text
pBudgetName_
  NotificationType
pNotificationType_
  ActionType
pActionType_
  ActionThreshold
pActionThreshold_
  Definition
pDefinition_
  Text
pExecutionRoleArn_
  ApprovalModel
pApprovalModel_
  NonEmpty Subscriber
pSubscribers_ =
    CreateBudgetAction' :: Text
-> Text
-> NotificationType
-> ActionType
-> ActionThreshold
-> Definition
-> Text
-> ApprovalModel
-> NonEmpty Subscriber
-> CreateBudgetAction
CreateBudgetAction'
      { $sel:accountId:CreateBudgetAction' :: Text
accountId = Text
pAccountId_,
        $sel:budgetName:CreateBudgetAction' :: Text
budgetName = Text
pBudgetName_,
        $sel:notificationType:CreateBudgetAction' :: NotificationType
notificationType = NotificationType
pNotificationType_,
        $sel:actionType:CreateBudgetAction' :: ActionType
actionType = ActionType
pActionType_,
        $sel:actionThreshold:CreateBudgetAction' :: ActionThreshold
actionThreshold = ActionThreshold
pActionThreshold_,
        $sel:definition:CreateBudgetAction' :: Definition
definition = Definition
pDefinition_,
        $sel:executionRoleArn:CreateBudgetAction' :: Text
executionRoleArn = Text
pExecutionRoleArn_,
        $sel:approvalModel:CreateBudgetAction' :: ApprovalModel
approvalModel = ApprovalModel
pApprovalModel_,
        $sel:subscribers:CreateBudgetAction' :: NonEmpty Subscriber
subscribers = Tagged (NonEmpty Subscriber) (Identity (NonEmpty Subscriber))
-> Tagged (NonEmpty Subscriber) (Identity (NonEmpty Subscriber))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Subscriber) (Identity (NonEmpty Subscriber))
 -> Tagged (NonEmpty Subscriber) (Identity (NonEmpty Subscriber)))
-> NonEmpty Subscriber -> NonEmpty Subscriber
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Subscriber
pSubscribers_
      }

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

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

-- | Undocumented member.
createBudgetAction_notificationType :: Lens.Lens' CreateBudgetAction NotificationType
createBudgetAction_notificationType :: (NotificationType -> f NotificationType)
-> CreateBudgetAction -> f CreateBudgetAction
createBudgetAction_notificationType = (CreateBudgetAction -> NotificationType)
-> (CreateBudgetAction -> NotificationType -> CreateBudgetAction)
-> Lens
     CreateBudgetAction
     CreateBudgetAction
     NotificationType
     NotificationType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBudgetAction' {NotificationType
notificationType :: NotificationType
$sel:notificationType:CreateBudgetAction' :: CreateBudgetAction -> NotificationType
notificationType} -> NotificationType
notificationType) (\s :: CreateBudgetAction
s@CreateBudgetAction' {} NotificationType
a -> CreateBudgetAction
s {$sel:notificationType:CreateBudgetAction' :: NotificationType
notificationType = NotificationType
a} :: CreateBudgetAction)

-- | The type of action. This defines the type of tasks that can be carried
-- out by this action. This field also determines the format for
-- definition.
createBudgetAction_actionType :: Lens.Lens' CreateBudgetAction ActionType
createBudgetAction_actionType :: (ActionType -> f ActionType)
-> CreateBudgetAction -> f CreateBudgetAction
createBudgetAction_actionType = (CreateBudgetAction -> ActionType)
-> (CreateBudgetAction -> ActionType -> CreateBudgetAction)
-> Lens CreateBudgetAction CreateBudgetAction ActionType ActionType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBudgetAction' {ActionType
actionType :: ActionType
$sel:actionType:CreateBudgetAction' :: CreateBudgetAction -> ActionType
actionType} -> ActionType
actionType) (\s :: CreateBudgetAction
s@CreateBudgetAction' {} ActionType
a -> CreateBudgetAction
s {$sel:actionType:CreateBudgetAction' :: ActionType
actionType = ActionType
a} :: CreateBudgetAction)

-- | Undocumented member.
createBudgetAction_actionThreshold :: Lens.Lens' CreateBudgetAction ActionThreshold
createBudgetAction_actionThreshold :: (ActionThreshold -> f ActionThreshold)
-> CreateBudgetAction -> f CreateBudgetAction
createBudgetAction_actionThreshold = (CreateBudgetAction -> ActionThreshold)
-> (CreateBudgetAction -> ActionThreshold -> CreateBudgetAction)
-> Lens
     CreateBudgetAction
     CreateBudgetAction
     ActionThreshold
     ActionThreshold
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBudgetAction' {ActionThreshold
actionThreshold :: ActionThreshold
$sel:actionThreshold:CreateBudgetAction' :: CreateBudgetAction -> ActionThreshold
actionThreshold} -> ActionThreshold
actionThreshold) (\s :: CreateBudgetAction
s@CreateBudgetAction' {} ActionThreshold
a -> CreateBudgetAction
s {$sel:actionThreshold:CreateBudgetAction' :: ActionThreshold
actionThreshold = ActionThreshold
a} :: CreateBudgetAction)

-- | Undocumented member.
createBudgetAction_definition :: Lens.Lens' CreateBudgetAction Definition
createBudgetAction_definition :: (Definition -> f Definition)
-> CreateBudgetAction -> f CreateBudgetAction
createBudgetAction_definition = (CreateBudgetAction -> Definition)
-> (CreateBudgetAction -> Definition -> CreateBudgetAction)
-> Lens CreateBudgetAction CreateBudgetAction Definition Definition
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBudgetAction' {Definition
definition :: Definition
$sel:definition:CreateBudgetAction' :: CreateBudgetAction -> Definition
definition} -> Definition
definition) (\s :: CreateBudgetAction
s@CreateBudgetAction' {} Definition
a -> CreateBudgetAction
s {$sel:definition:CreateBudgetAction' :: Definition
definition = Definition
a} :: CreateBudgetAction)

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

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

-- | Undocumented member.
createBudgetAction_subscribers :: Lens.Lens' CreateBudgetAction (Prelude.NonEmpty Subscriber)
createBudgetAction_subscribers :: (NonEmpty Subscriber -> f (NonEmpty Subscriber))
-> CreateBudgetAction -> f CreateBudgetAction
createBudgetAction_subscribers = (CreateBudgetAction -> NonEmpty Subscriber)
-> (CreateBudgetAction
    -> NonEmpty Subscriber -> CreateBudgetAction)
-> Lens
     CreateBudgetAction
     CreateBudgetAction
     (NonEmpty Subscriber)
     (NonEmpty Subscriber)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBudgetAction' {NonEmpty Subscriber
subscribers :: NonEmpty Subscriber
$sel:subscribers:CreateBudgetAction' :: CreateBudgetAction -> NonEmpty Subscriber
subscribers} -> NonEmpty Subscriber
subscribers) (\s :: CreateBudgetAction
s@CreateBudgetAction' {} NonEmpty Subscriber
a -> CreateBudgetAction
s {$sel:subscribers:CreateBudgetAction' :: NonEmpty Subscriber
subscribers = NonEmpty Subscriber
a} :: CreateBudgetAction) ((NonEmpty Subscriber -> f (NonEmpty Subscriber))
 -> CreateBudgetAction -> f CreateBudgetAction)
-> ((NonEmpty Subscriber -> f (NonEmpty Subscriber))
    -> NonEmpty Subscriber -> f (NonEmpty Subscriber))
-> (NonEmpty Subscriber -> f (NonEmpty Subscriber))
-> CreateBudgetAction
-> f CreateBudgetAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Subscriber -> f (NonEmpty Subscriber))
-> NonEmpty Subscriber -> f (NonEmpty Subscriber)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest CreateBudgetAction where
  type
    AWSResponse CreateBudgetAction =
      CreateBudgetActionResponse
  request :: CreateBudgetAction -> Request CreateBudgetAction
request = Service -> CreateBudgetAction -> Request CreateBudgetAction
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateBudgetAction
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateBudgetAction)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateBudgetAction))
-> Logger
-> Service
-> Proxy CreateBudgetAction
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateBudgetAction)))
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 -> Text -> CreateBudgetActionResponse
CreateBudgetActionResponse'
            (Int -> Text -> Text -> Text -> CreateBudgetActionResponse)
-> Either String Int
-> Either
     String (Text -> Text -> Text -> CreateBudgetActionResponse)
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 -> Text -> CreateBudgetActionResponse)
-> Either String Text
-> Either String (Text -> Text -> CreateBudgetActionResponse)
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 -> Text -> CreateBudgetActionResponse)
-> Either String Text
-> Either String (Text -> CreateBudgetActionResponse)
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 (Text -> CreateBudgetActionResponse)
-> Either String Text -> Either String CreateBudgetActionResponse
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
"ActionId")
      )

instance Prelude.Hashable CreateBudgetAction

instance Prelude.NFData CreateBudgetAction

instance Core.ToHeaders CreateBudgetAction where
  toHeaders :: CreateBudgetAction -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateBudgetAction -> 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.CreateBudgetAction" ::
                          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 CreateBudgetAction where
  toJSON :: CreateBudgetAction -> Value
toJSON CreateBudgetAction' {NonEmpty Subscriber
Text
ActionType
ApprovalModel
NotificationType
Definition
ActionThreshold
subscribers :: NonEmpty Subscriber
approvalModel :: ApprovalModel
executionRoleArn :: Text
definition :: Definition
actionThreshold :: ActionThreshold
actionType :: ActionType
notificationType :: NotificationType
budgetName :: Text
accountId :: Text
$sel:subscribers:CreateBudgetAction' :: CreateBudgetAction -> NonEmpty Subscriber
$sel:approvalModel:CreateBudgetAction' :: CreateBudgetAction -> ApprovalModel
$sel:executionRoleArn:CreateBudgetAction' :: CreateBudgetAction -> Text
$sel:definition:CreateBudgetAction' :: CreateBudgetAction -> Definition
$sel:actionThreshold:CreateBudgetAction' :: CreateBudgetAction -> ActionThreshold
$sel:actionType:CreateBudgetAction' :: CreateBudgetAction -> ActionType
$sel:notificationType:CreateBudgetAction' :: CreateBudgetAction -> NotificationType
$sel:budgetName:CreateBudgetAction' :: CreateBudgetAction -> Text
$sel:accountId:CreateBudgetAction' :: CreateBudgetAction -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ 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
"NotificationType" Text -> NotificationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NotificationType
notificationType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ActionType" Text -> ActionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ActionType
actionType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ActionThreshold" Text -> ActionThreshold -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ActionThreshold
actionThreshold),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Definition" Text -> Definition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Definition
definition),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ExecutionRoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
executionRoleArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ApprovalModel" Text -> ApprovalModel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ApprovalModel
approvalModel),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Subscribers" Text -> NonEmpty Subscriber -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Subscriber
subscribers)
          ]
      )

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

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

-- | /See:/ 'newCreateBudgetActionResponse' smart constructor.
data CreateBudgetActionResponse = CreateBudgetActionResponse'
  { -- | The response's http status code.
    CreateBudgetActionResponse -> Int
httpStatus :: Prelude.Int,
    CreateBudgetActionResponse -> Text
accountId :: Prelude.Text,
    CreateBudgetActionResponse -> Text
budgetName :: Prelude.Text,
    -- | A system-generated universally unique identifier (UUID) for the action.
    CreateBudgetActionResponse -> Text
actionId :: Prelude.Text
  }
  deriving (CreateBudgetActionResponse -> CreateBudgetActionResponse -> Bool
(CreateBudgetActionResponse -> CreateBudgetActionResponse -> Bool)
-> (CreateBudgetActionResponse
    -> CreateBudgetActionResponse -> Bool)
-> Eq CreateBudgetActionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBudgetActionResponse -> CreateBudgetActionResponse -> Bool
$c/= :: CreateBudgetActionResponse -> CreateBudgetActionResponse -> Bool
== :: CreateBudgetActionResponse -> CreateBudgetActionResponse -> Bool
$c== :: CreateBudgetActionResponse -> CreateBudgetActionResponse -> Bool
Prelude.Eq, ReadPrec [CreateBudgetActionResponse]
ReadPrec CreateBudgetActionResponse
Int -> ReadS CreateBudgetActionResponse
ReadS [CreateBudgetActionResponse]
(Int -> ReadS CreateBudgetActionResponse)
-> ReadS [CreateBudgetActionResponse]
-> ReadPrec CreateBudgetActionResponse
-> ReadPrec [CreateBudgetActionResponse]
-> Read CreateBudgetActionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBudgetActionResponse]
$creadListPrec :: ReadPrec [CreateBudgetActionResponse]
readPrec :: ReadPrec CreateBudgetActionResponse
$creadPrec :: ReadPrec CreateBudgetActionResponse
readList :: ReadS [CreateBudgetActionResponse]
$creadList :: ReadS [CreateBudgetActionResponse]
readsPrec :: Int -> ReadS CreateBudgetActionResponse
$creadsPrec :: Int -> ReadS CreateBudgetActionResponse
Prelude.Read, Int -> CreateBudgetActionResponse -> ShowS
[CreateBudgetActionResponse] -> ShowS
CreateBudgetActionResponse -> String
(Int -> CreateBudgetActionResponse -> ShowS)
-> (CreateBudgetActionResponse -> String)
-> ([CreateBudgetActionResponse] -> ShowS)
-> Show CreateBudgetActionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBudgetActionResponse] -> ShowS
$cshowList :: [CreateBudgetActionResponse] -> ShowS
show :: CreateBudgetActionResponse -> String
$cshow :: CreateBudgetActionResponse -> String
showsPrec :: Int -> CreateBudgetActionResponse -> ShowS
$cshowsPrec :: Int -> CreateBudgetActionResponse -> ShowS
Prelude.Show, (forall x.
 CreateBudgetActionResponse -> Rep CreateBudgetActionResponse x)
-> (forall x.
    Rep CreateBudgetActionResponse x -> CreateBudgetActionResponse)
-> Generic CreateBudgetActionResponse
forall x.
Rep CreateBudgetActionResponse x -> CreateBudgetActionResponse
forall x.
CreateBudgetActionResponse -> Rep CreateBudgetActionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateBudgetActionResponse x -> CreateBudgetActionResponse
$cfrom :: forall x.
CreateBudgetActionResponse -> Rep CreateBudgetActionResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateBudgetActionResponse' 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', 'createBudgetActionResponse_httpStatus' - The response's http status code.
--
-- 'accountId', 'createBudgetActionResponse_accountId' - Undocumented member.
--
-- 'budgetName', 'createBudgetActionResponse_budgetName' - Undocumented member.
--
-- 'actionId', 'createBudgetActionResponse_actionId' - A system-generated universally unique identifier (UUID) for the action.
newCreateBudgetActionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'accountId'
  Prelude.Text ->
  -- | 'budgetName'
  Prelude.Text ->
  -- | 'actionId'
  Prelude.Text ->
  CreateBudgetActionResponse
newCreateBudgetActionResponse :: Int -> Text -> Text -> Text -> CreateBudgetActionResponse
newCreateBudgetActionResponse
  Int
pHttpStatus_
  Text
pAccountId_
  Text
pBudgetName_
  Text
pActionId_ =
    CreateBudgetActionResponse' :: Int -> Text -> Text -> Text -> CreateBudgetActionResponse
CreateBudgetActionResponse'
      { $sel:httpStatus:CreateBudgetActionResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:accountId:CreateBudgetActionResponse' :: Text
accountId = Text
pAccountId_,
        $sel:budgetName:CreateBudgetActionResponse' :: Text
budgetName = Text
pBudgetName_,
        $sel:actionId:CreateBudgetActionResponse' :: Text
actionId = Text
pActionId_
      }

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

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

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

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

instance Prelude.NFData CreateBudgetActionResponse