com.amazonaws.services.cloud9.AWSCloud9AsyncClient Maven / Gradle / Ivy
Show all versions of aws-java-sdk-cloud9 Show documentation
/*
* 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.cloud9;
import javax.annotation.Generated;
import com.amazonaws.services.cloud9.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;
import java.util.concurrent.ExecutorService;
/**
* Client for accessing AWS Cloud9 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.
*
* Cloud9
*
* Cloud9 is a collection of tools that you can use to code, build, run, test, debug, and release software in the cloud.
*
*
* For more information about Cloud9, see the Cloud9 User
* Guide.
*
*
* Cloud9 supports these operations:
*
*
* -
*
* CreateEnvironmentEC2
: Creates an Cloud9 development environment, launches an Amazon EC2 instance, and
* then connects from the instance to the environment.
*
*
* -
*
* CreateEnvironmentMembership
: Adds an environment member to an environment.
*
*
* -
*
* DeleteEnvironment
: Deletes an environment. If an Amazon EC2 instance is connected to the environment,
* also terminates the instance.
*
*
* -
*
* DeleteEnvironmentMembership
: Deletes an environment member from an environment.
*
*
* -
*
* DescribeEnvironmentMemberships
: Gets information about environment members for an environment.
*
*
* -
*
* DescribeEnvironments
: Gets information about environments.
*
*
* -
*
* DescribeEnvironmentStatus
: Gets status information for an environment.
*
*
* -
*
* ListEnvironments
: Gets a list of environment identifiers.
*
*
* -
*
* ListTagsForResource
: Gets the tags for an environment.
*
*
* -
*
* TagResource
: Adds tags to an environment.
*
*
* -
*
* UntagResource
: Removes tags from an environment.
*
*
* -
*
* UpdateEnvironment
: Changes the settings of an existing environment.
*
*
* -
*
* UpdateEnvironmentMembership
: Changes the settings of an existing environment member for an environment.
*
*
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSCloud9AsyncClient extends AWSCloud9Client implements AWSCloud9Async {
private static final int DEFAULT_THREAD_POOL_SIZE = 50;
private final java.util.concurrent.ExecutorService executorService;
public static AWSCloud9AsyncClientBuilder asyncBuilder() {
return AWSCloud9AsyncClientBuilder.standard();
}
/**
* Constructs a new asynchronous client to invoke service methods on AWS Cloud9 using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
*/
AWSCloud9AsyncClient(AwsAsyncClientParams asyncClientParams) {
this(asyncClientParams, false);
}
/**
* Constructs a new asynchronous client to invoke service methods on AWS Cloud9 using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
* @param endpointDiscoveryEnabled
* true will enable endpoint discovery if the service supports it.
*/
AWSCloud9AsyncClient(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 createEnvironmentEC2Async(CreateEnvironmentEC2Request request) {
return createEnvironmentEC2Async(request, null);
}
@Override
public java.util.concurrent.Future createEnvironmentEC2Async(final CreateEnvironmentEC2Request request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateEnvironmentEC2Request finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateEnvironmentEC2Result call() throws Exception {
CreateEnvironmentEC2Result result = null;
try {
result = executeCreateEnvironmentEC2(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 createEnvironmentMembershipAsync(CreateEnvironmentMembershipRequest request) {
return createEnvironmentMembershipAsync(request, null);
}
@Override
public java.util.concurrent.Future createEnvironmentMembershipAsync(final CreateEnvironmentMembershipRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateEnvironmentMembershipRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateEnvironmentMembershipResult call() throws Exception {
CreateEnvironmentMembershipResult result = null;
try {
result = executeCreateEnvironmentMembership(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 deleteEnvironmentAsync(DeleteEnvironmentRequest request) {
return deleteEnvironmentAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteEnvironmentAsync(final DeleteEnvironmentRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteEnvironmentRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteEnvironmentResult call() throws Exception {
DeleteEnvironmentResult result = null;
try {
result = executeDeleteEnvironment(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 deleteEnvironmentMembershipAsync(DeleteEnvironmentMembershipRequest request) {
return deleteEnvironmentMembershipAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteEnvironmentMembershipAsync(final DeleteEnvironmentMembershipRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteEnvironmentMembershipRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteEnvironmentMembershipResult call() throws Exception {
DeleteEnvironmentMembershipResult result = null;
try {
result = executeDeleteEnvironmentMembership(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 describeEnvironmentMembershipsAsync(DescribeEnvironmentMembershipsRequest request) {
return describeEnvironmentMembershipsAsync(request, null);
}
@Override
public java.util.concurrent.Future describeEnvironmentMembershipsAsync(
final DescribeEnvironmentMembershipsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeEnvironmentMembershipsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeEnvironmentMembershipsResult call() throws Exception {
DescribeEnvironmentMembershipsResult result = null;
try {
result = executeDescribeEnvironmentMemberships(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 describeEnvironmentStatusAsync(DescribeEnvironmentStatusRequest request) {
return describeEnvironmentStatusAsync(request, null);
}
@Override
public java.util.concurrent.Future describeEnvironmentStatusAsync(final DescribeEnvironmentStatusRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeEnvironmentStatusRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeEnvironmentStatusResult call() throws Exception {
DescribeEnvironmentStatusResult result = null;
try {
result = executeDescribeEnvironmentStatus(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 describeEnvironmentsAsync(DescribeEnvironmentsRequest request) {
return describeEnvironmentsAsync(request, null);
}
@Override
public java.util.concurrent.Future describeEnvironmentsAsync(final DescribeEnvironmentsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeEnvironmentsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeEnvironmentsResult call() throws Exception {
DescribeEnvironmentsResult result = null;
try {
result = executeDescribeEnvironments(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 listEnvironmentsAsync(ListEnvironmentsRequest request) {
return listEnvironmentsAsync(request, null);
}
@Override
public java.util.concurrent.Future listEnvironmentsAsync(final ListEnvironmentsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListEnvironmentsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListEnvironmentsResult call() throws Exception {
ListEnvironmentsResult result = null;
try {
result = executeListEnvironments(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 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 updateEnvironmentAsync(UpdateEnvironmentRequest request) {
return updateEnvironmentAsync(request, null);
}
@Override
public java.util.concurrent.Future updateEnvironmentAsync(final UpdateEnvironmentRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateEnvironmentRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateEnvironmentResult call() throws Exception {
UpdateEnvironmentResult result = null;
try {
result = executeUpdateEnvironment(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 updateEnvironmentMembershipAsync(UpdateEnvironmentMembershipRequest request) {
return updateEnvironmentMembershipAsync(request, null);
}
@Override
public java.util.concurrent.Future updateEnvironmentMembershipAsync(final UpdateEnvironmentMembershipRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateEnvironmentMembershipRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateEnvironmentMembershipResult call() throws Exception {
UpdateEnvironmentMembershipResult result = null;
try {
result = executeUpdateEnvironmentMembership(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();
}
}