com.amazonaws.services.connectcampaign.AmazonConnectCampaignAsyncClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aws-java-sdk-connectcampaign Show documentation
Show all versions of aws-java-sdk-connectcampaign Show documentation
The AWS Java SDK for AmazonConnectCampaign module holds the client classes that are used for communicating with AmazonConnectCampaign Service
/*
* Copyright 2019-2024 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 com.amazonaws.services.connectcampaign;
import javax.annotation.Generated;
import com.amazonaws.services.connectcampaign.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;
import java.util.concurrent.ExecutorService;
/**
* Client for accessing AmazonConnectCampaignService asynchronously. Each asynchronous method will return a Java Future
* object representing the asynchronous operation; overloads which accept an {@code AsyncHandler} can be used to receive
* notification when an asynchronous operation completes.
*
*
* Provide APIs to create and manage Amazon Connect Campaigns.
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AmazonConnectCampaignAsyncClient extends AmazonConnectCampaignClient implements AmazonConnectCampaignAsync {
private static final int DEFAULT_THREAD_POOL_SIZE = 50;
private final java.util.concurrent.ExecutorService executorService;
public static AmazonConnectCampaignAsyncClientBuilder asyncBuilder() {
return AmazonConnectCampaignAsyncClientBuilder.standard();
}
/**
* Constructs a new asynchronous client to invoke service methods on AmazonConnectCampaignService using the
* specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
*/
AmazonConnectCampaignAsyncClient(AwsAsyncClientParams asyncClientParams) {
this(asyncClientParams, false);
}
/**
* Constructs a new asynchronous client to invoke service methods on AmazonConnectCampaignService using the
* specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
* @param endpointDiscoveryEnabled
* true will enable endpoint discovery if the service supports it.
*/
AmazonConnectCampaignAsyncClient(AwsAsyncClientParams asyncClientParams, boolean endpointDiscoveryEnabled) {
super(asyncClientParams, endpointDiscoveryEnabled);
this.executorService = asyncClientParams.getExecutor();
}
/**
* Returns the executor service used by this client to execute async requests.
*
* @return The executor service used by this client to execute async requests.
*/
public ExecutorService getExecutorService() {
return executorService;
}
@Override
public java.util.concurrent.Future createCampaignAsync(CreateCampaignRequest request) {
return createCampaignAsync(request, null);
}
@Override
public java.util.concurrent.Future createCampaignAsync(final CreateCampaignRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateCampaignRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateCampaignResult call() throws Exception {
CreateCampaignResult result = null;
try {
result = executeCreateCampaign(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future deleteCampaignAsync(DeleteCampaignRequest request) {
return deleteCampaignAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteCampaignAsync(final DeleteCampaignRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteCampaignRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteCampaignResult call() throws Exception {
DeleteCampaignResult result = null;
try {
result = executeDeleteCampaign(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future deleteConnectInstanceConfigAsync(DeleteConnectInstanceConfigRequest request) {
return deleteConnectInstanceConfigAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteConnectInstanceConfigAsync(final DeleteConnectInstanceConfigRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteConnectInstanceConfigRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteConnectInstanceConfigResult call() throws Exception {
DeleteConnectInstanceConfigResult result = null;
try {
result = executeDeleteConnectInstanceConfig(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future deleteInstanceOnboardingJobAsync(DeleteInstanceOnboardingJobRequest request) {
return deleteInstanceOnboardingJobAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteInstanceOnboardingJobAsync(final DeleteInstanceOnboardingJobRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteInstanceOnboardingJobRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteInstanceOnboardingJobResult call() throws Exception {
DeleteInstanceOnboardingJobResult result = null;
try {
result = executeDeleteInstanceOnboardingJob(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future describeCampaignAsync(DescribeCampaignRequest request) {
return describeCampaignAsync(request, null);
}
@Override
public java.util.concurrent.Future describeCampaignAsync(final DescribeCampaignRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeCampaignRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeCampaignResult call() throws Exception {
DescribeCampaignResult result = null;
try {
result = executeDescribeCampaign(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future getCampaignStateAsync(GetCampaignStateRequest request) {
return getCampaignStateAsync(request, null);
}
@Override
public java.util.concurrent.Future getCampaignStateAsync(final GetCampaignStateRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetCampaignStateRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetCampaignStateResult call() throws Exception {
GetCampaignStateResult result = null;
try {
result = executeGetCampaignState(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future getCampaignStateBatchAsync(GetCampaignStateBatchRequest request) {
return getCampaignStateBatchAsync(request, null);
}
@Override
public java.util.concurrent.Future getCampaignStateBatchAsync(final GetCampaignStateBatchRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetCampaignStateBatchRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetCampaignStateBatchResult call() throws Exception {
GetCampaignStateBatchResult result = null;
try {
result = executeGetCampaignStateBatch(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future getConnectInstanceConfigAsync(GetConnectInstanceConfigRequest request) {
return getConnectInstanceConfigAsync(request, null);
}
@Override
public java.util.concurrent.Future getConnectInstanceConfigAsync(final GetConnectInstanceConfigRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetConnectInstanceConfigRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetConnectInstanceConfigResult call() throws Exception {
GetConnectInstanceConfigResult result = null;
try {
result = executeGetConnectInstanceConfig(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future getInstanceOnboardingJobStatusAsync(GetInstanceOnboardingJobStatusRequest request) {
return getInstanceOnboardingJobStatusAsync(request, null);
}
@Override
public java.util.concurrent.Future getInstanceOnboardingJobStatusAsync(
final GetInstanceOnboardingJobStatusRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetInstanceOnboardingJobStatusRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetInstanceOnboardingJobStatusResult call() throws Exception {
GetInstanceOnboardingJobStatusResult result = null;
try {
result = executeGetInstanceOnboardingJobStatus(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future listCampaignsAsync(ListCampaignsRequest request) {
return listCampaignsAsync(request, null);
}
@Override
public java.util.concurrent.Future listCampaignsAsync(final ListCampaignsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListCampaignsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListCampaignsResult call() throws Exception {
ListCampaignsResult result = null;
try {
result = executeListCampaigns(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future listTagsForResourceAsync(ListTagsForResourceRequest request) {
return listTagsForResourceAsync(request, null);
}
@Override
public java.util.concurrent.Future listTagsForResourceAsync(final ListTagsForResourceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListTagsForResourceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListTagsForResourceResult call() throws Exception {
ListTagsForResourceResult result = null;
try {
result = executeListTagsForResource(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future pauseCampaignAsync(PauseCampaignRequest request) {
return pauseCampaignAsync(request, null);
}
@Override
public java.util.concurrent.Future pauseCampaignAsync(final PauseCampaignRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final PauseCampaignRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public PauseCampaignResult call() throws Exception {
PauseCampaignResult result = null;
try {
result = executePauseCampaign(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future putDialRequestBatchAsync(PutDialRequestBatchRequest request) {
return putDialRequestBatchAsync(request, null);
}
@Override
public java.util.concurrent.Future putDialRequestBatchAsync(final PutDialRequestBatchRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final PutDialRequestBatchRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public PutDialRequestBatchResult call() throws Exception {
PutDialRequestBatchResult result = null;
try {
result = executePutDialRequestBatch(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future resumeCampaignAsync(ResumeCampaignRequest request) {
return resumeCampaignAsync(request, null);
}
@Override
public java.util.concurrent.Future resumeCampaignAsync(final ResumeCampaignRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ResumeCampaignRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ResumeCampaignResult call() throws Exception {
ResumeCampaignResult result = null;
try {
result = executeResumeCampaign(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future startCampaignAsync(StartCampaignRequest request) {
return startCampaignAsync(request, null);
}
@Override
public java.util.concurrent.Future startCampaignAsync(final StartCampaignRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final StartCampaignRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public StartCampaignResult call() throws Exception {
StartCampaignResult result = null;
try {
result = executeStartCampaign(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future startInstanceOnboardingJobAsync(StartInstanceOnboardingJobRequest request) {
return startInstanceOnboardingJobAsync(request, null);
}
@Override
public java.util.concurrent.Future startInstanceOnboardingJobAsync(final StartInstanceOnboardingJobRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final StartInstanceOnboardingJobRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public StartInstanceOnboardingJobResult call() throws Exception {
StartInstanceOnboardingJobResult result = null;
try {
result = executeStartInstanceOnboardingJob(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future stopCampaignAsync(StopCampaignRequest request) {
return stopCampaignAsync(request, null);
}
@Override
public java.util.concurrent.Future stopCampaignAsync(final StopCampaignRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final StopCampaignRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public StopCampaignResult call() throws Exception {
StopCampaignResult result = null;
try {
result = executeStopCampaign(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future tagResourceAsync(TagResourceRequest request) {
return tagResourceAsync(request, null);
}
@Override
public java.util.concurrent.Future tagResourceAsync(final TagResourceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final TagResourceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public TagResourceResult call() throws Exception {
TagResourceResult result = null;
try {
result = executeTagResource(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future untagResourceAsync(UntagResourceRequest request) {
return untagResourceAsync(request, null);
}
@Override
public java.util.concurrent.Future untagResourceAsync(final UntagResourceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UntagResourceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UntagResourceResult call() throws Exception {
UntagResourceResult result = null;
try {
result = executeUntagResource(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future updateCampaignDialerConfigAsync(UpdateCampaignDialerConfigRequest request) {
return updateCampaignDialerConfigAsync(request, null);
}
@Override
public java.util.concurrent.Future updateCampaignDialerConfigAsync(final UpdateCampaignDialerConfigRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateCampaignDialerConfigRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateCampaignDialerConfigResult call() throws Exception {
UpdateCampaignDialerConfigResult result = null;
try {
result = executeUpdateCampaignDialerConfig(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future updateCampaignNameAsync(UpdateCampaignNameRequest request) {
return updateCampaignNameAsync(request, null);
}
@Override
public java.util.concurrent.Future updateCampaignNameAsync(final UpdateCampaignNameRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateCampaignNameRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateCampaignNameResult call() throws Exception {
UpdateCampaignNameResult result = null;
try {
result = executeUpdateCampaignName(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future updateCampaignOutboundCallConfigAsync(
UpdateCampaignOutboundCallConfigRequest request) {
return updateCampaignOutboundCallConfigAsync(request, null);
}
@Override
public java.util.concurrent.Future updateCampaignOutboundCallConfigAsync(
final UpdateCampaignOutboundCallConfigRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateCampaignOutboundCallConfigRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateCampaignOutboundCallConfigResult call() throws Exception {
UpdateCampaignOutboundCallConfigResult result = null;
try {
result = executeUpdateCampaignOutboundCallConfig(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
/**
* Shuts down the client, releasing all managed resources. This includes forcibly terminating all pending
* asynchronous service calls. Clients who wish to give pending asynchronous service calls time to complete should
* call {@code getExecutorService().shutdown()} followed by {@code getExecutorService().awaitTermination()} prior to
* calling this method.
*/
@Override
public void shutdown() {
super.shutdown();
executorService.shutdownNow();
}
}