com.amazonaws.services.launchwizard.AWSLaunchWizardAsyncClient Maven / Gradle / Ivy
/*
* 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.launchwizard;
import javax.annotation.Generated;
import com.amazonaws.services.launchwizard.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;
import java.util.concurrent.ExecutorService;
/**
* Client for accessing AWS Launch Wizard 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.
*
*
* Launch Wizard offers a guided way of sizing, configuring, and deploying Amazon Web Services resources for third party
* applications, such as Microsoft SQL Server Always On and HANA based SAP systems, without the need to manually
* identify and provision individual Amazon Web Services resources.
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSLaunchWizardAsyncClient extends AWSLaunchWizardClient implements AWSLaunchWizardAsync {
private static final int DEFAULT_THREAD_POOL_SIZE = 50;
private final java.util.concurrent.ExecutorService executorService;
public static AWSLaunchWizardAsyncClientBuilder asyncBuilder() {
return AWSLaunchWizardAsyncClientBuilder.standard();
}
/**
* Constructs a new asynchronous client to invoke service methods on AWS Launch Wizard using the specified
* parameters.
*
* @param asyncClientParams
* Object providing client parameters.
*/
AWSLaunchWizardAsyncClient(AwsAsyncClientParams asyncClientParams) {
this(asyncClientParams, false);
}
/**
* Constructs a new asynchronous client to invoke service methods on AWS Launch Wizard using the specified
* parameters.
*
* @param asyncClientParams
* Object providing client parameters.
* @param endpointDiscoveryEnabled
* true will enable endpoint discovery if the service supports it.
*/
AWSLaunchWizardAsyncClient(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 createDeploymentAsync(CreateDeploymentRequest request) {
return createDeploymentAsync(request, null);
}
@Override
public java.util.concurrent.Future createDeploymentAsync(final CreateDeploymentRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateDeploymentRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateDeploymentResult call() throws Exception {
CreateDeploymentResult result = null;
try {
result = executeCreateDeployment(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 deleteDeploymentAsync(DeleteDeploymentRequest request) {
return deleteDeploymentAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteDeploymentAsync(final DeleteDeploymentRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteDeploymentRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteDeploymentResult call() throws Exception {
DeleteDeploymentResult result = null;
try {
result = executeDeleteDeployment(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 getDeploymentAsync(GetDeploymentRequest request) {
return getDeploymentAsync(request, null);
}
@Override
public java.util.concurrent.Future getDeploymentAsync(final GetDeploymentRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetDeploymentRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetDeploymentResult call() throws Exception {
GetDeploymentResult result = null;
try {
result = executeGetDeployment(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 getWorkloadAsync(GetWorkloadRequest request) {
return getWorkloadAsync(request, null);
}
@Override
public java.util.concurrent.Future getWorkloadAsync(final GetWorkloadRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetWorkloadRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetWorkloadResult call() throws Exception {
GetWorkloadResult result = null;
try {
result = executeGetWorkload(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 getWorkloadDeploymentPatternAsync(GetWorkloadDeploymentPatternRequest request) {
return getWorkloadDeploymentPatternAsync(request, null);
}
@Override
public java.util.concurrent.Future getWorkloadDeploymentPatternAsync(final GetWorkloadDeploymentPatternRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetWorkloadDeploymentPatternRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetWorkloadDeploymentPatternResult call() throws Exception {
GetWorkloadDeploymentPatternResult result = null;
try {
result = executeGetWorkloadDeploymentPattern(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 listDeploymentEventsAsync(ListDeploymentEventsRequest request) {
return listDeploymentEventsAsync(request, null);
}
@Override
public java.util.concurrent.Future listDeploymentEventsAsync(final ListDeploymentEventsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListDeploymentEventsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListDeploymentEventsResult call() throws Exception {
ListDeploymentEventsResult result = null;
try {
result = executeListDeploymentEvents(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 listDeploymentsAsync(ListDeploymentsRequest request) {
return listDeploymentsAsync(request, null);
}
@Override
public java.util.concurrent.Future listDeploymentsAsync(final ListDeploymentsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListDeploymentsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListDeploymentsResult call() throws Exception {
ListDeploymentsResult result = null;
try {
result = executeListDeployments(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 listWorkloadDeploymentPatternsAsync(ListWorkloadDeploymentPatternsRequest request) {
return listWorkloadDeploymentPatternsAsync(request, null);
}
@Override
public java.util.concurrent.Future listWorkloadDeploymentPatternsAsync(
final ListWorkloadDeploymentPatternsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListWorkloadDeploymentPatternsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListWorkloadDeploymentPatternsResult call() throws Exception {
ListWorkloadDeploymentPatternsResult result = null;
try {
result = executeListWorkloadDeploymentPatterns(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 listWorkloadsAsync(ListWorkloadsRequest request) {
return listWorkloadsAsync(request, null);
}
@Override
public java.util.concurrent.Future listWorkloadsAsync(final ListWorkloadsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListWorkloadsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListWorkloadsResult call() throws Exception {
ListWorkloadsResult result = null;
try {
result = executeListWorkloads(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;
}
});
}
/**
* 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 - 2025 Weber Informatics LLC | Privacy Policy