com.amazonaws.services.fis.AWSFISAsyncClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aws-java-sdk-fis Show documentation
Show all versions of aws-java-sdk-fis Show documentation
The AWS Java SDK for AWS Fault Injection Simulator module holds the client classes that are used for communicating with AWS Fault Injection Simulator 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.fis;
import javax.annotation.Generated;
import com.amazonaws.services.fis.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;
import java.util.concurrent.ExecutorService;
/**
* Client for accessing FIS 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.
*
*
* Fault Injection Service is a managed service that enables you to perform fault injection experiments on your Amazon
* Web Services workloads. For more information, see the Fault Injection Service User Guide.
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSFISAsyncClient extends AWSFISClient implements AWSFISAsync {
private static final int DEFAULT_THREAD_POOL_SIZE = 50;
private final java.util.concurrent.ExecutorService executorService;
public static AWSFISAsyncClientBuilder asyncBuilder() {
return AWSFISAsyncClientBuilder.standard();
}
/**
* Constructs a new asynchronous client to invoke service methods on FIS using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
*/
AWSFISAsyncClient(AwsAsyncClientParams asyncClientParams) {
this(asyncClientParams, false);
}
/**
* Constructs a new asynchronous client to invoke service methods on FIS using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
* @param endpointDiscoveryEnabled
* true will enable endpoint discovery if the service supports it.
*/
AWSFISAsyncClient(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 createExperimentTemplateAsync(CreateExperimentTemplateRequest request) {
return createExperimentTemplateAsync(request, null);
}
@Override
public java.util.concurrent.Future createExperimentTemplateAsync(final CreateExperimentTemplateRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateExperimentTemplateRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateExperimentTemplateResult call() throws Exception {
CreateExperimentTemplateResult result = null;
try {
result = executeCreateExperimentTemplate(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 createTargetAccountConfigurationAsync(
CreateTargetAccountConfigurationRequest request) {
return createTargetAccountConfigurationAsync(request, null);
}
@Override
public java.util.concurrent.Future createTargetAccountConfigurationAsync(
final CreateTargetAccountConfigurationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateTargetAccountConfigurationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateTargetAccountConfigurationResult call() throws Exception {
CreateTargetAccountConfigurationResult result = null;
try {
result = executeCreateTargetAccountConfiguration(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 deleteExperimentTemplateAsync(DeleteExperimentTemplateRequest request) {
return deleteExperimentTemplateAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteExperimentTemplateAsync(final DeleteExperimentTemplateRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteExperimentTemplateRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteExperimentTemplateResult call() throws Exception {
DeleteExperimentTemplateResult result = null;
try {
result = executeDeleteExperimentTemplate(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 deleteTargetAccountConfigurationAsync(
DeleteTargetAccountConfigurationRequest request) {
return deleteTargetAccountConfigurationAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteTargetAccountConfigurationAsync(
final DeleteTargetAccountConfigurationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteTargetAccountConfigurationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteTargetAccountConfigurationResult call() throws Exception {
DeleteTargetAccountConfigurationResult result = null;
try {
result = executeDeleteTargetAccountConfiguration(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 getActionAsync(GetActionRequest request) {
return getActionAsync(request, null);
}
@Override
public java.util.concurrent.Future getActionAsync(final GetActionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetActionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetActionResult call() throws Exception {
GetActionResult result = null;
try {
result = executeGetAction(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 getExperimentAsync(GetExperimentRequest request) {
return getExperimentAsync(request, null);
}
@Override
public java.util.concurrent.Future getExperimentAsync(final GetExperimentRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetExperimentRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetExperimentResult call() throws Exception {
GetExperimentResult result = null;
try {
result = executeGetExperiment(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 getExperimentTargetAccountConfigurationAsync(
GetExperimentTargetAccountConfigurationRequest request) {
return getExperimentTargetAccountConfigurationAsync(request, null);
}
@Override
public java.util.concurrent.Future getExperimentTargetAccountConfigurationAsync(
final GetExperimentTargetAccountConfigurationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetExperimentTargetAccountConfigurationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetExperimentTargetAccountConfigurationResult call() throws Exception {
GetExperimentTargetAccountConfigurationResult result = null;
try {
result = executeGetExperimentTargetAccountConfiguration(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 getExperimentTemplateAsync(GetExperimentTemplateRequest request) {
return getExperimentTemplateAsync(request, null);
}
@Override
public java.util.concurrent.Future getExperimentTemplateAsync(final GetExperimentTemplateRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetExperimentTemplateRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetExperimentTemplateResult call() throws Exception {
GetExperimentTemplateResult result = null;
try {
result = executeGetExperimentTemplate(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 getTargetAccountConfigurationAsync(GetTargetAccountConfigurationRequest request) {
return getTargetAccountConfigurationAsync(request, null);
}
@Override
public java.util.concurrent.Future getTargetAccountConfigurationAsync(
final GetTargetAccountConfigurationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetTargetAccountConfigurationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetTargetAccountConfigurationResult call() throws Exception {
GetTargetAccountConfigurationResult result = null;
try {
result = executeGetTargetAccountConfiguration(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 getTargetResourceTypeAsync(GetTargetResourceTypeRequest request) {
return getTargetResourceTypeAsync(request, null);
}
@Override
public java.util.concurrent.Future getTargetResourceTypeAsync(final GetTargetResourceTypeRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetTargetResourceTypeRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetTargetResourceTypeResult call() throws Exception {
GetTargetResourceTypeResult result = null;
try {
result = executeGetTargetResourceType(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 listActionsAsync(ListActionsRequest request) {
return listActionsAsync(request, null);
}
@Override
public java.util.concurrent.Future listActionsAsync(final ListActionsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListActionsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListActionsResult call() throws Exception {
ListActionsResult result = null;
try {
result = executeListActions(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 listExperimentResolvedTargetsAsync(ListExperimentResolvedTargetsRequest request) {
return listExperimentResolvedTargetsAsync(request, null);
}
@Override
public java.util.concurrent.Future listExperimentResolvedTargetsAsync(
final ListExperimentResolvedTargetsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListExperimentResolvedTargetsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListExperimentResolvedTargetsResult call() throws Exception {
ListExperimentResolvedTargetsResult result = null;
try {
result = executeListExperimentResolvedTargets(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 listExperimentTargetAccountConfigurationsAsync(
ListExperimentTargetAccountConfigurationsRequest request) {
return listExperimentTargetAccountConfigurationsAsync(request, null);
}
@Override
public java.util.concurrent.Future listExperimentTargetAccountConfigurationsAsync(
final ListExperimentTargetAccountConfigurationsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListExperimentTargetAccountConfigurationsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListExperimentTargetAccountConfigurationsResult call() throws Exception {
ListExperimentTargetAccountConfigurationsResult result = null;
try {
result = executeListExperimentTargetAccountConfigurations(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 listExperimentTemplatesAsync(ListExperimentTemplatesRequest request) {
return listExperimentTemplatesAsync(request, null);
}
@Override
public java.util.concurrent.Future listExperimentTemplatesAsync(final ListExperimentTemplatesRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListExperimentTemplatesRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListExperimentTemplatesResult call() throws Exception {
ListExperimentTemplatesResult result = null;
try {
result = executeListExperimentTemplates(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 listExperimentsAsync(ListExperimentsRequest request) {
return listExperimentsAsync(request, null);
}
@Override
public java.util.concurrent.Future listExperimentsAsync(final ListExperimentsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListExperimentsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListExperimentsResult call() throws Exception {
ListExperimentsResult result = null;
try {
result = executeListExperiments(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 listTargetAccountConfigurationsAsync(
ListTargetAccountConfigurationsRequest request) {
return listTargetAccountConfigurationsAsync(request, null);
}
@Override
public java.util.concurrent.Future listTargetAccountConfigurationsAsync(
final ListTargetAccountConfigurationsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListTargetAccountConfigurationsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListTargetAccountConfigurationsResult call() throws Exception {
ListTargetAccountConfigurationsResult result = null;
try {
result = executeListTargetAccountConfigurations(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 listTargetResourceTypesAsync(ListTargetResourceTypesRequest request) {
return listTargetResourceTypesAsync(request, null);
}
@Override
public java.util.concurrent.Future listTargetResourceTypesAsync(final ListTargetResourceTypesRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListTargetResourceTypesRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListTargetResourceTypesResult call() throws Exception {
ListTargetResourceTypesResult result = null;
try {
result = executeListTargetResourceTypes(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 startExperimentAsync(StartExperimentRequest request) {
return startExperimentAsync(request, null);
}
@Override
public java.util.concurrent.Future startExperimentAsync(final StartExperimentRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final StartExperimentRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public StartExperimentResult call() throws Exception {
StartExperimentResult result = null;
try {
result = executeStartExperiment(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 stopExperimentAsync(StopExperimentRequest request) {
return stopExperimentAsync(request, null);
}
@Override
public java.util.concurrent.Future stopExperimentAsync(final StopExperimentRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final StopExperimentRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public StopExperimentResult call() throws Exception {
StopExperimentResult result = null;
try {
result = executeStopExperiment(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 updateExperimentTemplateAsync(UpdateExperimentTemplateRequest request) {
return updateExperimentTemplateAsync(request, null);
}
@Override
public java.util.concurrent.Future updateExperimentTemplateAsync(final UpdateExperimentTemplateRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateExperimentTemplateRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateExperimentTemplateResult call() throws Exception {
UpdateExperimentTemplateResult result = null;
try {
result = executeUpdateExperimentTemplate(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 updateTargetAccountConfigurationAsync(
UpdateTargetAccountConfigurationRequest request) {
return updateTargetAccountConfigurationAsync(request, null);
}
@Override
public java.util.concurrent.Future updateTargetAccountConfigurationAsync(
final UpdateTargetAccountConfigurationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateTargetAccountConfigurationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateTargetAccountConfigurationResult call() throws Exception {
UpdateTargetAccountConfigurationResult result = null;
try {
result = executeUpdateTargetAccountConfiguration(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();
}
}