All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.voiceid.DefaultVoiceIdAsyncClient Maven / Gradle / Ivy

/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.voiceid;

import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import java.util.function.Function;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.awscore.internal.AwsProtocolMetadata;
import software.amazon.awssdk.awscore.internal.AwsServiceProtocol;
import software.amazon.awssdk.awscore.retry.AwsRetryStrategy;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkPlugin;
import software.amazon.awssdk.core.SdkRequest;
import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
import software.amazon.awssdk.core.client.handler.AsyncClientHandler;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.metrics.CoreMetric;
import software.amazon.awssdk.core.retry.RetryMode;
import software.amazon.awssdk.metrics.MetricCollector;
import software.amazon.awssdk.metrics.MetricPublisher;
import software.amazon.awssdk.metrics.NoOpMetricCollector;
import software.amazon.awssdk.protocols.core.ExceptionMetadata;
import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
import software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.voiceid.internal.VoiceIdServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.voiceid.model.AccessDeniedException;
import software.amazon.awssdk.services.voiceid.model.AssociateFraudsterRequest;
import software.amazon.awssdk.services.voiceid.model.AssociateFraudsterResponse;
import software.amazon.awssdk.services.voiceid.model.ConflictException;
import software.amazon.awssdk.services.voiceid.model.CreateDomainRequest;
import software.amazon.awssdk.services.voiceid.model.CreateDomainResponse;
import software.amazon.awssdk.services.voiceid.model.CreateWatchlistRequest;
import software.amazon.awssdk.services.voiceid.model.CreateWatchlistResponse;
import software.amazon.awssdk.services.voiceid.model.DeleteDomainRequest;
import software.amazon.awssdk.services.voiceid.model.DeleteDomainResponse;
import software.amazon.awssdk.services.voiceid.model.DeleteFraudsterRequest;
import software.amazon.awssdk.services.voiceid.model.DeleteFraudsterResponse;
import software.amazon.awssdk.services.voiceid.model.DeleteSpeakerRequest;
import software.amazon.awssdk.services.voiceid.model.DeleteSpeakerResponse;
import software.amazon.awssdk.services.voiceid.model.DeleteWatchlistRequest;
import software.amazon.awssdk.services.voiceid.model.DeleteWatchlistResponse;
import software.amazon.awssdk.services.voiceid.model.DescribeDomainRequest;
import software.amazon.awssdk.services.voiceid.model.DescribeDomainResponse;
import software.amazon.awssdk.services.voiceid.model.DescribeFraudsterRegistrationJobRequest;
import software.amazon.awssdk.services.voiceid.model.DescribeFraudsterRegistrationJobResponse;
import software.amazon.awssdk.services.voiceid.model.DescribeFraudsterRequest;
import software.amazon.awssdk.services.voiceid.model.DescribeFraudsterResponse;
import software.amazon.awssdk.services.voiceid.model.DescribeSpeakerEnrollmentJobRequest;
import software.amazon.awssdk.services.voiceid.model.DescribeSpeakerEnrollmentJobResponse;
import software.amazon.awssdk.services.voiceid.model.DescribeSpeakerRequest;
import software.amazon.awssdk.services.voiceid.model.DescribeSpeakerResponse;
import software.amazon.awssdk.services.voiceid.model.DescribeWatchlistRequest;
import software.amazon.awssdk.services.voiceid.model.DescribeWatchlistResponse;
import software.amazon.awssdk.services.voiceid.model.DisassociateFraudsterRequest;
import software.amazon.awssdk.services.voiceid.model.DisassociateFraudsterResponse;
import software.amazon.awssdk.services.voiceid.model.EvaluateSessionRequest;
import software.amazon.awssdk.services.voiceid.model.EvaluateSessionResponse;
import software.amazon.awssdk.services.voiceid.model.InternalServerException;
import software.amazon.awssdk.services.voiceid.model.ListDomainsRequest;
import software.amazon.awssdk.services.voiceid.model.ListDomainsResponse;
import software.amazon.awssdk.services.voiceid.model.ListFraudsterRegistrationJobsRequest;
import software.amazon.awssdk.services.voiceid.model.ListFraudsterRegistrationJobsResponse;
import software.amazon.awssdk.services.voiceid.model.ListFraudstersRequest;
import software.amazon.awssdk.services.voiceid.model.ListFraudstersResponse;
import software.amazon.awssdk.services.voiceid.model.ListSpeakerEnrollmentJobsRequest;
import software.amazon.awssdk.services.voiceid.model.ListSpeakerEnrollmentJobsResponse;
import software.amazon.awssdk.services.voiceid.model.ListSpeakersRequest;
import software.amazon.awssdk.services.voiceid.model.ListSpeakersResponse;
import software.amazon.awssdk.services.voiceid.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.voiceid.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.voiceid.model.ListWatchlistsRequest;
import software.amazon.awssdk.services.voiceid.model.ListWatchlistsResponse;
import software.amazon.awssdk.services.voiceid.model.OptOutSpeakerRequest;
import software.amazon.awssdk.services.voiceid.model.OptOutSpeakerResponse;
import software.amazon.awssdk.services.voiceid.model.ResourceNotFoundException;
import software.amazon.awssdk.services.voiceid.model.ServiceQuotaExceededException;
import software.amazon.awssdk.services.voiceid.model.StartFraudsterRegistrationJobRequest;
import software.amazon.awssdk.services.voiceid.model.StartFraudsterRegistrationJobResponse;
import software.amazon.awssdk.services.voiceid.model.StartSpeakerEnrollmentJobRequest;
import software.amazon.awssdk.services.voiceid.model.StartSpeakerEnrollmentJobResponse;
import software.amazon.awssdk.services.voiceid.model.TagResourceRequest;
import software.amazon.awssdk.services.voiceid.model.TagResourceResponse;
import software.amazon.awssdk.services.voiceid.model.ThrottlingException;
import software.amazon.awssdk.services.voiceid.model.UntagResourceRequest;
import software.amazon.awssdk.services.voiceid.model.UntagResourceResponse;
import software.amazon.awssdk.services.voiceid.model.UpdateDomainRequest;
import software.amazon.awssdk.services.voiceid.model.UpdateDomainResponse;
import software.amazon.awssdk.services.voiceid.model.UpdateWatchlistRequest;
import software.amazon.awssdk.services.voiceid.model.UpdateWatchlistResponse;
import software.amazon.awssdk.services.voiceid.model.ValidationException;
import software.amazon.awssdk.services.voiceid.model.VoiceIdException;
import software.amazon.awssdk.services.voiceid.transform.AssociateFraudsterRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.CreateDomainRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.CreateWatchlistRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.DeleteDomainRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.DeleteFraudsterRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.DeleteSpeakerRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.DeleteWatchlistRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.DescribeDomainRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.DescribeFraudsterRegistrationJobRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.DescribeFraudsterRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.DescribeSpeakerEnrollmentJobRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.DescribeSpeakerRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.DescribeWatchlistRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.DisassociateFraudsterRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.EvaluateSessionRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.ListDomainsRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.ListFraudsterRegistrationJobsRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.ListFraudstersRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.ListSpeakerEnrollmentJobsRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.ListSpeakersRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.ListWatchlistsRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.OptOutSpeakerRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.StartFraudsterRegistrationJobRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.StartSpeakerEnrollmentJobRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.UpdateDomainRequestMarshaller;
import software.amazon.awssdk.services.voiceid.transform.UpdateWatchlistRequestMarshaller;
import software.amazon.awssdk.utils.CompletableFutureUtils;

/**
 * Internal implementation of {@link VoiceIdAsyncClient}.
 *
 * @see VoiceIdAsyncClient#builder()
 */
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultVoiceIdAsyncClient implements VoiceIdAsyncClient {
    private static final Logger log = LoggerFactory.getLogger(DefaultVoiceIdAsyncClient.class);

    private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
            .serviceProtocol(AwsServiceProtocol.AWS_JSON).build();

    private final AsyncClientHandler clientHandler;

    private final AwsJsonProtocolFactory protocolFactory;

    private final SdkClientConfiguration clientConfiguration;

    protected DefaultVoiceIdAsyncClient(SdkClientConfiguration clientConfiguration) {
        this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
        this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
        this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
    }

    /**
     * 

* Associates the fraudsters with the watchlist specified in the same domain. *

* * @param associateFraudsterRequest * @return A Java Future containing the result of the AssociateFraudster operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ServiceQuotaExceededException The request exceeded the service quota. Refer to Voice ID Service Quotas and try your request again.
  • *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • ConflictException The request failed due to a conflict. Check the ConflictType and error * message for more details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.AssociateFraudster * @see AWS * API Documentation */ @Override public CompletableFuture associateFraudster(AssociateFraudsterRequest associateFraudsterRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(associateFraudsterRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, associateFraudsterRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AssociateFraudster"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, AssociateFraudsterResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("AssociateFraudster").withProtocolMetadata(protocolMetadata) .withMarshaller(new AssociateFraudsterRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(associateFraudsterRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Creates a domain that contains all Amazon Connect Voice ID data, such as speakers, fraudsters, customer audio, * and voiceprints. Every domain is created with a default watchlist that fraudsters can be a part of. *

* * @param createDomainRequest * @return A Java Future containing the result of the CreateDomain operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ServiceQuotaExceededException The request exceeded the service quota. Refer to Voice ID Service Quotas and try your request again.
  • *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • ConflictException The request failed due to a conflict. Check the ConflictType and error * message for more details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.CreateDomain * @see AWS API * Documentation */ @Override public CompletableFuture createDomain(CreateDomainRequest createDomainRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createDomainRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createDomainRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateDomain"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CreateDomainResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateDomain").withProtocolMetadata(protocolMetadata) .withMarshaller(new CreateDomainRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(createDomainRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Creates a watchlist that fraudsters can be a part of. *

* * @param createWatchlistRequest * @return A Java Future containing the result of the CreateWatchlist operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ServiceQuotaExceededException The request exceeded the service quota. Refer to Voice ID Service Quotas and try your request again.
  • *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • ConflictException The request failed due to a conflict. Check the ConflictType and error * message for more details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.CreateWatchlist * @see AWS API * Documentation */ @Override public CompletableFuture createWatchlist(CreateWatchlistRequest createWatchlistRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createWatchlistRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createWatchlistRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateWatchlist"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateWatchlistResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateWatchlist").withProtocolMetadata(protocolMetadata) .withMarshaller(new CreateWatchlistRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(createWatchlistRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Deletes the specified domain from Voice ID. *

* * @param deleteDomainRequest * @return A Java Future containing the result of the DeleteDomain operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • ConflictException The request failed due to a conflict. Check the ConflictType and error * message for more details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.DeleteDomain * @see AWS API * Documentation */ @Override public CompletableFuture deleteDomain(DeleteDomainRequest deleteDomainRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteDomainRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteDomainRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteDomain"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteDomainResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteDomain").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteDomainRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteDomainRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Deletes the specified fraudster from Voice ID. This action disassociates the fraudster from any watchlists it is * a part of. *

* * @param deleteFraudsterRequest * @return A Java Future containing the result of the DeleteFraudster operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • ConflictException The request failed due to a conflict. Check the ConflictType and error * message for more details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.DeleteFraudster * @see AWS API * Documentation */ @Override public CompletableFuture deleteFraudster(DeleteFraudsterRequest deleteFraudsterRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteFraudsterRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteFraudsterRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteFraudster"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteFraudsterResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteFraudster").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteFraudsterRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteFraudsterRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Deletes the specified speaker from Voice ID. *

* * @param deleteSpeakerRequest * @return A Java Future containing the result of the DeleteSpeaker operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • ConflictException The request failed due to a conflict. Check the ConflictType and error * message for more details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.DeleteSpeaker * @see AWS API * Documentation */ @Override public CompletableFuture deleteSpeaker(DeleteSpeakerRequest deleteSpeakerRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteSpeakerRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteSpeakerRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteSpeaker"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteSpeakerResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteSpeaker").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteSpeakerRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteSpeakerRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Deletes the specified watchlist from Voice ID. This API throws an exception when there are fraudsters in the * watchlist that you are trying to delete. You must delete the fraudsters, and then delete the watchlist. Every * domain has a default watchlist which cannot be deleted. *

* * @param deleteWatchlistRequest * @return A Java Future containing the result of the DeleteWatchlist operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • ConflictException The request failed due to a conflict. Check the ConflictType and error * message for more details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.DeleteWatchlist * @see AWS API * Documentation */ @Override public CompletableFuture deleteWatchlist(DeleteWatchlistRequest deleteWatchlistRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteWatchlistRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteWatchlistRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteWatchlist"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteWatchlistResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteWatchlist").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteWatchlistRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteWatchlistRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describes the specified domain. *

* * @param describeDomainRequest * @return A Java Future containing the result of the DescribeDomain operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.DescribeDomain * @see AWS API * Documentation */ @Override public CompletableFuture describeDomain(DescribeDomainRequest describeDomainRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeDomainRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeDomainRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeDomain"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeDomainResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeDomain").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeDomainRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeDomainRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describes the specified fraudster. *

* * @param describeFraudsterRequest * @return A Java Future containing the result of the DescribeFraudster operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.DescribeFraudster * @see AWS * API Documentation */ @Override public CompletableFuture describeFraudster(DescribeFraudsterRequest describeFraudsterRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeFraudsterRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeFraudsterRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeFraudster"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeFraudsterResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeFraudster").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeFraudsterRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeFraudsterRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describes the specified fraudster registration job. *

* * @param describeFraudsterRegistrationJobRequest * @return A Java Future containing the result of the DescribeFraudsterRegistrationJob operation returned by the * service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.DescribeFraudsterRegistrationJob * @see AWS API Documentation */ @Override public CompletableFuture describeFraudsterRegistrationJob( DescribeFraudsterRegistrationJobRequest describeFraudsterRegistrationJobRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeFraudsterRegistrationJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeFraudsterRegistrationJobRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeFraudsterRegistrationJob"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, DescribeFraudsterRegistrationJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeFraudsterRegistrationJob").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeFraudsterRegistrationJobRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeFraudsterRegistrationJobRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describes the specified speaker. *

* * @param describeSpeakerRequest * @return A Java Future containing the result of the DescribeSpeaker operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.DescribeSpeaker * @see AWS API * Documentation */ @Override public CompletableFuture describeSpeaker(DescribeSpeakerRequest describeSpeakerRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeSpeakerRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeSpeakerRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeSpeaker"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeSpeakerResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeSpeaker").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeSpeakerRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeSpeakerRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describes the specified speaker enrollment job. *

* * @param describeSpeakerEnrollmentJobRequest * @return A Java Future containing the result of the DescribeSpeakerEnrollmentJob operation returned by the * service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.DescribeSpeakerEnrollmentJob * @see AWS API Documentation */ @Override public CompletableFuture describeSpeakerEnrollmentJob( DescribeSpeakerEnrollmentJobRequest describeSpeakerEnrollmentJobRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeSpeakerEnrollmentJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeSpeakerEnrollmentJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeSpeakerEnrollmentJob"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeSpeakerEnrollmentJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeSpeakerEnrollmentJob").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeSpeakerEnrollmentJobRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeSpeakerEnrollmentJobRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describes the specified watchlist. *

* * @param describeWatchlistRequest * @return A Java Future containing the result of the DescribeWatchlist operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.DescribeWatchlist * @see AWS * API Documentation */ @Override public CompletableFuture describeWatchlist(DescribeWatchlistRequest describeWatchlistRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeWatchlistRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeWatchlistRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeWatchlist"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeWatchlistResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeWatchlist").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeWatchlistRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeWatchlistRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Disassociates the fraudsters from the watchlist specified. Voice ID always expects a fraudster to be a part of at * least one watchlist. If you try to disassociate a fraudster from its only watchlist, a * ValidationException is thrown. *

* * @param disassociateFraudsterRequest * @return A Java Future containing the result of the DisassociateFraudster operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • ConflictException The request failed due to a conflict. Check the ConflictType and error * message for more details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.DisassociateFraudster * @see AWS API Documentation */ @Override public CompletableFuture disassociateFraudster( DisassociateFraudsterRequest disassociateFraudsterRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(disassociateFraudsterRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, disassociateFraudsterRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DisassociateFraudster"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DisassociateFraudsterResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DisassociateFraudster").withProtocolMetadata(protocolMetadata) .withMarshaller(new DisassociateFraudsterRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(disassociateFraudsterRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Evaluates a specified session based on audio data accumulated during a streaming Amazon Connect Voice ID call. *

* * @param evaluateSessionRequest * @return A Java Future containing the result of the EvaluateSession operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • ConflictException The request failed due to a conflict. Check the ConflictType and error * message for more details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.EvaluateSession * @see AWS API * Documentation */ @Override public CompletableFuture evaluateSession(EvaluateSessionRequest evaluateSessionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(evaluateSessionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, evaluateSessionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EvaluateSession"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, EvaluateSessionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("EvaluateSession").withProtocolMetadata(protocolMetadata) .withMarshaller(new EvaluateSessionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(evaluateSessionRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Lists all the domains in the Amazon Web Services account. *

* * @param listDomainsRequest * @return A Java Future containing the result of the ListDomains operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.ListDomains * @see AWS API * Documentation */ @Override public CompletableFuture listDomains(ListDomainsRequest listDomainsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listDomainsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listDomainsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListDomains"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListDomainsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListDomains").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListDomainsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listDomainsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Lists all the fraudster registration jobs in the domain with the given JobStatus. If * JobStatus is not provided, this lists all fraudster registration jobs in the given domain. *

* * @param listFraudsterRegistrationJobsRequest * @return A Java Future containing the result of the ListFraudsterRegistrationJobs operation returned by the * service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.ListFraudsterRegistrationJobs * @see AWS API Documentation */ @Override public CompletableFuture listFraudsterRegistrationJobs( ListFraudsterRegistrationJobsRequest listFraudsterRegistrationJobsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listFraudsterRegistrationJobsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listFraudsterRegistrationJobsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListFraudsterRegistrationJobs"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListFraudsterRegistrationJobsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListFraudsterRegistrationJobs").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListFraudsterRegistrationJobsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listFraudsterRegistrationJobsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Lists all fraudsters in a specified watchlist or domain. *

* * @param listFraudstersRequest * @return A Java Future containing the result of the ListFraudsters operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.ListFraudsters * @see AWS API * Documentation */ @Override public CompletableFuture listFraudsters(ListFraudstersRequest listFraudstersRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listFraudstersRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listFraudstersRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListFraudsters"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListFraudstersResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListFraudsters").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListFraudstersRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listFraudstersRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Lists all the speaker enrollment jobs in the domain with the specified JobStatus. If * JobStatus is not provided, this lists all jobs with all possible speaker enrollment job statuses. *

* * @param listSpeakerEnrollmentJobsRequest * @return A Java Future containing the result of the ListSpeakerEnrollmentJobs operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.ListSpeakerEnrollmentJobs * @see AWS API Documentation */ @Override public CompletableFuture listSpeakerEnrollmentJobs( ListSpeakerEnrollmentJobsRequest listSpeakerEnrollmentJobsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listSpeakerEnrollmentJobsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listSpeakerEnrollmentJobsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListSpeakerEnrollmentJobs"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListSpeakerEnrollmentJobsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListSpeakerEnrollmentJobs").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListSpeakerEnrollmentJobsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listSpeakerEnrollmentJobsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Lists all speakers in a specified domain. *

* * @param listSpeakersRequest * @return A Java Future containing the result of the ListSpeakers operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.ListSpeakers * @see AWS API * Documentation */ @Override public CompletableFuture listSpeakers(ListSpeakersRequest listSpeakersRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listSpeakersRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listSpeakersRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListSpeakers"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListSpeakersResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListSpeakers").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListSpeakersRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listSpeakersRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Lists all tags associated with a specified Voice ID resource. *

* * @param listTagsForResourceRequest * @return A Java Future containing the result of the ListTagsForResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.ListTagsForResource * @see AWS * API Documentation */ @Override public CompletableFuture listTagsForResource( ListTagsForResourceRequest listTagsForResourceRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listTagsForResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListTagsForResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListTagsForResource").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listTagsForResourceRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Lists all watchlists in a specified domain. *

* * @param listWatchlistsRequest * @return A Java Future containing the result of the ListWatchlists operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.ListWatchlists * @see AWS API * Documentation */ @Override public CompletableFuture listWatchlists(ListWatchlistsRequest listWatchlistsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listWatchlistsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listWatchlistsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListWatchlists"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListWatchlistsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListWatchlists").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListWatchlistsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listWatchlistsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* 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. *

* * @param optOutSpeakerRequest * @return A Java Future containing the result of the OptOutSpeaker operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ServiceQuotaExceededException The request exceeded the service quota. Refer to Voice ID Service Quotas and try your request again.
  • *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • ConflictException The request failed due to a conflict. Check the ConflictType and error * message for more details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.OptOutSpeaker * @see AWS API * Documentation */ @Override public CompletableFuture optOutSpeaker(OptOutSpeakerRequest optOutSpeakerRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(optOutSpeakerRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, optOutSpeakerRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "OptOutSpeaker"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, OptOutSpeakerResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("OptOutSpeaker").withProtocolMetadata(protocolMetadata) .withMarshaller(new OptOutSpeakerRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(optOutSpeakerRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Starts a new batch fraudster registration job using provided details. *

* * @param startFraudsterRegistrationJobRequest * @return A Java Future containing the result of the StartFraudsterRegistrationJob operation returned by the * service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ServiceQuotaExceededException The request exceeded the service quota. Refer to Voice ID Service Quotas and try your request again.
  • *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • ConflictException The request failed due to a conflict. Check the ConflictType and error * message for more details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.StartFraudsterRegistrationJob * @see AWS API Documentation */ @Override public CompletableFuture startFraudsterRegistrationJob( StartFraudsterRegistrationJobRequest startFraudsterRegistrationJobRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(startFraudsterRegistrationJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, startFraudsterRegistrationJobRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartFraudsterRegistrationJob"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StartFraudsterRegistrationJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("StartFraudsterRegistrationJob").withProtocolMetadata(protocolMetadata) .withMarshaller(new StartFraudsterRegistrationJobRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(startFraudsterRegistrationJobRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Starts a new batch speaker enrollment job using specified details. *

* * @param startSpeakerEnrollmentJobRequest * @return A Java Future containing the result of the StartSpeakerEnrollmentJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ServiceQuotaExceededException The request exceeded the service quota. Refer to Voice ID Service Quotas and try your request again.
  • *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • ConflictException The request failed due to a conflict. Check the ConflictType and error * message for more details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.StartSpeakerEnrollmentJob * @see AWS API Documentation */ @Override public CompletableFuture startSpeakerEnrollmentJob( StartSpeakerEnrollmentJobRequest startSpeakerEnrollmentJobRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(startSpeakerEnrollmentJobRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, startSpeakerEnrollmentJobRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartSpeakerEnrollmentJob"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StartSpeakerEnrollmentJobResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("StartSpeakerEnrollmentJob").withProtocolMetadata(protocolMetadata) .withMarshaller(new StartSpeakerEnrollmentJobRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(startSpeakerEnrollmentJobRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Tags a Voice ID resource with the provided list of tags. *

* * @param tagResourceRequest * @return A Java Future containing the result of the TagResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • ConflictException The request failed due to a conflict. Check the ConflictType and error * message for more details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.TagResource * @see AWS API * Documentation */ @Override public CompletableFuture tagResource(TagResourceRequest tagResourceRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(tagResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, tagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, TagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("TagResource").withProtocolMetadata(protocolMetadata) .withMarshaller(new TagResourceRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(tagResourceRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Removes specified tags from a specified Amazon Connect Voice ID resource. *

* * @param untagResourceRequest * @return A Java Future containing the result of the UntagResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • ConflictException The request failed due to a conflict. Check the ConflictType and error * message for more details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.UntagResource * @see AWS API * Documentation */ @Override public CompletableFuture untagResource(UntagResourceRequest untagResourceRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(untagResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, untagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UntagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UntagResource").withProtocolMetadata(protocolMetadata) .withMarshaller(new UntagResourceRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(untagResourceRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Updates the specified domain. This API has clobber behavior, and clears and replaces all attributes. If an * optional field, such as 'Description' is not provided, it is removed from the domain. *

* * @param updateDomainRequest * @return A Java Future containing the result of the UpdateDomain operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • ConflictException The request failed due to a conflict. Check the ConflictType and error * message for more details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.UpdateDomain * @see AWS API * Documentation */ @Override public CompletableFuture updateDomain(UpdateDomainRequest updateDomainRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateDomainRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateDomainRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateDomain"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UpdateDomainResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateDomain").withProtocolMetadata(protocolMetadata) .withMarshaller(new UpdateDomainRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(updateDomainRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Updates the specified watchlist. Every domain has a default watchlist which cannot be updated. *

* * @param updateWatchlistRequest * @return A Java Future containing the result of the UpdateWatchlist operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The specified resource cannot be found. Check the ResourceType * and error message for more details.
  • *
  • ValidationException The request failed one or more validations; check the error message for more * details.
  • *
  • ConflictException The request failed due to a conflict. Check the ConflictType and error * message for more details.
  • *
  • InternalServerException The request failed due to an unknown error on the server side.
  • *
  • ThrottlingException The request was denied due to request throttling. Please slow down your request * rate. Refer to Amazon Connect Voice ID Service API throttling quotas and try your request again.
  • *
  • AccessDeniedException You do not have sufficient permissions to perform this action. Check the error * message and try again.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • VoiceIdException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample VoiceIdAsyncClient.UpdateWatchlist * @see AWS API * Documentation */ @Override public CompletableFuture updateWatchlist(UpdateWatchlistRequest updateWatchlistRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateWatchlistRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateWatchlistRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Voice ID"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateWatchlist"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateWatchlistResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateWatchlist").withProtocolMetadata(protocolMetadata) .withMarshaller(new UpdateWatchlistRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(updateWatchlistRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } @Override public final VoiceIdServiceClientConfiguration serviceClientConfiguration() { return new VoiceIdServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build(); } @Override public final String serviceName() { return SERVICE_NAME; } private > T init(T builder) { return builder .clientConfiguration(clientConfiguration) .defaultServiceExceptionSupplier(VoiceIdException::builder) .protocol(AwsJsonProtocol.AWS_JSON) .protocolVersion("1.0") .registerModeledException( ExceptionMetadata.builder().errorCode("ThrottlingException") .exceptionBuilderSupplier(ThrottlingException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ServiceQuotaExceededException") .exceptionBuilderSupplier(ServiceQuotaExceededException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InternalServerException") .exceptionBuilderSupplier(InternalServerException::builder).httpStatusCode(500).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("AccessDeniedException") .exceptionBuilderSupplier(AccessDeniedException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ConflictException") .exceptionBuilderSupplier(ConflictException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ResourceNotFoundException") .exceptionBuilderSupplier(ResourceNotFoundException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ValidationException") .exceptionBuilderSupplier(ValidationException::builder).httpStatusCode(400).build()); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); } if (publishers == null || publishers.isEmpty()) { publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS); } if (publishers == null) { publishers = Collections.emptyList(); } return publishers; } private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { ClientOverrideConfiguration.Builder builder = configuration.asOverrideConfigurationBuilder(); RetryMode retryMode = builder.retryMode(); if (retryMode != null) { configuration.option(SdkClientOption.RETRY_STRATEGY, AwsRetryStrategy.forRetryMode(retryMode)); } else { Consumer> configurator = builder.retryStrategyConfigurator(); if (configurator != null) { RetryStrategy.Builder defaultBuilder = AwsRetryStrategy.defaultRetryStrategy().toBuilder(); configurator.accept(defaultBuilder); configuration.option(SdkClientOption.RETRY_STRATEGY, defaultBuilder.build()); } else { RetryStrategy retryStrategy = builder.retryStrategy(); if (retryStrategy != null) { configuration.option(SdkClientOption.RETRY_STRATEGY, retryStrategy); } } } configuration.option(SdkClientOption.CONFIGURED_RETRY_MODE, null); configuration.option(SdkClientOption.CONFIGURED_RETRY_STRATEGY, null); configuration.option(SdkClientOption.CONFIGURED_RETRY_CONFIGURATOR, null); } private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, SdkClientConfiguration clientConfiguration) { List plugins = request.overrideConfiguration().map(c -> c.plugins()).orElse(Collections.emptyList()); SdkClientConfiguration.Builder configuration = clientConfiguration.toBuilder(); if (plugins.isEmpty()) { return configuration.build(); } VoiceIdServiceClientConfigurationBuilder serviceConfigBuilder = new VoiceIdServiceClientConfigurationBuilder( configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } updateRetryStrategyClientConfiguration(configuration); return configuration.build(); } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata) { return protocolFactory.createErrorResponseHandler(operationMetadata); } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } @Override public void close() { clientHandler.close(); } }




© 2015 - 2026 Weber Informatics LLC | Privacy Policy