Skip to content

create_budget_action

create_budget_action(
    account_id: AccountId,
    budget_name: BudgetName,
    notification_type: NotificationType,
    action_type: ActionType,
    action_threshold: ActionThreshold,
    definition: Definition,
    execution_role_arn: RoleArn,
    approval_model: ApprovalModel,
    subscribers: Subscribers,
    *,
    config_overrides: Optional[BudgetsClientConfig] = None,
    resource_tags: Optional[ResourceTagList] = None,
) -> CreateBudgetActionResponse

Creates a budget action.

Parameters:

  • action_type (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.

  • execution_role_arn (RoleArn) –

    The role passed for action execution and reversion. Roles and actions must be in the same account.

  • approval_model (ApprovalModel) –

    This specifies if the action needs manual or automatic approval.

  • resource_tags (Optional[ResourceTagList], default: None ) –

    An optional list of tags to associate with the specified budget action. Each tag consists of a key and a value, and each key must be unique for the resource.

Raises:

Source code in docs_src/capo_budgets/_services/budgets.py
def create_budget_action(
    self,
    account_id: "capo_budgets.types.account_id.AccountId",
    budget_name: "capo_budgets.types.budget_name.BudgetName",
    notification_type: "capo_budgets.types.notification_type.NotificationType",
    action_type: "capo_budgets.types.action_type.ActionType",
    action_threshold: "capo_budgets.types.action_threshold.ActionThreshold",
    definition: "capo_budgets.types.definition.Definition",
    execution_role_arn: "capo_budgets.types.role_arn.RoleArn",
    approval_model: "capo_budgets.types.approval_model.ApprovalModel",
    subscribers: "capo_budgets.types.subscribers.Subscribers",
    *,
    config_overrides: Optional[BudgetsClientConfig] = None,
    resource_tags: Optional[
        "capo_budgets.types.resource_tag_list.ResourceTagList"
    ] = None,
) -> "capo_budgets.types.create_budget_action_response.CreateBudgetActionResponse":
    """<p> Creates a budget action. </p>

    Args:
        action_type: <p> 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. </p>
        execution_role_arn: <p> The role passed for action execution and reversion. Roles and actions must be in the same account. </p>
        approval_model: <p> This specifies if the action needs manual or automatic approval. </p>
        resource_tags: <p>An optional list of tags to associate with the specified budget action. Each tag consists of a key and a value, and each key must be unique for the resource.</p>

    Raises:
        capo_budgets.errors.access_denied_exception.AccessDeniedException: <p>You are not authorized to use this operation with the given parameters.</p>
        capo_budgets.errors.creation_limit_exceeded_exception.CreationLimitExceededException: <p>You've exceeded the notification or subscriber limit.</p>
        capo_budgets.errors.duplicate_record_exception.DuplicateRecordException: <p>The budget name already exists. Budget names must be unique within an account.</p>
        capo_budgets.errors.internal_error_exception.InternalErrorException: <p>An error on the server occurred during the processing of your request. Try again later.</p>
        capo_budgets.errors.invalid_parameter_exception.InvalidParameterException: <p>An error on the client occurred. Typically, the cause is an invalid input value.</p>
        capo_budgets.errors.not_found_exception.NotFoundException: <p>We can’t locate the resource that you specified.</p>
        capo_budgets.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You've reached a Service Quota limit on this resource.</p>
        capo_budgets.errors.throttling_exception.ThrottlingException: <p>The number of API requests has exceeded the maximum allowed API request throttling limit for the account.</p>
        capo_budgets.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_budgets.types.create_budget_action_request.CreateBudgetActionRequest]",
    ) -> OperationResponse[
        "capo_budgets.types.create_budget_action_response.CreateBudgetActionResponse"
    ]:
        import capo_budgets._operations.aws_budget_service_gateway.create_budget_action

        output, http_response = (
            capo_budgets._operations.aws_budget_service_gateway.create_budget_action.create_budget_action(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_budgets.types.create_budget_action_request.CreateBudgetActionRequest",
    ) -> dict[str, Any]:
        import capo_budgets.types.create_budget_action_request

        return capo_budgets.types.create_budget_action_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateBudgetAction", redact_input=_redact_input),
    )
    input_: capo_budgets.types.create_budget_action_request.CreateBudgetActionRequest = {
        "account_id": account_id,
        "budget_name": budget_name,
        "notification_type": notification_type,
        "action_type": action_type,
        "action_threshold": action_threshold,
        "definition": definition,
        "execution_role_arn": execution_role_arn,
        "approval_model": approval_model,
        "subscribers": subscribers,
    }
    if resource_tags is not None:
        input_["resource_tags"] = resource_tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output