Skip to content

create_billing_group async

create_billing_group(
    name: BillingGroupName,
    account_grouping: AccountGrouping,
    computation_preference: ComputationPreference,
    *,
    config_overrides: Optional[AsyncbillingconductorClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    primary_account_id: Optional[AccountId] = None,
    description: Optional[BillingGroupDescription] = None,
    tags: Optional[TagMap] = None,
) -> CreateBillingGroupOutput

Creates a billing group that resembles a consolidated billing family that Amazon Web Services charges, based off of the predefined pricing plan computation.

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 (BillingGroupName) –

    The billing group name. The names must be unique.

  • account_grouping (AccountGrouping) –

    The set of accounts that will be under the billing group. The set of accounts resemble the linked accounts in a consolidated billing family.

  • computation_preference (ComputationPreference) –

    The preferences and settings that will be used to compute the Amazon Web Services charges for a billing group.

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

    The account ID that serves as the main account in a billing group.

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

    The description of the billing group.

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

    A map that contains tag keys and tag values that are attached to a billing group. This feature isn't available during the beta.

Raises:

Source code in docs_src/capo_billingconductor/_services/async_billingconductor.py
async def create_billing_group(
    self,
    name: "capo_billingconductor.types.billing_group_name.BillingGroupName",
    account_grouping: "capo_billingconductor.types.account_grouping.AccountGrouping",
    computation_preference: "capo_billingconductor.types.computation_preference.ComputationPreference",
    *,
    config_overrides: Optional[AsyncbillingconductorClientConfig] = None,
    client_token: Optional[
        "capo_billingconductor.types.client_token.ClientToken"
    ] = None,
    primary_account_id: Optional[
        "capo_billingconductor.types.account_id.AccountId"
    ] = None,
    description: Optional[
        "capo_billingconductor.types.billing_group_description.BillingGroupDescription"
    ] = None,
    tags: Optional["capo_billingconductor.types.tag_map.TagMap"] = None,
) -> "capo_billingconductor.types.create_billing_group_output.CreateBillingGroupOutput":
    """<p> Creates a billing group that resembles a consolidated billing family that Amazon Web Services charges, based off of the predefined pricing plan computation. </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 billing group name. The names must be unique. </p>
        account_grouping: <p> The set of accounts that will be under the billing group. The set of accounts resemble the linked accounts in a consolidated billing family. </p>
        computation_preference: <p> The preferences and settings that will be used to compute the Amazon Web Services charges for a billing group. </p>
        primary_account_id: <p> The account ID that serves as the main account in a billing group. </p>
        description: <p>The description of the billing group. </p>
        tags: <p> A map that contains tag keys and tag values that are attached to a billing group. This feature isn't available during the beta. </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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_billingconductor.types.create_billing_group_input.CreateBillingGroupInput]",
    ) -> AsyncOperationResponse[
        "capo_billingconductor.types.create_billing_group_output.CreateBillingGroupOutput"
    ]:
        import capo_billingconductor._operations.aws_billing_conductor.create_billing_group

        (
            output,
            http_response,
        ) = await capo_billingconductor._operations.aws_billing_conductor.create_billing_group.async_create_billing_group(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

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

        return (
            capo_billingconductor.types.create_billing_group_input.redact_sensitive(
                input_
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateBillingGroup", redact_input=_redact_input),
    )
    input_: capo_billingconductor.types.create_billing_group_input.CreateBillingGroupInput = {
        "name": name,
        "account_grouping": account_grouping,
        "computation_preference": computation_preference,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if primary_account_id is not None:
        input_["primary_account_id"] = primary_account_id
    if description is not None:
        input_["description"] = description
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output