Skip to content

search_available_phone_numbers async

search_available_phone_numbers(
    phone_number_country_code: PhoneNumberCountryCode,
    phone_number_type: PhoneNumberType,
    *,
    config_overrides: Optional[AsyncConnectClientConfig] = None,
    target_arn: Optional[ARN] = None,
    instance_id: Optional[InstanceId] = None,
    phone_number_prefix: Optional[PhoneNumberPrefix] = None,
    max_results: Optional[MaxResult10] = None,
    next_token: Optional[LargeNextToken] = None,
) -> SearchAvailablePhoneNumbersResponse

Searches for available phone numbers that you can claim to your Connect Customer instance or traffic distribution group. If the provided TargetArn is a traffic distribution group, you can call this API in both Amazon Web Services Regions associated with the traffic distribution group.

Parameters:

  • target_arn (Optional[ARN], default: None ) –

    The Amazon Resource Name (ARN) for Connect Customer instances or traffic distribution groups that phone number inbound traffic is routed through. You must enter InstanceId or TargetArn.

  • instance_id (Optional[InstanceId], default: None ) –

    The identifier of the Connect Customer instance that phone numbers are claimed to. You can find the instance ID in the Amazon Resource Name (ARN) of the instance. You must enter InstanceId or TargetArn.

  • phone_number_country_code (PhoneNumberCountryCode) –

    The ISO country code.

  • phone_number_type (PhoneNumberType) –

    The type of phone number.

  • phone_number_prefix (Optional[PhoneNumberPrefix], default: None ) –

    The prefix of the phone number. If provided, it must contain + as part of the country code.

  • max_results (Optional[MaxResult10], default: None ) –

    The maximum number of results to return per page.

  • next_token (Optional[LargeNextToken], default: None ) –

    The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

Raises:

Source code in docs_src/capo_connect/_services/async_connect.py
async def search_available_phone_numbers(
    self,
    phone_number_country_code: "capo_connect.types.phone_number_country_code.PhoneNumberCountryCode",
    phone_number_type: "capo_connect.types.phone_number_type.PhoneNumberType",
    *,
    config_overrides: Optional[AsyncConnectClientConfig] = None,
    target_arn: Optional["capo_connect.types.arn.ARN"] = None,
    instance_id: Optional["capo_connect.types.instance_id.InstanceId"] = None,
    phone_number_prefix: Optional[
        "capo_connect.types.phone_number_prefix.PhoneNumberPrefix"
    ] = None,
    max_results: Optional["capo_connect.types.max_result10.MaxResult10"] = None,
    next_token: Optional[
        "capo_connect.types.large_next_token.LargeNextToken"
    ] = None,
) -> "capo_connect.types.search_available_phone_numbers_response.SearchAvailablePhoneNumbersResponse":
    """<p>Searches for available phone numbers that you can claim to your Connect Customer instance or traffic distribution group. If the provided <code>TargetArn</code> is a traffic distribution group, you can call this API in both Amazon Web Services Regions associated with the traffic distribution group.</p>

    Args:
        target_arn: <p>The Amazon Resource Name (ARN) for Connect Customer instances or traffic distribution groups that phone number inbound traffic is routed through. You must enter <code>InstanceId</code> or <code>TargetArn</code>. </p>
        instance_id: <p>The identifier of the Connect Customer instance that phone numbers are claimed to. You can <a href="https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html">find the instance ID</a> in the Amazon Resource Name (ARN) of the instance. You must enter <code>InstanceId</code> or <code>TargetArn</code>. </p>
        phone_number_country_code: <p>The ISO country code.</p>
        phone_number_type: <p>The type of phone number.</p>
        phone_number_prefix: <p>The prefix of the phone number. If provided, it must contain <code>+</code> as part of the country code.</p>
        max_results: <p>The maximum number of results to return per page.</p>
        next_token: <p>The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.</p>

    Raises:
        capo_connect.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action.</p>
        capo_connect.errors.internal_service_exception.InternalServiceException: <p>Request processing failed because of an error or failure with the service.</p>
        capo_connect.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more of the specified parameters are not valid.</p>
        capo_connect.errors.throttling_exception.ThrottlingException: <p>The throttling limit has been exceeded.</p>
        capo_connect.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_connect.types.search_available_phone_numbers_request.SearchAvailablePhoneNumbersRequest]",
    ) -> AsyncOperationResponse[
        "capo_connect.types.search_available_phone_numbers_response.SearchAvailablePhoneNumbersResponse"
    ]:
        import capo_connect._operations.amazon_connect_service.search_available_phone_numbers

        (
            output,
            http_response,
        ) = await capo_connect._operations.amazon_connect_service.search_available_phone_numbers.async_search_available_phone_numbers(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SearchAvailablePhoneNumbers")
    )
    input_: capo_connect.types.search_available_phone_numbers_request.SearchAvailablePhoneNumbersRequest = {
        "phone_number_country_code": phone_number_country_code,
        "phone_number_type": phone_number_type,
    }
    if target_arn is not None:
        input_["target_arn"] = target_arn
    if instance_id is not None:
        input_["instance_id"] = instance_id
    if phone_number_prefix is not None:
        input_["phone_number_prefix"] = phone_number_prefix
    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