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

com.amazonaws.services.fis.AWSFISAsyncClient Maven / Gradle / Ivy

Go to download

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

There is a newer version: 1.12.772
Show newest version
/*
 * Copyright 2016-2021 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.
 * 

*

* AWS Fault Injection Simulator is a managed service that enables you to perform fault injection experiments on your * AWS workloads. For more information, see the AWS Fault * Injection Simulator 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 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 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 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 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 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 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; } }); } /** * 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(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy