com.amazonaws.services.resourceexplorer2.AWSResourceExplorer2AsyncClient Maven / Gradle / Ivy
Show all versions of aws-java-sdk-resourceexplorer2 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.resourceexplorer2;
import javax.annotation.Generated;
import com.amazonaws.services.resourceexplorer2.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;
import java.util.concurrent.ExecutorService;
/**
* Client for accessing AWS Resource Explorer 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.
*
*
* Amazon Web Services Resource Explorer is a resource search and discovery service. By using Resource Explorer, you can
* explore your resources using an internet search engine-like experience. Examples of resources include Amazon
* Relational Database Service (Amazon RDS) instances, Amazon Simple Storage Service (Amazon S3) buckets, or Amazon
* DynamoDB tables. You can search for your resources using resource metadata like names, tags, and IDs. Resource
* Explorer can search across all of the Amazon Web Services Regions in your account in which you turn the service on,
* to simplify your cross-Region workloads.
*
*
* Resource Explorer scans the resources in each of the Amazon Web Services Regions in your Amazon Web Services account
* in which you turn on Resource Explorer. Resource Explorer creates and maintains an index in each Region, with the details of that Region's resources.
*
*
* You can search
* across all of the indexed Regions in your account by designating one of your Amazon Web Services Regions to
* contain the aggregator index for the account. When you promote a
* local index in a Region to become the aggregator index for the account, Resource Explorer automatically
* replicates the index information from all local indexes in the other Regions to the aggregator index. Therefore, the
* Region with the aggregator index has a copy of all resource information for all Regions in the account where you
* turned on Resource Explorer. As a result, views in the aggregator index Region include resources from all of the
* indexed Regions in your account.
*
*
* For more information about Amazon Web Services Resource Explorer, including how to enable and configure the service,
* see the Amazon Web Services Resource
* Explorer User Guide.
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSResourceExplorer2AsyncClient extends AWSResourceExplorer2Client implements AWSResourceExplorer2Async {
private static final int DEFAULT_THREAD_POOL_SIZE = 50;
private final java.util.concurrent.ExecutorService executorService;
public static AWSResourceExplorer2AsyncClientBuilder asyncBuilder() {
return AWSResourceExplorer2AsyncClientBuilder.standard();
}
/**
* Constructs a new asynchronous client to invoke service methods on AWS Resource Explorer using the specified
* parameters.
*
* @param asyncClientParams
* Object providing client parameters.
*/
AWSResourceExplorer2AsyncClient(AwsAsyncClientParams asyncClientParams) {
this(asyncClientParams, false);
}
/**
* Constructs a new asynchronous client to invoke service methods on AWS Resource Explorer using the specified
* parameters.
*
* @param asyncClientParams
* Object providing client parameters.
* @param endpointDiscoveryEnabled
* true will enable endpoint discovery if the service supports it.
*/
AWSResourceExplorer2AsyncClient(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 associateDefaultViewAsync(AssociateDefaultViewRequest request) {
return associateDefaultViewAsync(request, null);
}
@Override
public java.util.concurrent.Future associateDefaultViewAsync(final AssociateDefaultViewRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final AssociateDefaultViewRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public AssociateDefaultViewResult call() throws Exception {
AssociateDefaultViewResult result = null;
try {
result = executeAssociateDefaultView(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 batchGetViewAsync(BatchGetViewRequest request) {
return batchGetViewAsync(request, null);
}
@Override
public java.util.concurrent.Future batchGetViewAsync(final BatchGetViewRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final BatchGetViewRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public BatchGetViewResult call() throws Exception {
BatchGetViewResult result = null;
try {
result = executeBatchGetView(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 createIndexAsync(CreateIndexRequest request) {
return createIndexAsync(request, null);
}
@Override
public java.util.concurrent.Future createIndexAsync(final CreateIndexRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateIndexRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateIndexResult call() throws Exception {
CreateIndexResult result = null;
try {
result = executeCreateIndex(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 createViewAsync(CreateViewRequest request) {
return createViewAsync(request, null);
}
@Override
public java.util.concurrent.Future createViewAsync(final CreateViewRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateViewRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateViewResult call() throws Exception {
CreateViewResult result = null;
try {
result = executeCreateView(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 deleteIndexAsync(DeleteIndexRequest request) {
return deleteIndexAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteIndexAsync(final DeleteIndexRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteIndexRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteIndexResult call() throws Exception {
DeleteIndexResult result = null;
try {
result = executeDeleteIndex(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 deleteViewAsync(DeleteViewRequest request) {
return deleteViewAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteViewAsync(final DeleteViewRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteViewRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteViewResult call() throws Exception {
DeleteViewResult result = null;
try {
result = executeDeleteView(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 disassociateDefaultViewAsync(DisassociateDefaultViewRequest request) {
return disassociateDefaultViewAsync(request, null);
}
@Override
public java.util.concurrent.Future disassociateDefaultViewAsync(final DisassociateDefaultViewRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DisassociateDefaultViewRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DisassociateDefaultViewResult call() throws Exception {
DisassociateDefaultViewResult result = null;
try {
result = executeDisassociateDefaultView(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 getAccountLevelServiceConfigurationAsync(
GetAccountLevelServiceConfigurationRequest request) {
return getAccountLevelServiceConfigurationAsync(request, null);
}
@Override
public java.util.concurrent.Future getAccountLevelServiceConfigurationAsync(
final GetAccountLevelServiceConfigurationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetAccountLevelServiceConfigurationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetAccountLevelServiceConfigurationResult call() throws Exception {
GetAccountLevelServiceConfigurationResult result = null;
try {
result = executeGetAccountLevelServiceConfiguration(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 getDefaultViewAsync(GetDefaultViewRequest request) {
return getDefaultViewAsync(request, null);
}
@Override
public java.util.concurrent.Future getDefaultViewAsync(final GetDefaultViewRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetDefaultViewRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetDefaultViewResult call() throws Exception {
GetDefaultViewResult result = null;
try {
result = executeGetDefaultView(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 getIndexAsync(GetIndexRequest request) {
return getIndexAsync(request, null);
}
@Override
public java.util.concurrent.Future getIndexAsync(final GetIndexRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetIndexRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetIndexResult call() throws Exception {
GetIndexResult result = null;
try {
result = executeGetIndex(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 getViewAsync(GetViewRequest request) {
return getViewAsync(request, null);
}
@Override
public java.util.concurrent.Future getViewAsync(final GetViewRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetViewRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetViewResult call() throws Exception {
GetViewResult result = null;
try {
result = executeGetView(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 listIndexesAsync(ListIndexesRequest request) {
return listIndexesAsync(request, null);
}
@Override
public java.util.concurrent.Future listIndexesAsync(final ListIndexesRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListIndexesRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListIndexesResult call() throws Exception {
ListIndexesResult result = null;
try {
result = executeListIndexes(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 listIndexesForMembersAsync(ListIndexesForMembersRequest request) {
return listIndexesForMembersAsync(request, null);
}
@Override
public java.util.concurrent.Future listIndexesForMembersAsync(final ListIndexesForMembersRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListIndexesForMembersRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListIndexesForMembersResult call() throws Exception {
ListIndexesForMembersResult result = null;
try {
result = executeListIndexesForMembers(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 listSupportedResourceTypesAsync(ListSupportedResourceTypesRequest request) {
return listSupportedResourceTypesAsync(request, null);
}
@Override
public java.util.concurrent.Future listSupportedResourceTypesAsync(final ListSupportedResourceTypesRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListSupportedResourceTypesRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListSupportedResourceTypesResult call() throws Exception {
ListSupportedResourceTypesResult result = null;
try {
result = executeListSupportedResourceTypes(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 listViewsAsync(ListViewsRequest request) {
return listViewsAsync(request, null);
}
@Override
public java.util.concurrent.Future listViewsAsync(final ListViewsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListViewsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListViewsResult call() throws Exception {
ListViewsResult result = null;
try {
result = executeListViews(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 searchAsync(SearchRequest request) {
return searchAsync(request, null);
}
@Override
public java.util.concurrent.Future searchAsync(final SearchRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final SearchRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public SearchResult call() throws Exception {
SearchResult result = null;
try {
result = executeSearch(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 updateIndexTypeAsync(UpdateIndexTypeRequest request) {
return updateIndexTypeAsync(request, null);
}
@Override
public java.util.concurrent.Future updateIndexTypeAsync(final UpdateIndexTypeRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateIndexTypeRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateIndexTypeResult call() throws Exception {
UpdateIndexTypeResult result = null;
try {
result = executeUpdateIndexType(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 updateViewAsync(UpdateViewRequest request) {
return updateViewAsync(request, null);
}
@Override
public java.util.concurrent.Future updateViewAsync(final UpdateViewRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateViewRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateViewResult call() throws Exception {
UpdateViewResult result = null;
try {
result = executeUpdateView(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();
}
}