Skip to content

create_phone_number_order async

create_phone_number_order(
    product_type: PhoneNumberProductType,
    e164_phone_numbers: E164PhoneNumberList,
    *,
    config_overrides: Optional[AsyncChimeClientConfig] = None,
) -> CreatePhoneNumberOrderResponse

Creates an order for phone numbers to be provisioned. For toll-free numbers, you cannot use the Amazon Chime Business Calling product type. For numbers outside the U.S., you must use the Amazon Chime SIP Media Application Dial-In product type.

Parameters:

Raises:

Source code in docs_src/capo_chime/_services/async_chime.py
async def create_phone_number_order(
    self,
    product_type: "capo_chime.types.phone_number_product_type.PhoneNumberProductType",
    e164_phone_numbers: "capo_chime.types.e164_phone_number_list.E164PhoneNumberList",
    *,
    config_overrides: Optional[AsyncChimeClientConfig] = None,
) -> "capo_chime.types.create_phone_number_order_response.CreatePhoneNumberOrderResponse":
    """<p>Creates an order for phone numbers to be provisioned. For toll-free numbers, you cannot use the Amazon Chime Business Calling product type. For numbers outside the U.S., you must use the Amazon Chime SIP Media Application Dial-In product type.</p>

    Args:
        product_type: <p>The phone number product type.</p>
        e164_phone_numbers: <p>List of phone numbers, in E.164 format.</p>

    Raises:
        capo_chime.errors.access_denied_exception.AccessDeniedException: <p>You don't have permissions to perform the requested operation.</p>
        capo_chime.errors.bad_request_exception.BadRequestException: <p>The input parameters don't match the service's restrictions.</p>
        capo_chime.errors.forbidden_exception.ForbiddenException: <p>The client is permanently forbidden from making the request.</p>
        capo_chime.errors.resource_limit_exceeded_exception.ResourceLimitExceededException: <p>The request exceeds the resource limit.</p>
        capo_chime.errors.service_failure_exception.ServiceFailureException: <p>The service encountered an unexpected error.</p>
        capo_chime.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is currently unavailable.</p>
        capo_chime.errors.throttled_client_exception.ThrottledClientException: <p>The client exceeded its request rate limit.</p>
        capo_chime.errors.unauthorized_client_exception.UnauthorizedClientException: <p>The client is not currently authorized to make the request.</p>
        capo_chime.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_chime.types.create_phone_number_order_request.CreatePhoneNumberOrderRequest]",
    ) -> AsyncOperationResponse[
        "capo_chime.types.create_phone_number_order_response.CreatePhoneNumberOrderResponse"
    ]:
        import capo_chime._operations.uc_buzz_console_service.create_phone_number_order

        (
            output,
            http_response,
        ) = await capo_chime._operations.uc_buzz_console_service.create_phone_number_order.async_create_phone_number_order(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_chime.types.create_phone_number_order_request.CreatePhoneNumberOrderRequest",
    ) -> dict[str, Any]:
        import capo_chime.types.create_phone_number_order_request

        return capo_chime.types.create_phone_number_order_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_chime.types.create_phone_number_order_response.CreatePhoneNumberOrderResponse",
    ) -> dict[str, Any]:
        import capo_chime.types.create_phone_number_order_response

        return capo_chime.types.create_phone_number_order_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreatePhoneNumberOrder",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_chime.types.create_phone_number_order_request.CreatePhoneNumberOrderRequest = {
        "product_type": product_type,
        "e164_phone_numbers": e164_phone_numbers,
    }

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