Skip to content

create_subscriber

create_subscriber(
    account_id: AccountId,
    budget_name: BudgetName,
    notification: Notification,
    subscriber: Subscriber,
    *,
    config_overrides: Optional[BudgetsClientConfig] = None,
) -> CreateSubscriberResponse

Creates a subscriber. You must create the associated budget and notification before you create the subscriber.

Parameters:

  • account_id (AccountId) –

    The accountId that is associated with the budget that you want to create a subscriber for.

  • budget_name (BudgetName) –

    The name of the budget that you want to subscribe to. Budget names must be unique within an account.

  • notification (Notification) –

    The notification that you want to create a subscriber for.

  • subscriber (Subscriber) –

    The subscriber that you want to associate with a budget notification.

Raises:

Source code in docs_src/capo_budgets/_services/budgets.py
def create_subscriber(
    self,
    account_id: "capo_budgets.types.account_id.AccountId",
    budget_name: "capo_budgets.types.budget_name.BudgetName",
    notification: "capo_budgets.types.notification.Notification",
    subscriber: "capo_budgets.types.subscriber.Subscriber",
    *,
    config_overrides: Optional[BudgetsClientConfig] = None,
) -> "capo_budgets.types.create_subscriber_response.CreateSubscriberResponse":
    """<p>Creates a subscriber. You must create the associated budget and notification before you create the subscriber.</p>

    Args:
        account_id: <p>The <code>accountId</code> that is associated with the budget that you want to create a subscriber for.</p>
        budget_name: <p>The name of the budget that you want to subscribe to. Budget names must be unique within an account.</p>
        notification: <p>The notification that you want to create a subscriber for.</p>
        subscriber: <p>The subscriber that you want to associate with a budget notification.</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.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_subscriber_request.CreateSubscriberRequest]",
    ) -> OperationResponse[
        "capo_budgets.types.create_subscriber_response.CreateSubscriberResponse"
    ]:
        import capo_budgets._operations.aws_budget_service_gateway.create_subscriber

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

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

        return capo_budgets.types.create_subscriber_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateSubscriber", redact_input=_redact_input),
    )
    input_: capo_budgets.types.create_subscriber_request.CreateSubscriberRequest = {
        "account_id": account_id,
        "budget_name": budget_name,
        "notification": notification,
        "subscriber": subscriber,
    }

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