Skip to content

create_custom_line_item

create_custom_line_item(
    name: CustomLineItemName,
    description: CustomLineItemDescription,
    billing_group_arn: BillingGroupArn,
    charge_details: CustomLineItemChargeDetails,
    *,
    config_overrides: Optional[billingconductorClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    billing_period_range: Optional[CustomLineItemBillingPeriodRange] = None,
    tags: Optional[TagMap] = None,
    account_id: Optional[AccountId] = None,
    computation_rule: Optional[ComputationRuleEnum] = None,
    presentation_details: Optional[PresentationObject] = None,
) -> CreateCustomLineItemOutput

Creates a custom line item that can be used to create a one-time fixed charge that can be applied to a single billing group for the current or previous billing period. The one-time fixed charge is either a fee or discount.

Parameters:

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

    A unique, case-sensitive identifier that you specify to ensure idempotency of the request. Idempotency ensures that an API request completes no more than one time. With an idempotent request, if the original request completes successfully, any subsequent retries complete successfully without performing any further actions.

  • name (CustomLineItemName) –

    The name of the custom line item.

  • description (CustomLineItemDescription) –

    The description of the custom line item. This is shown on the Bills page in association with the charge value.

  • billing_group_arn (BillingGroupArn) –

    The Amazon Resource Name (ARN) that references the billing group where the custom line item applies to.

  • billing_period_range (Optional[CustomLineItemBillingPeriodRange], default: None ) –

    A time range for which the custom line item is effective.

  • tags (Optional[TagMap], default: None ) –

    A map that contains tag keys and tag values that are attached to a custom line item.

  • charge_details (CustomLineItemChargeDetails) –

    A CustomLineItemChargeDetails that describes the charge details for a custom line item.

  • account_id (Optional[AccountId], default: None ) –

    The Amazon Web Services account in which this custom line item will be applied to.

  • computation_rule (Optional[ComputationRuleEnum], default: None ) –

    Specifies how the custom line item charges are computed.

  • presentation_details (Optional[PresentationObject], default: None ) –

    Details controlling how the custom line item charges are presented in the bill. Contains specifications for which service the charges will be shown under.

Raises:

Source code in docs_src/capo_billingconductor/_services/billingconductor.py
def create_custom_line_item(
    self,
    name: "capo_billingconductor.types.custom_line_item_name.CustomLineItemName",
    description: "capo_billingconductor.types.custom_line_item_description.CustomLineItemDescription",
    billing_group_arn: "capo_billingconductor.types.billing_group_arn.BillingGroupArn",
    charge_details: "capo_billingconductor.types.custom_line_item_charge_details.CustomLineItemChargeDetails",
    *,
    config_overrides: Optional[billingconductorClientConfig] = None,
    client_token: Optional[
        "capo_billingconductor.types.client_token.ClientToken"
    ] = None,
    billing_period_range: Optional[
        "capo_billingconductor.types.custom_line_item_billing_period_range.CustomLineItemBillingPeriodRange"
    ] = None,
    tags: Optional["capo_billingconductor.types.tag_map.TagMap"] = None,
    account_id: Optional["capo_billingconductor.types.account_id.AccountId"] = None,
    computation_rule: Optional[
        "capo_billingconductor.types.computation_rule_enum.ComputationRuleEnum"
    ] = None,
    presentation_details: Optional[
        "capo_billingconductor.types.presentation_object.PresentationObject"
    ] = None,
) -> "capo_billingconductor.types.create_custom_line_item_output.CreateCustomLineItemOutput":
    """<p>Creates a custom line item that can be used to create a one-time fixed charge that can be applied to a single billing group for the current or previous billing period. The one-time fixed charge is either a fee or discount. </p>

    Args:
        client_token: <p>A unique, case-sensitive identifier that you specify to ensure idempotency of the request. Idempotency ensures that an API request completes no more than one time. With an idempotent request, if the original request completes successfully, any subsequent retries complete successfully without performing any further actions.</p>
        name: <p> The name of the custom line item. </p>
        description: <p> The description of the custom line item. This is shown on the Bills page in association with the charge value. </p>
        billing_group_arn: <p> The Amazon Resource Name (ARN) that references the billing group where the custom line item applies to. </p>
        billing_period_range: <p> A time range for which the custom line item is effective. </p>
        tags: <p> A map that contains tag keys and tag values that are attached to a custom line item. </p>
        charge_details: <p> A <code>CustomLineItemChargeDetails</code> that describes the charge details for a custom line item. </p>
        account_id: <p>The Amazon Web Services account in which this custom line item will be applied to.</p>
        computation_rule: <p> Specifies how the custom line item charges are computed. </p>
        presentation_details: <p> Details controlling how the custom line item charges are presented in the bill. Contains specifications for which service the charges will be shown under. </p>

    Raises:
        capo_billingconductor.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action. </p>
        capo_billingconductor.errors.conflict_exception.ConflictException: <p>You can cause an inconsistent state by updating or deleting a resource. </p>
        capo_billingconductor.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred while processing a request. </p>
        capo_billingconductor.errors.service_limit_exceeded_exception.ServiceLimitExceededException: <p>The request would cause a service limit to exceed. </p>
        capo_billingconductor.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. </p>
        capo_billingconductor.errors.validation_exception.ValidationException: <p>The input doesn't match with the constraints specified by Amazon Web Services services.</p>
        capo_billingconductor.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_billingconductor.types.create_custom_line_item_input.CreateCustomLineItemInput]",
    ) -> OperationResponse[
        "capo_billingconductor.types.create_custom_line_item_output.CreateCustomLineItemOutput"
    ]:
        import capo_billingconductor._operations.aws_billing_conductor.create_custom_line_item

        output, http_response = (
            capo_billingconductor._operations.aws_billing_conductor.create_custom_line_item.create_custom_line_item(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_billingconductor.types.create_custom_line_item_input.CreateCustomLineItemInput",
    ) -> dict[str, Any]:
        import capo_billingconductor.types.create_custom_line_item_input

        return capo_billingconductor.types.create_custom_line_item_input.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateCustomLineItem", redact_input=_redact_input),
    )
    input_: capo_billingconductor.types.create_custom_line_item_input.CreateCustomLineItemInput = {
        "name": name,
        "description": description,
        "billing_group_arn": billing_group_arn,
        "charge_details": charge_details,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if billing_period_range is not None:
        input_["billing_period_range"] = billing_period_range
    if tags is not None:
        input_["tags"] = tags
    if account_id is not None:
        input_["account_id"] = account_id
    if computation_rule is not None:
        input_["computation_rule"] = computation_rule
    if presentation_details is not None:
        input_["presentation_details"] = presentation_details

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