Skip to content

list_phone_numbers async

list_phone_numbers(
    *,
    config_overrides: Optional[AsyncChimeSDKVoiceClientConfig] = None,
    status: Optional[String] = None,
    product_type: Optional[PhoneNumberProductType] = None,
    filter_name: Optional[PhoneNumberAssociationName] = None,
    filter_value: Optional[String] = None,
    max_results: Optional[ResultMax] = None,
    next_token: Optional[String] = None,
) -> ListPhoneNumbersResponse

Lists the phone numbers for the specified Amazon Chime SDK account, Amazon Chime SDK user, Amazon Chime SDK Voice Connector, or Amazon Chime SDK Voice Connector group.

Parameters:

Raises:

Source code in docs_src/capo_chime_sdk_voice/_services/async_chime_sdk_voice.py
async def list_phone_numbers(
    self,
    *,
    config_overrides: Optional[AsyncChimeSDKVoiceClientConfig] = None,
    status: Optional["capo_chime_sdk_voice.types.string.String"] = None,
    product_type: Optional[
        "capo_chime_sdk_voice.types.phone_number_product_type.PhoneNumberProductType"
    ] = None,
    filter_name: Optional[
        "capo_chime_sdk_voice.types.phone_number_association_name.PhoneNumberAssociationName"
    ] = None,
    filter_value: Optional["capo_chime_sdk_voice.types.string.String"] = None,
    max_results: Optional["capo_chime_sdk_voice.types.result_max.ResultMax"] = None,
    next_token: Optional["capo_chime_sdk_voice.types.string.String"] = None,
) -> "capo_chime_sdk_voice.types.list_phone_numbers_response.ListPhoneNumbersResponse":
    """<p>Lists the phone numbers for the specified Amazon Chime SDK account, Amazon Chime SDK user, Amazon Chime SDK Voice Connector, or Amazon Chime SDK Voice Connector group.</p>

    Args:
        status: <p>The status of your organization's phone numbers.</p>
        product_type: <p>The phone number product types.</p>
        filter_name: <p>The filter to limit the number of results.</p>
        filter_value: <p>The filter value.</p>
        max_results: <p>The maximum number of results to return in a single call.</p>
        next_token: <p>The token used to return the next page of results.</p>

    Raises:
        capo_chime_sdk_voice.errors.bad_request_exception.BadRequestException: <p>The input parameters don't match the service's restrictions.</p>
        capo_chime_sdk_voice.errors.forbidden_exception.ForbiddenException: <p>The client is permanently forbidden from making the request.</p>
        capo_chime_sdk_voice.errors.not_found_exception.NotFoundException: <p>The requested resource couldn't be found.</p>
        capo_chime_sdk_voice.errors.service_failure_exception.ServiceFailureException: <p>The service encountered an unexpected error.</p>
        capo_chime_sdk_voice.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is currently unavailable.</p>
        capo_chime_sdk_voice.errors.throttled_client_exception.ThrottledClientException: <p>The number of customer requests exceeds the request rate limit.</p>
        capo_chime_sdk_voice.errors.unauthorized_client_exception.UnauthorizedClientException: <p>The client isn't authorized to request a resource.</p>
        capo_chime_sdk_voice.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_chime_sdk_voice.types.list_phone_numbers_request.ListPhoneNumbersRequest]",
    ) -> AsyncOperationResponse[
        "capo_chime_sdk_voice.types.list_phone_numbers_response.ListPhoneNumbersResponse"
    ]:
        import capo_chime_sdk_voice._operations.chime_sdk_telephony_service.list_phone_numbers

        (
            output,
            http_response,
        ) = await capo_chime_sdk_voice._operations.chime_sdk_telephony_service.list_phone_numbers.async_list_phone_numbers(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_chime_sdk_voice.types.list_phone_numbers_response.ListPhoneNumbersResponse",
    ) -> dict[str, Any]:
        import capo_chime_sdk_voice.types.list_phone_numbers_response

        return (
            capo_chime_sdk_voice.types.list_phone_numbers_response.redact_sensitive(
                output
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("ListPhoneNumbers", redact_output=_redact_output),
    )
    input_: capo_chime_sdk_voice.types.list_phone_numbers_request.ListPhoneNumbersRequest = {}
    if status is not None:
        input_["status"] = status
    if product_type is not None:
        input_["product_type"] = product_type
    if filter_name is not None:
        input_["filter_name"] = filter_name
    if filter_value is not None:
        input_["filter_value"] = filter_value
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

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