com.amazonaws.services.qapps.AWSQAppsAsyncClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aws-java-sdk-qapps Show documentation
Show all versions of aws-java-sdk-qapps Show documentation
The AWS Java SDK for QApps module holds the client classes that are used for communicating with QApps 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.qapps;
import javax.annotation.Generated;
import com.amazonaws.services.qapps.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;
import java.util.concurrent.ExecutorService;
/**
* Client for accessing QApps 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.
*
*
* The Amazon Q Apps feature capability within Amazon Q Business allows web experience users to create lightweight,
* purpose-built AI apps to fulfill specific tasks from within their web experience. For example, users can create an Q
* Appthat exclusively generates marketing-related content to improve your marketing team's productivity or a Q App for
* marketing content-generation like writing customer emails and creating promotional content using a certain style of
* voice, tone, and branding. For more information, see Amazon Q App in the
* Amazon Q Business User Guide.
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSQAppsAsyncClient extends AWSQAppsClient implements AWSQAppsAsync {
private static final int DEFAULT_THREAD_POOL_SIZE = 50;
private final java.util.concurrent.ExecutorService executorService;
public static AWSQAppsAsyncClientBuilder asyncBuilder() {
return AWSQAppsAsyncClientBuilder.standard();
}
/**
* Constructs a new asynchronous client to invoke service methods on QApps using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
*/
AWSQAppsAsyncClient(AwsAsyncClientParams asyncClientParams) {
this(asyncClientParams, false);
}
/**
* Constructs a new asynchronous client to invoke service methods on QApps using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
* @param endpointDiscoveryEnabled
* true will enable endpoint discovery if the service supports it.
*/
AWSQAppsAsyncClient(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 associateLibraryItemReviewAsync(AssociateLibraryItemReviewRequest request) {
return associateLibraryItemReviewAsync(request, null);
}
@Override
public java.util.concurrent.Future associateLibraryItemReviewAsync(final AssociateLibraryItemReviewRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final AssociateLibraryItemReviewRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public AssociateLibraryItemReviewResult call() throws Exception {
AssociateLibraryItemReviewResult result = null;
try {
result = executeAssociateLibraryItemReview(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 associateQAppWithUserAsync(AssociateQAppWithUserRequest request) {
return associateQAppWithUserAsync(request, null);
}
@Override
public java.util.concurrent.Future associateQAppWithUserAsync(final AssociateQAppWithUserRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final AssociateQAppWithUserRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public AssociateQAppWithUserResult call() throws Exception {
AssociateQAppWithUserResult result = null;
try {
result = executeAssociateQAppWithUser(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 createLibraryItemAsync(CreateLibraryItemRequest request) {
return createLibraryItemAsync(request, null);
}
@Override
public java.util.concurrent.Future createLibraryItemAsync(final CreateLibraryItemRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateLibraryItemRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateLibraryItemResult call() throws Exception {
CreateLibraryItemResult result = null;
try {
result = executeCreateLibraryItem(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 createQAppAsync(CreateQAppRequest request) {
return createQAppAsync(request, null);
}
@Override
public java.util.concurrent.Future createQAppAsync(final CreateQAppRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateQAppRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateQAppResult call() throws Exception {
CreateQAppResult result = null;
try {
result = executeCreateQApp(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 deleteLibraryItemAsync(DeleteLibraryItemRequest request) {
return deleteLibraryItemAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteLibraryItemAsync(final DeleteLibraryItemRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteLibraryItemRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteLibraryItemResult call() throws Exception {
DeleteLibraryItemResult result = null;
try {
result = executeDeleteLibraryItem(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 deleteQAppAsync(DeleteQAppRequest request) {
return deleteQAppAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteQAppAsync(final DeleteQAppRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteQAppRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteQAppResult call() throws Exception {
DeleteQAppResult result = null;
try {
result = executeDeleteQApp(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 disassociateLibraryItemReviewAsync(DisassociateLibraryItemReviewRequest request) {
return disassociateLibraryItemReviewAsync(request, null);
}
@Override
public java.util.concurrent.Future disassociateLibraryItemReviewAsync(
final DisassociateLibraryItemReviewRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DisassociateLibraryItemReviewRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DisassociateLibraryItemReviewResult call() throws Exception {
DisassociateLibraryItemReviewResult result = null;
try {
result = executeDisassociateLibraryItemReview(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 disassociateQAppFromUserAsync(DisassociateQAppFromUserRequest request) {
return disassociateQAppFromUserAsync(request, null);
}
@Override
public java.util.concurrent.Future disassociateQAppFromUserAsync(final DisassociateQAppFromUserRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DisassociateQAppFromUserRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DisassociateQAppFromUserResult call() throws Exception {
DisassociateQAppFromUserResult result = null;
try {
result = executeDisassociateQAppFromUser(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 getLibraryItemAsync(GetLibraryItemRequest request) {
return getLibraryItemAsync(request, null);
}
@Override
public java.util.concurrent.Future getLibraryItemAsync(final GetLibraryItemRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetLibraryItemRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetLibraryItemResult call() throws Exception {
GetLibraryItemResult result = null;
try {
result = executeGetLibraryItem(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 getQAppAsync(GetQAppRequest request) {
return getQAppAsync(request, null);
}
@Override
public java.util.concurrent.Future getQAppAsync(final GetQAppRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetQAppRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetQAppResult call() throws Exception {
GetQAppResult result = null;
try {
result = executeGetQApp(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 getQAppSessionAsync(GetQAppSessionRequest request) {
return getQAppSessionAsync(request, null);
}
@Override
public java.util.concurrent.Future getQAppSessionAsync(final GetQAppSessionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetQAppSessionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetQAppSessionResult call() throws Exception {
GetQAppSessionResult result = null;
try {
result = executeGetQAppSession(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 importDocumentAsync(ImportDocumentRequest request) {
return importDocumentAsync(request, null);
}
@Override
public java.util.concurrent.Future importDocumentAsync(final ImportDocumentRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ImportDocumentRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ImportDocumentResult call() throws Exception {
ImportDocumentResult result = null;
try {
result = executeImportDocument(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 listLibraryItemsAsync(ListLibraryItemsRequest request) {
return listLibraryItemsAsync(request, null);
}
@Override
public java.util.concurrent.Future listLibraryItemsAsync(final ListLibraryItemsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListLibraryItemsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListLibraryItemsResult call() throws Exception {
ListLibraryItemsResult result = null;
try {
result = executeListLibraryItems(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 listQAppsAsync(ListQAppsRequest request) {
return listQAppsAsync(request, null);
}
@Override
public java.util.concurrent.Future listQAppsAsync(final ListQAppsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListQAppsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListQAppsResult call() throws Exception {
ListQAppsResult result = null;
try {
result = executeListQApps(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 predictQAppAsync(PredictQAppRequest request) {
return predictQAppAsync(request, null);
}
@Override
public java.util.concurrent.Future predictQAppAsync(final PredictQAppRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final PredictQAppRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public PredictQAppResult call() throws Exception {
PredictQAppResult result = null;
try {
result = executePredictQApp(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 startQAppSessionAsync(StartQAppSessionRequest request) {
return startQAppSessionAsync(request, null);
}
@Override
public java.util.concurrent.Future startQAppSessionAsync(final StartQAppSessionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final StartQAppSessionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public StartQAppSessionResult call() throws Exception {
StartQAppSessionResult result = null;
try {
result = executeStartQAppSession(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 stopQAppSessionAsync(StopQAppSessionRequest request) {
return stopQAppSessionAsync(request, null);
}
@Override
public java.util.concurrent.Future stopQAppSessionAsync(final StopQAppSessionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final StopQAppSessionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public StopQAppSessionResult call() throws Exception {
StopQAppSessionResult result = null;
try {
result = executeStopQAppSession(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 updateLibraryItemAsync(UpdateLibraryItemRequest request) {
return updateLibraryItemAsync(request, null);
}
@Override
public java.util.concurrent.Future updateLibraryItemAsync(final UpdateLibraryItemRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateLibraryItemRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateLibraryItemResult call() throws Exception {
UpdateLibraryItemResult result = null;
try {
result = executeUpdateLibraryItem(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 updateQAppAsync(UpdateQAppRequest request) {
return updateQAppAsync(request, null);
}
@Override
public java.util.concurrent.Future updateQAppAsync(final UpdateQAppRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateQAppRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateQAppResult call() throws Exception {
UpdateQAppResult result = null;
try {
result = executeUpdateQApp(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 updateQAppSessionAsync(UpdateQAppSessionRequest request) {
return updateQAppSessionAsync(request, null);
}
@Override
public java.util.concurrent.Future updateQAppSessionAsync(final UpdateQAppSessionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateQAppSessionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateQAppSessionResult call() throws Exception {
UpdateQAppSessionResult result = null;
try {
result = executeUpdateQAppSession(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