Skip to content

restore_phone_number

restore_phone_number(
    phone_number_id: SensitiveNonEmptyString,
    *,
    config_overrides: Optional[ChimeSDKVoiceClientConfig] = None,
) -> RestorePhoneNumberResponse

Restores a deleted phone number.

Parameters:

Raises:

Source code in docs_src/capo_chime_sdk_voice/_services/chime_sdk_voice.py
def restore_phone_number(
    self,
    phone_number_id: "capo_chime_sdk_voice.types.sensitive_non_empty_string.SensitiveNonEmptyString",
    *,
    config_overrides: Optional[ChimeSDKVoiceClientConfig] = None,
) -> "capo_chime_sdk_voice.types.restore_phone_number_response.RestorePhoneNumberResponse":
    """<p>Restores a deleted phone number.</p>

    Args:
        phone_number_id: <p>The ID of the phone number being restored.</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.resource_limit_exceeded_exception.ResourceLimitExceededException: <p>The request exceeds the resource limit.</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.
    """

    def _handler(
        req: "OperationRequest[capo_chime_sdk_voice.types.restore_phone_number_request.RestorePhoneNumberRequest]",
    ) -> OperationResponse[
        "capo_chime_sdk_voice.types.restore_phone_number_response.RestorePhoneNumberResponse"
    ]:
        import capo_chime_sdk_voice._operations.chime_sdk_telephony_service.restore_phone_number

        output, http_response = (
            capo_chime_sdk_voice._operations.chime_sdk_telephony_service.restore_phone_number.restore_phone_number(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_chime_sdk_voice.types.restore_phone_number_request.RestorePhoneNumberRequest",
    ) -> dict[str, Any]:
        import capo_chime_sdk_voice.types.restore_phone_number_request

        return capo_chime_sdk_voice.types.restore_phone_number_request.redact_sensitive(
            input_
        )

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

        return capo_chime_sdk_voice.types.restore_phone_number_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "RestorePhoneNumber",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_chime_sdk_voice.types.restore_phone_number_request.RestorePhoneNumberRequest = {
        "phone_number_id": phone_number_id
    }

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