Skip to content

create_invoice_unit

create_invoice_unit(
    name: InvoiceUnitName,
    invoice_receiver: AccountIdString,
    rule: InvoiceUnitRule,
    *,
    config_overrides: Optional[InvoicingClientConfig] = None,
    description: Optional[DescriptionString] = None,
    tax_inheritance_disabled: Optional[TaxInheritanceDisabledFlag] = None,
    resource_tags: Optional[ResourceTagList] = None,
    client_token: Optional[BasicStringWithoutSpace] = None,
) -> CreateInvoiceUnitResponse

This creates a new invoice unit with the provided definition.

Parameters:

  • name (InvoiceUnitName) –

    The unique name of the invoice unit that is shown on the generated invoice. This can't be changed once it is set. To change this name, you must delete the invoice unit recreate.

  • invoice_receiver (AccountIdString) –

    The Amazon Web Services account ID chosen to be the receiver of an invoice unit. All invoices generated for that invoice unit will be sent to this account ID.

  • description (Optional[DescriptionString], default: None ) –

    The invoice unit's description. This can be changed at a later time.

  • tax_inheritance_disabled (Optional[TaxInheritanceDisabledFlag], default: None ) –

    Whether the invoice unit based tax inheritance is/ should be enabled or disabled.

  • rule (InvoiceUnitRule) –

    The InvoiceUnitRule object used to create invoice units.

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

    The tag structure that contains a tag key and value.

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

    A unique, case-sensitive identifier that you provide to ensure idempotency of the request.

Raises:

Examples:

CreateInvoiceUnit

>>> client.create_invoice_unit(name='Example Invoice Unit', invoice_receiver='111111111111', description='Example Invoice Unit Description', tax_inheritance_disabled=False, rule={'LinkedAccounts': ['222222222222']}, resource_tags=[{'Key': 'TagKey', 'Value': 'TagValue'}], client_token='e362c68e-4e74-48d7-9228-0bc5aa447b42')
Source code in docs_src/capo_invoicing/_services/invoicing.py
def create_invoice_unit(
    self,
    name: "capo_invoicing.types.invoice_unit_name.InvoiceUnitName",
    invoice_receiver: "capo_invoicing.types.account_id_string.AccountIdString",
    rule: "capo_invoicing.types.invoice_unit_rule.InvoiceUnitRule",
    *,
    config_overrides: Optional[InvoicingClientConfig] = None,
    description: Optional[
        "capo_invoicing.types.description_string.DescriptionString"
    ] = None,
    tax_inheritance_disabled: Optional[
        "capo_invoicing.types.tax_inheritance_disabled_flag.TaxInheritanceDisabledFlag"
    ] = None,
    resource_tags: Optional[
        "capo_invoicing.types.resource_tag_list.ResourceTagList"
    ] = None,
    client_token: Optional[
        "capo_invoicing.types.basic_string_without_space.BasicStringWithoutSpace"
    ] = None,
) -> "capo_invoicing.types.create_invoice_unit_response.CreateInvoiceUnitResponse":
    """<p>This creates a new invoice unit with the provided definition.</p>

    Args:
        name: <p> The unique name of the invoice unit that is shown on the generated invoice. This can't be changed once it is set. To change this name, you must delete the invoice unit recreate. </p>
        invoice_receiver: <p> The Amazon Web Services account ID chosen to be the receiver of an invoice unit. All invoices generated for that invoice unit will be sent to this account ID. </p>
        description: <p> The invoice unit's description. This can be changed at a later time. </p>
        tax_inheritance_disabled: <p>Whether the invoice unit based tax inheritance is/ should be enabled or disabled. </p>
        rule: <p>The <code>InvoiceUnitRule</code> object used to create invoice units. </p>
        resource_tags: <p> The tag structure that contains a tag key and value. </p>
        client_token: <p> A unique, case-sensitive identifier that you provide to ensure idempotency of the request. </p>

    Raises:
        capo_invoicing.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this action.</p>
        capo_invoicing.errors.internal_server_exception.InternalServerException: <p>The processing request failed because of an unknown error, exception, or failure. </p>
        capo_invoicing.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_invoicing.errors.validation_exception.ValidationException: <p> The input fails to satisfy the constraints specified by an Amazon Web Services service. </p>
        capo_invoicing.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        CreateInvoiceUnit

        >>> client.create_invoice_unit(name='Example Invoice Unit', invoice_receiver='111111111111', description='Example Invoice Unit Description', tax_inheritance_disabled=False, rule={'LinkedAccounts': ['222222222222']}, resource_tags=[{'Key': 'TagKey', 'Value': 'TagValue'}], client_token='e362c68e-4e74-48d7-9228-0bc5aa447b42')
    """

    def _handler(
        req: "OperationRequest[capo_invoicing.types.create_invoice_unit_request.CreateInvoiceUnitRequest]",
    ) -> OperationResponse[
        "capo_invoicing.types.create_invoice_unit_response.CreateInvoiceUnitResponse"
    ]:
        import capo_invoicing._operations.invoicing.create_invoice_unit

        output, http_response = (
            capo_invoicing._operations.invoicing.create_invoice_unit.create_invoice_unit(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateInvoiceUnit")
    )
    input_: capo_invoicing.types.create_invoice_unit_request.CreateInvoiceUnitRequest = {
        "name": name,
        "invoice_receiver": invoice_receiver,
        "rule": rule,
    }
    if description is not None:
        input_["description"] = description
    if tax_inheritance_disabled is not None:
        input_["tax_inheritance_disabled"] = tax_inheritance_disabled
    if resource_tags is not None:
        input_["resource_tags"] = resource_tags
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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