Skip to content

opt_out_speaker

opt_out_speaker(
    domain_id: DomainId,
    speaker_id: SpeakerId,
    *,
    config_overrides: Optional[VoiceIDClientConfig] = None,
) -> OptOutSpeakerResponse

Opts out a speaker from Voice ID. A speaker can be opted out regardless of whether or not they already exist in Voice ID. If they don't yet exist, a new speaker is created in an opted out state. If they already exist, their existing status is overridden and they are opted out. Enrollment and evaluation authentication requests are rejected for opted out speakers, and opted out speakers have no voice embeddings stored in Voice ID.

Parameters:

  • domain_id (DomainId) –

    The identifier of the domain that contains the speaker.

  • speaker_id (SpeakerId) –

    The identifier of the speaker you want opted-out.

Raises:

Source code in docs_src/capo_voice_id/_services/voice_id.py
def opt_out_speaker(
    self,
    domain_id: "capo_voice_id.types.domain_id.DomainId",
    speaker_id: "capo_voice_id.types.speaker_id.SpeakerId",
    *,
    config_overrides: Optional[VoiceIDClientConfig] = None,
) -> "capo_voice_id.types.opt_out_speaker_response.OptOutSpeakerResponse":
    """<p>Opts out a speaker from Voice ID. A speaker can be opted out regardless of whether or not they already exist in Voice ID. If they don't yet exist, a new speaker is created in an opted out state. If they already exist, their existing status is overridden and they are opted out. Enrollment and evaluation authentication requests are rejected for opted out speakers, and opted out speakers have no voice embeddings stored in Voice ID.</p>

    Args:
        domain_id: <p>The identifier of the domain that contains the speaker.</p>
        speaker_id: <p>The identifier of the speaker you want opted-out.</p>

    Raises:
        capo_voice_id.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action. Check the error message and try again.</p>
        capo_voice_id.errors.conflict_exception.ConflictException: <p>The request failed due to a conflict. Check the <code>ConflictType</code> and error message for more details.</p>
        capo_voice_id.errors.internal_server_exception.InternalServerException: <p>The request failed due to an unknown error on the server side.</p>
        capo_voice_id.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource cannot be found. Check the <code>ResourceType</code> and error message for more details.</p>
        capo_voice_id.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request exceeded the service quota. Refer to <a href="https://docs.aws.amazon.com/connect/latest/adminguide/amazon-connect-service-limits.html#voiceid-quotas">Voice ID Service Quotas</a> and try your request again.</p>
        capo_voice_id.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Please slow down your request rate. Refer to <a href="https://docs.aws.amazon.com/connect/latest/adminguide/amazon-connect-service-limits.html##voiceid-api-quotas"> Amazon Connect Voice ID Service API throttling quotas </a> and try your request again.</p>
        capo_voice_id.errors.validation_exception.ValidationException: <p>The request failed one or more validations; check the error message for more details.</p>
        capo_voice_id.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_voice_id.types.opt_out_speaker_request.OptOutSpeakerRequest]",
    ) -> OperationResponse[
        "capo_voice_id.types.opt_out_speaker_response.OptOutSpeakerResponse"
    ]:
        import capo_voice_id._operations.voice_id.opt_out_speaker

        output, http_response = (
            capo_voice_id._operations.voice_id.opt_out_speaker.opt_out_speaker(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_voice_id.types.opt_out_speaker_request.OptOutSpeakerRequest",
    ) -> dict[str, Any]:
        import capo_voice_id.types.opt_out_speaker_request

        return capo_voice_id.types.opt_out_speaker_request.redact_sensitive(input_)

    def _redact_output(
        output: "capo_voice_id.types.opt_out_speaker_response.OptOutSpeakerResponse",
    ) -> dict[str, Any]:
        import capo_voice_id.types.opt_out_speaker_response

        return capo_voice_id.types.opt_out_speaker_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "OptOutSpeaker",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_voice_id.types.opt_out_speaker_request.OptOutSpeakerRequest = {
        "domain_id": domain_id,
        "speaker_id": speaker_id,
    }

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