Skip to content

split_credit

split_credit(
    credit_id: CreditId,
    portions: SplitPortions,
    *,
    config_overrides: Optional[BillingClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    dry_run: Optional[bool] = None,
) -> SplitCreditResponse

Splits the available balance of a credit into 2 to 99 new credits in the same account, and cancels the original credit. The new credits keep the original credit's end date and applicable products.

The available balance is the remaining balance minus any amount reserved for a bill that isn't finalized. The portions must add up to exactly the available balance. Each portion must be at least 100.00 in the currency of the credit. For example, if the credit is in USD, each portion must be at least USD $100.00. A reserved amount stays on the original credit and still applies to that bill.

A credit and every credit split from it count toward a limit of 100 credits. After a split, you can't split or transfer the original credit. You can split or transfer its new credits, and you can split a credit after you transfer it.

You must own the credit or be the payer of the account that owns it. You can't undo a split. This operation is idempotent and supports a dry run.

Parameters:

  • credit_id (CreditId) –

    The ID of the credit to split.

  • portions (SplitPortions) –

    The new credits to create, one for each portion, in the order listed.

  • client_token (Optional[ClientToken], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure that the operation completes no more than one time. If you retry a successful request with the same client token and parameters, the retry completes without performing any further actions. If you reuse a client token with different parameters, the request fails with a ValidationException.

  • dry_run (Optional[bool], default: None ) –

    Specifies whether to validate the request and return the result without changing any credit.

Raises:

  • AccessDeniedException –

    You don't have sufficient access to perform this action.

  • ConflictException –

    The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request.

  • InternalServerException –

    The request processing failed because of an unknown error, exception, or failure.

  • ResourceNotFoundException –

    The specified ARN in the request doesn't exist.

  • ServiceQuotaExceededException –

    You've reached the limit of resources you can create, or exceeded the size of an individual resource.

  • ThrottlingException –

    The request was denied due to request throttling.

  • ValidationException –

    The input fails to satisfy the constraints specified by an Amazon Web Services service.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_billing/_services/billing.py
def split_credit(
    self,
    credit_id: "capo_billing.types.credit_id.CreditId",
    portions: "capo_billing.types.split_portions.SplitPortions",
    *,
    config_overrides: Optional[BillingClientConfig] = None,
    client_token: Optional["capo_billing.types.client_token.ClientToken"] = None,
    dry_run: Optional[bool] = None,
) -> "capo_billing.types.split_credit_response.SplitCreditResponse":
    """<p>Splits the available balance of a credit into 2 to 99 new credits in the same account, and cancels the original credit. The new credits keep the original credit's end date and applicable products.</p> <p>The available balance is the remaining balance minus any amount reserved for a bill that isn't finalized. The portions must add up to exactly the available balance. Each portion must be at least 100.00 in the currency of the credit. For example, if the credit is in USD, each portion must be at least USD $100.00. A reserved amount stays on the original credit and still applies to that bill.</p> <p>A credit and every credit split from it count toward a limit of 100 credits. After a split, you can't split or transfer the original credit. You can split or transfer its new credits, and you can split a credit after you transfer it.</p> <p>You must own the credit or be the payer of the account that owns it. You can't undo a split. This operation is idempotent and supports a dry run.</p>

    Args:
        credit_id: <p>The ID of the credit to split.</p>
        portions: <p>The new credits to create, one for each portion, in the order listed.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure that the operation completes no more than one time. If you retry a successful request with the same client token and parameters, the retry completes without performing any further actions. If you reuse a client token with different parameters, the request fails with a <code>ValidationException</code>.</p>
        dry_run: <p>Specifies whether to validate the request and return the result without changing any credit.</p>

    Raises:
        capo_billing.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this action.</p>
        capo_billing.errors.conflict_exception.ConflictException: <p> The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. </p>
        capo_billing.errors.internal_server_exception.InternalServerException: <p>The request processing failed because of an unknown error, exception, or failure. </p>
        capo_billing.errors.resource_not_found_exception.ResourceNotFoundException: <p> The specified ARN in the request doesn't exist. </p>
        capo_billing.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p> You've reached the limit of resources you can create, or exceeded the size of an individual resource. </p>
        capo_billing.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. </p>
        capo_billing.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service. </p>
        capo_billing.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_billing.types.split_credit_request.SplitCreditRequest]",
    ) -> OperationResponse[
        "capo_billing.types.split_credit_response.SplitCreditResponse"
    ]:
        import capo_billing._operations.aws_billing.split_credit

        output, http_response = (
            capo_billing._operations.aws_billing.split_credit.split_credit(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SplitCredit")
    )
    input_: capo_billing.types.split_credit_request.SplitCreditRequest = {
        "credit_id": credit_id,
        "portions": portions,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if dry_run is not None:
        input_["dry_run"] = dry_run

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