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

software.amazon.awssdk.services.athena.DefaultAthenaAsyncClient Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Athena module holds the client classes that are used for communicating with Amazon Athena Service

There is a newer version: 2.29.16
Show newest version
/*
 * Copyright 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 software.amazon.awssdk.services.athena;

import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import java.util.function.Function;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.awscore.internal.AwsProtocolMetadata;
import software.amazon.awssdk.awscore.internal.AwsServiceProtocol;
import software.amazon.awssdk.awscore.retry.AwsRetryStrategy;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkPlugin;
import software.amazon.awssdk.core.SdkRequest;
import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
import software.amazon.awssdk.core.client.handler.AsyncClientHandler;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.metrics.CoreMetric;
import software.amazon.awssdk.core.retry.RetryMode;
import software.amazon.awssdk.metrics.MetricCollector;
import software.amazon.awssdk.metrics.MetricPublisher;
import software.amazon.awssdk.metrics.NoOpMetricCollector;
import software.amazon.awssdk.protocols.core.ExceptionMetadata;
import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
import software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.athena.internal.AthenaServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.athena.model.AthenaException;
import software.amazon.awssdk.services.athena.model.BatchGetNamedQueryRequest;
import software.amazon.awssdk.services.athena.model.BatchGetNamedQueryResponse;
import software.amazon.awssdk.services.athena.model.BatchGetPreparedStatementRequest;
import software.amazon.awssdk.services.athena.model.BatchGetPreparedStatementResponse;
import software.amazon.awssdk.services.athena.model.BatchGetQueryExecutionRequest;
import software.amazon.awssdk.services.athena.model.BatchGetQueryExecutionResponse;
import software.amazon.awssdk.services.athena.model.CancelCapacityReservationRequest;
import software.amazon.awssdk.services.athena.model.CancelCapacityReservationResponse;
import software.amazon.awssdk.services.athena.model.CreateCapacityReservationRequest;
import software.amazon.awssdk.services.athena.model.CreateCapacityReservationResponse;
import software.amazon.awssdk.services.athena.model.CreateDataCatalogRequest;
import software.amazon.awssdk.services.athena.model.CreateDataCatalogResponse;
import software.amazon.awssdk.services.athena.model.CreateNamedQueryRequest;
import software.amazon.awssdk.services.athena.model.CreateNamedQueryResponse;
import software.amazon.awssdk.services.athena.model.CreateNotebookRequest;
import software.amazon.awssdk.services.athena.model.CreateNotebookResponse;
import software.amazon.awssdk.services.athena.model.CreatePreparedStatementRequest;
import software.amazon.awssdk.services.athena.model.CreatePreparedStatementResponse;
import software.amazon.awssdk.services.athena.model.CreatePresignedNotebookUrlRequest;
import software.amazon.awssdk.services.athena.model.CreatePresignedNotebookUrlResponse;
import software.amazon.awssdk.services.athena.model.CreateWorkGroupRequest;
import software.amazon.awssdk.services.athena.model.CreateWorkGroupResponse;
import software.amazon.awssdk.services.athena.model.DeleteCapacityReservationRequest;
import software.amazon.awssdk.services.athena.model.DeleteCapacityReservationResponse;
import software.amazon.awssdk.services.athena.model.DeleteDataCatalogRequest;
import software.amazon.awssdk.services.athena.model.DeleteDataCatalogResponse;
import software.amazon.awssdk.services.athena.model.DeleteNamedQueryRequest;
import software.amazon.awssdk.services.athena.model.DeleteNamedQueryResponse;
import software.amazon.awssdk.services.athena.model.DeleteNotebookRequest;
import software.amazon.awssdk.services.athena.model.DeleteNotebookResponse;
import software.amazon.awssdk.services.athena.model.DeletePreparedStatementRequest;
import software.amazon.awssdk.services.athena.model.DeletePreparedStatementResponse;
import software.amazon.awssdk.services.athena.model.DeleteWorkGroupRequest;
import software.amazon.awssdk.services.athena.model.DeleteWorkGroupResponse;
import software.amazon.awssdk.services.athena.model.ExportNotebookRequest;
import software.amazon.awssdk.services.athena.model.ExportNotebookResponse;
import software.amazon.awssdk.services.athena.model.GetCalculationExecutionCodeRequest;
import software.amazon.awssdk.services.athena.model.GetCalculationExecutionCodeResponse;
import software.amazon.awssdk.services.athena.model.GetCalculationExecutionRequest;
import software.amazon.awssdk.services.athena.model.GetCalculationExecutionResponse;
import software.amazon.awssdk.services.athena.model.GetCalculationExecutionStatusRequest;
import software.amazon.awssdk.services.athena.model.GetCalculationExecutionStatusResponse;
import software.amazon.awssdk.services.athena.model.GetCapacityAssignmentConfigurationRequest;
import software.amazon.awssdk.services.athena.model.GetCapacityAssignmentConfigurationResponse;
import software.amazon.awssdk.services.athena.model.GetCapacityReservationRequest;
import software.amazon.awssdk.services.athena.model.GetCapacityReservationResponse;
import software.amazon.awssdk.services.athena.model.GetDataCatalogRequest;
import software.amazon.awssdk.services.athena.model.GetDataCatalogResponse;
import software.amazon.awssdk.services.athena.model.GetDatabaseRequest;
import software.amazon.awssdk.services.athena.model.GetDatabaseResponse;
import software.amazon.awssdk.services.athena.model.GetNamedQueryRequest;
import software.amazon.awssdk.services.athena.model.GetNamedQueryResponse;
import software.amazon.awssdk.services.athena.model.GetNotebookMetadataRequest;
import software.amazon.awssdk.services.athena.model.GetNotebookMetadataResponse;
import software.amazon.awssdk.services.athena.model.GetPreparedStatementRequest;
import software.amazon.awssdk.services.athena.model.GetPreparedStatementResponse;
import software.amazon.awssdk.services.athena.model.GetQueryExecutionRequest;
import software.amazon.awssdk.services.athena.model.GetQueryExecutionResponse;
import software.amazon.awssdk.services.athena.model.GetQueryResultsRequest;
import software.amazon.awssdk.services.athena.model.GetQueryResultsResponse;
import software.amazon.awssdk.services.athena.model.GetQueryRuntimeStatisticsRequest;
import software.amazon.awssdk.services.athena.model.GetQueryRuntimeStatisticsResponse;
import software.amazon.awssdk.services.athena.model.GetSessionRequest;
import software.amazon.awssdk.services.athena.model.GetSessionResponse;
import software.amazon.awssdk.services.athena.model.GetSessionStatusRequest;
import software.amazon.awssdk.services.athena.model.GetSessionStatusResponse;
import software.amazon.awssdk.services.athena.model.GetTableMetadataRequest;
import software.amazon.awssdk.services.athena.model.GetTableMetadataResponse;
import software.amazon.awssdk.services.athena.model.GetWorkGroupRequest;
import software.amazon.awssdk.services.athena.model.GetWorkGroupResponse;
import software.amazon.awssdk.services.athena.model.ImportNotebookRequest;
import software.amazon.awssdk.services.athena.model.ImportNotebookResponse;
import software.amazon.awssdk.services.athena.model.InternalServerException;
import software.amazon.awssdk.services.athena.model.InvalidRequestException;
import software.amazon.awssdk.services.athena.model.ListApplicationDpuSizesRequest;
import software.amazon.awssdk.services.athena.model.ListApplicationDpuSizesResponse;
import software.amazon.awssdk.services.athena.model.ListCalculationExecutionsRequest;
import software.amazon.awssdk.services.athena.model.ListCalculationExecutionsResponse;
import software.amazon.awssdk.services.athena.model.ListCapacityReservationsRequest;
import software.amazon.awssdk.services.athena.model.ListCapacityReservationsResponse;
import software.amazon.awssdk.services.athena.model.ListDataCatalogsRequest;
import software.amazon.awssdk.services.athena.model.ListDataCatalogsResponse;
import software.amazon.awssdk.services.athena.model.ListDatabasesRequest;
import software.amazon.awssdk.services.athena.model.ListDatabasesResponse;
import software.amazon.awssdk.services.athena.model.ListEngineVersionsRequest;
import software.amazon.awssdk.services.athena.model.ListEngineVersionsResponse;
import software.amazon.awssdk.services.athena.model.ListExecutorsRequest;
import software.amazon.awssdk.services.athena.model.ListExecutorsResponse;
import software.amazon.awssdk.services.athena.model.ListNamedQueriesRequest;
import software.amazon.awssdk.services.athena.model.ListNamedQueriesResponse;
import software.amazon.awssdk.services.athena.model.ListNotebookMetadataRequest;
import software.amazon.awssdk.services.athena.model.ListNotebookMetadataResponse;
import software.amazon.awssdk.services.athena.model.ListNotebookSessionsRequest;
import software.amazon.awssdk.services.athena.model.ListNotebookSessionsResponse;
import software.amazon.awssdk.services.athena.model.ListPreparedStatementsRequest;
import software.amazon.awssdk.services.athena.model.ListPreparedStatementsResponse;
import software.amazon.awssdk.services.athena.model.ListQueryExecutionsRequest;
import software.amazon.awssdk.services.athena.model.ListQueryExecutionsResponse;
import software.amazon.awssdk.services.athena.model.ListSessionsRequest;
import software.amazon.awssdk.services.athena.model.ListSessionsResponse;
import software.amazon.awssdk.services.athena.model.ListTableMetadataRequest;
import software.amazon.awssdk.services.athena.model.ListTableMetadataResponse;
import software.amazon.awssdk.services.athena.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.athena.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.athena.model.ListWorkGroupsRequest;
import software.amazon.awssdk.services.athena.model.ListWorkGroupsResponse;
import software.amazon.awssdk.services.athena.model.MetadataException;
import software.amazon.awssdk.services.athena.model.PutCapacityAssignmentConfigurationRequest;
import software.amazon.awssdk.services.athena.model.PutCapacityAssignmentConfigurationResponse;
import software.amazon.awssdk.services.athena.model.ResourceNotFoundException;
import software.amazon.awssdk.services.athena.model.SessionAlreadyExistsException;
import software.amazon.awssdk.services.athena.model.StartCalculationExecutionRequest;
import software.amazon.awssdk.services.athena.model.StartCalculationExecutionResponse;
import software.amazon.awssdk.services.athena.model.StartQueryExecutionRequest;
import software.amazon.awssdk.services.athena.model.StartQueryExecutionResponse;
import software.amazon.awssdk.services.athena.model.StartSessionRequest;
import software.amazon.awssdk.services.athena.model.StartSessionResponse;
import software.amazon.awssdk.services.athena.model.StopCalculationExecutionRequest;
import software.amazon.awssdk.services.athena.model.StopCalculationExecutionResponse;
import software.amazon.awssdk.services.athena.model.StopQueryExecutionRequest;
import software.amazon.awssdk.services.athena.model.StopQueryExecutionResponse;
import software.amazon.awssdk.services.athena.model.TagResourceRequest;
import software.amazon.awssdk.services.athena.model.TagResourceResponse;
import software.amazon.awssdk.services.athena.model.TerminateSessionRequest;
import software.amazon.awssdk.services.athena.model.TerminateSessionResponse;
import software.amazon.awssdk.services.athena.model.TooManyRequestsException;
import software.amazon.awssdk.services.athena.model.UntagResourceRequest;
import software.amazon.awssdk.services.athena.model.UntagResourceResponse;
import software.amazon.awssdk.services.athena.model.UpdateCapacityReservationRequest;
import software.amazon.awssdk.services.athena.model.UpdateCapacityReservationResponse;
import software.amazon.awssdk.services.athena.model.UpdateDataCatalogRequest;
import software.amazon.awssdk.services.athena.model.UpdateDataCatalogResponse;
import software.amazon.awssdk.services.athena.model.UpdateNamedQueryRequest;
import software.amazon.awssdk.services.athena.model.UpdateNamedQueryResponse;
import software.amazon.awssdk.services.athena.model.UpdateNotebookMetadataRequest;
import software.amazon.awssdk.services.athena.model.UpdateNotebookMetadataResponse;
import software.amazon.awssdk.services.athena.model.UpdateNotebookRequest;
import software.amazon.awssdk.services.athena.model.UpdateNotebookResponse;
import software.amazon.awssdk.services.athena.model.UpdatePreparedStatementRequest;
import software.amazon.awssdk.services.athena.model.UpdatePreparedStatementResponse;
import software.amazon.awssdk.services.athena.model.UpdateWorkGroupRequest;
import software.amazon.awssdk.services.athena.model.UpdateWorkGroupResponse;
import software.amazon.awssdk.services.athena.transform.BatchGetNamedQueryRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.BatchGetPreparedStatementRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.BatchGetQueryExecutionRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.CancelCapacityReservationRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.CreateCapacityReservationRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.CreateDataCatalogRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.CreateNamedQueryRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.CreateNotebookRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.CreatePreparedStatementRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.CreatePresignedNotebookUrlRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.CreateWorkGroupRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.DeleteCapacityReservationRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.DeleteDataCatalogRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.DeleteNamedQueryRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.DeleteNotebookRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.DeletePreparedStatementRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.DeleteWorkGroupRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.ExportNotebookRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.GetCalculationExecutionCodeRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.GetCalculationExecutionRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.GetCalculationExecutionStatusRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.GetCapacityAssignmentConfigurationRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.GetCapacityReservationRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.GetDataCatalogRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.GetDatabaseRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.GetNamedQueryRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.GetNotebookMetadataRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.GetPreparedStatementRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.GetQueryExecutionRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.GetQueryResultsRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.GetQueryRuntimeStatisticsRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.GetSessionRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.GetSessionStatusRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.GetTableMetadataRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.GetWorkGroupRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.ImportNotebookRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.ListApplicationDpuSizesRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.ListCalculationExecutionsRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.ListCapacityReservationsRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.ListDataCatalogsRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.ListDatabasesRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.ListEngineVersionsRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.ListExecutorsRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.ListNamedQueriesRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.ListNotebookMetadataRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.ListNotebookSessionsRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.ListPreparedStatementsRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.ListQueryExecutionsRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.ListSessionsRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.ListTableMetadataRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.ListWorkGroupsRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.PutCapacityAssignmentConfigurationRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.StartCalculationExecutionRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.StartQueryExecutionRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.StartSessionRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.StopCalculationExecutionRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.StopQueryExecutionRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.TerminateSessionRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.UpdateCapacityReservationRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.UpdateDataCatalogRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.UpdateNamedQueryRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.UpdateNotebookMetadataRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.UpdateNotebookRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.UpdatePreparedStatementRequestMarshaller;
import software.amazon.awssdk.services.athena.transform.UpdateWorkGroupRequestMarshaller;
import software.amazon.awssdk.utils.CompletableFutureUtils;

/**
 * Internal implementation of {@link AthenaAsyncClient}.
 *
 * @see AthenaAsyncClient#builder()
 */
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultAthenaAsyncClient implements AthenaAsyncClient {
    private static final Logger log = LoggerFactory.getLogger(DefaultAthenaAsyncClient.class);

    private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
            .serviceProtocol(AwsServiceProtocol.AWS_JSON).build();

    private final AsyncClientHandler clientHandler;

    private final AwsJsonProtocolFactory protocolFactory;

    private final SdkClientConfiguration clientConfiguration;

    protected DefaultAthenaAsyncClient(SdkClientConfiguration clientConfiguration) {
        this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
        this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
        this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
    }

    /**
     * 

* Returns the details of a single named query or a list of up to 50 queries, which you provide as an array of query * ID strings. Requires you to have access to the workgroup in which the queries were saved. Use * ListNamedQueriesInput to get the list of named query IDs in the specified workgroup. If information could * not be retrieved for a submitted query ID, information about the query ID submitted is listed under * UnprocessedNamedQueryId. Named queries differ from executed queries. Use * BatchGetQueryExecutionInput to get details about each unique query execution, and * ListQueryExecutionsInput to get a list of query execution IDs. *

* * @param batchGetNamedQueryRequest * Contains an array of named query IDs. * @return A Java Future containing the result of the BatchGetNamedQuery operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.BatchGetNamedQuery * @see AWS API * Documentation */ @Override public CompletableFuture batchGetNamedQuery(BatchGetNamedQueryRequest batchGetNamedQueryRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(batchGetNamedQueryRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, batchGetNamedQueryRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BatchGetNamedQuery"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, BatchGetNamedQueryResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("BatchGetNamedQuery").withProtocolMetadata(protocolMetadata) .withMarshaller(new BatchGetNamedQueryRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(batchGetNamedQueryRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns the details of a single prepared statement or a list of up to 256 prepared statements for the array of * prepared statement names that you provide. Requires you to have access to the workgroup to which the prepared * statements belong. If a prepared statement cannot be retrieved for the name specified, the statement is listed in * UnprocessedPreparedStatementNames. *

* * @param batchGetPreparedStatementRequest * @return A Java Future containing the result of the BatchGetPreparedStatement operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.BatchGetPreparedStatement * @see AWS API Documentation */ @Override public CompletableFuture batchGetPreparedStatement( BatchGetPreparedStatementRequest batchGetPreparedStatementRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(batchGetPreparedStatementRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, batchGetPreparedStatementRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BatchGetPreparedStatement"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, BatchGetPreparedStatementResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("BatchGetPreparedStatement").withProtocolMetadata(protocolMetadata) .withMarshaller(new BatchGetPreparedStatementRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(batchGetPreparedStatementRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns the details of a single query execution or a list of up to 50 query executions, which you provide as an * array of query execution ID strings. Requires you to have access to the workgroup in which the queries ran. To * get a list of query execution IDs, use ListQueryExecutionsInput$WorkGroup. Query executions differ from * named (saved) queries. Use BatchGetNamedQueryInput to get details about named queries. *

* * @param batchGetQueryExecutionRequest * Contains an array of query execution IDs. * @return A Java Future containing the result of the BatchGetQueryExecution operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.BatchGetQueryExecution * @see AWS * API Documentation */ @Override public CompletableFuture batchGetQueryExecution( BatchGetQueryExecutionRequest batchGetQueryExecutionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(batchGetQueryExecutionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, batchGetQueryExecutionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BatchGetQueryExecution"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, BatchGetQueryExecutionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("BatchGetQueryExecution").withProtocolMetadata(protocolMetadata) .withMarshaller(new BatchGetQueryExecutionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(batchGetQueryExecutionRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Cancels the capacity reservation with the specified name. Cancelled reservations remain in your account and will * be deleted 45 days after cancellation. During the 45 days, you cannot re-purpose or reuse a reservation that has * been cancelled, but you can refer to its tags and view it for historical reference. *

* * @param cancelCapacityReservationRequest * @return A Java Future containing the result of the CancelCapacityReservation operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.CancelCapacityReservation * @see AWS API Documentation */ @Override public CompletableFuture cancelCapacityReservation( CancelCapacityReservationRequest cancelCapacityReservationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(cancelCapacityReservationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, cancelCapacityReservationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CancelCapacityReservation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CancelCapacityReservationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CancelCapacityReservation").withProtocolMetadata(protocolMetadata) .withMarshaller(new CancelCapacityReservationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(cancelCapacityReservationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Creates a capacity reservation with the specified name and number of requested data processing units. *

* * @param createCapacityReservationRequest * @return A Java Future containing the result of the CreateCapacityReservation operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.CreateCapacityReservation * @see AWS API Documentation */ @Override public CompletableFuture createCapacityReservation( CreateCapacityReservationRequest createCapacityReservationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createCapacityReservationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createCapacityReservationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateCapacityReservation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateCapacityReservationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateCapacityReservation").withProtocolMetadata(protocolMetadata) .withMarshaller(new CreateCapacityReservationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(createCapacityReservationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Creates (registers) a data catalog with the specified name and properties. Catalogs created are visible to all * users of the same Amazon Web Services account. *

* * @param createDataCatalogRequest * @return A Java Future containing the result of the CreateDataCatalog operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.CreateDataCatalog * @see AWS API * Documentation */ @Override public CompletableFuture createDataCatalog(CreateDataCatalogRequest createDataCatalogRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createDataCatalogRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createDataCatalogRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateDataCatalog"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateDataCatalogResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateDataCatalog").withProtocolMetadata(protocolMetadata) .withMarshaller(new CreateDataCatalogRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(createDataCatalogRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Creates a named query in the specified workgroup. Requires that you have access to the workgroup. *

* * @param createNamedQueryRequest * @return A Java Future containing the result of the CreateNamedQuery operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.CreateNamedQuery * @see AWS API * Documentation */ @Override public CompletableFuture createNamedQuery(CreateNamedQueryRequest createNamedQueryRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createNamedQueryRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createNamedQueryRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateNamedQuery"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateNamedQueryResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateNamedQuery").withProtocolMetadata(protocolMetadata) .withMarshaller(new CreateNamedQueryRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(createNamedQueryRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Creates an empty ipynb file in the specified Apache Spark enabled workgroup. Throws an error if a * file in the workgroup with the same name already exists. *

* * @param createNotebookRequest * @return A Java Future containing the result of the CreateNotebook operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • TooManyRequestsException Indicates that the request was throttled.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.CreateNotebook * @see AWS API * Documentation */ @Override public CompletableFuture createNotebook(CreateNotebookRequest createNotebookRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createNotebookRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createNotebookRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateNotebook"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateNotebookResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateNotebook").withProtocolMetadata(protocolMetadata) .withMarshaller(new CreateNotebookRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(createNotebookRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Creates a prepared statement for use with SQL queries in Athena. *

* * @param createPreparedStatementRequest * @return A Java Future containing the result of the CreatePreparedStatement operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.CreatePreparedStatement * @see AWS API Documentation */ @Override public CompletableFuture createPreparedStatement( CreatePreparedStatementRequest createPreparedStatementRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createPreparedStatementRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createPreparedStatementRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreatePreparedStatement"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreatePreparedStatementResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CreatePreparedStatement").withProtocolMetadata(protocolMetadata) .withMarshaller(new CreatePreparedStatementRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(createPreparedStatementRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Gets an authentication token and the URL at which the notebook can be accessed. During programmatic access, * CreatePresignedNotebookUrl must be called every 10 minutes to refresh the authentication token. For * information about granting programmatic access, see Grant * programmatic access. *

* * @param createPresignedNotebookUrlRequest * @return A Java Future containing the result of the CreatePresignedNotebookUrl operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • ResourceNotFoundException A resource, such as a workgroup, was not found.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.CreatePresignedNotebookUrl * @see AWS API Documentation */ @Override public CompletableFuture createPresignedNotebookUrl( CreatePresignedNotebookUrlRequest createPresignedNotebookUrlRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createPresignedNotebookUrlRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createPresignedNotebookUrlRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreatePresignedNotebookUrl"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreatePresignedNotebookUrlResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CreatePresignedNotebookUrl").withProtocolMetadata(protocolMetadata) .withMarshaller(new CreatePresignedNotebookUrlRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(createPresignedNotebookUrlRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Creates a workgroup with the specified name. A workgroup can be an Apache Spark enabled workgroup or an Athena * SQL workgroup. *

* * @param createWorkGroupRequest * @return A Java Future containing the result of the CreateWorkGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.CreateWorkGroup * @see AWS API * Documentation */ @Override public CompletableFuture createWorkGroup(CreateWorkGroupRequest createWorkGroupRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createWorkGroupRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createWorkGroupRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateWorkGroup"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateWorkGroupResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateWorkGroup").withProtocolMetadata(protocolMetadata) .withMarshaller(new CreateWorkGroupRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(createWorkGroupRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Deletes a cancelled capacity reservation. A reservation must be cancelled before it can be deleted. A deleted * reservation is immediately removed from your account and can no longer be referenced, including by its ARN. A * deleted reservation cannot be called by GetCapacityReservation, and deleted reservations do not * appear in the output of ListCapacityReservations. *

* * @param deleteCapacityReservationRequest * @return A Java Future containing the result of the DeleteCapacityReservation operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.DeleteCapacityReservation * @see AWS API Documentation */ @Override public CompletableFuture deleteCapacityReservation( DeleteCapacityReservationRequest deleteCapacityReservationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteCapacityReservationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteCapacityReservationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteCapacityReservation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteCapacityReservationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteCapacityReservation").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteCapacityReservationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteCapacityReservationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Deletes a data catalog. *

* * @param deleteDataCatalogRequest * @return A Java Future containing the result of the DeleteDataCatalog operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.DeleteDataCatalog * @see AWS API * Documentation */ @Override public CompletableFuture deleteDataCatalog(DeleteDataCatalogRequest deleteDataCatalogRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteDataCatalogRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteDataCatalogRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteDataCatalog"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteDataCatalogResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteDataCatalog").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteDataCatalogRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteDataCatalogRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Deletes the named query if you have access to the workgroup in which the query was saved. *

* * @param deleteNamedQueryRequest * @return A Java Future containing the result of the DeleteNamedQuery operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.DeleteNamedQuery * @see AWS API * Documentation */ @Override public CompletableFuture deleteNamedQuery(DeleteNamedQueryRequest deleteNamedQueryRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteNamedQueryRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteNamedQueryRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteNamedQuery"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteNamedQueryResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteNamedQuery").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteNamedQueryRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteNamedQueryRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Deletes the specified notebook. *

* * @param deleteNotebookRequest * @return A Java Future containing the result of the DeleteNotebook operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • TooManyRequestsException Indicates that the request was throttled.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.DeleteNotebook * @see AWS API * Documentation */ @Override public CompletableFuture deleteNotebook(DeleteNotebookRequest deleteNotebookRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteNotebookRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteNotebookRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteNotebook"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteNotebookResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteNotebook").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteNotebookRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteNotebookRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Deletes the prepared statement with the specified name from the specified workgroup. *

* * @param deletePreparedStatementRequest * @return A Java Future containing the result of the DeletePreparedStatement operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • ResourceNotFoundException A resource, such as a workgroup, was not found.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.DeletePreparedStatement * @see AWS API Documentation */ @Override public CompletableFuture deletePreparedStatement( DeletePreparedStatementRequest deletePreparedStatementRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deletePreparedStatementRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deletePreparedStatementRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeletePreparedStatement"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeletePreparedStatementResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeletePreparedStatement").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeletePreparedStatementRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deletePreparedStatementRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Deletes the workgroup with the specified name. The primary workgroup cannot be deleted. *

* * @param deleteWorkGroupRequest * @return A Java Future containing the result of the DeleteWorkGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.DeleteWorkGroup * @see AWS API * Documentation */ @Override public CompletableFuture deleteWorkGroup(DeleteWorkGroupRequest deleteWorkGroupRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteWorkGroupRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteWorkGroupRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteWorkGroup"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteWorkGroupResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteWorkGroup").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteWorkGroupRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteWorkGroupRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Exports the specified notebook and its metadata. *

* * @param exportNotebookRequest * @return A Java Future containing the result of the ExportNotebook operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • TooManyRequestsException Indicates that the request was throttled.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.ExportNotebook * @see AWS API * Documentation */ @Override public CompletableFuture exportNotebook(ExportNotebookRequest exportNotebookRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(exportNotebookRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, exportNotebookRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ExportNotebook"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ExportNotebookResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ExportNotebook").withProtocolMetadata(protocolMetadata) .withMarshaller(new ExportNotebookRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(exportNotebookRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describes a previously submitted calculation execution. *

* * @param getCalculationExecutionRequest * @return A Java Future containing the result of the GetCalculationExecution operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • ResourceNotFoundException A resource, such as a workgroup, was not found.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.GetCalculationExecution * @see AWS API Documentation */ @Override public CompletableFuture getCalculationExecution( GetCalculationExecutionRequest getCalculationExecutionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getCalculationExecutionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getCalculationExecutionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetCalculationExecution"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetCalculationExecutionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetCalculationExecution").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetCalculationExecutionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getCalculationExecutionRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Retrieves the unencrypted code that was executed for the calculation. *

* * @param getCalculationExecutionCodeRequest * @return A Java Future containing the result of the GetCalculationExecutionCode operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • ResourceNotFoundException A resource, such as a workgroup, was not found.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.GetCalculationExecutionCode * @see AWS API Documentation */ @Override public CompletableFuture getCalculationExecutionCode( GetCalculationExecutionCodeRequest getCalculationExecutionCodeRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getCalculationExecutionCodeRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getCalculationExecutionCodeRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetCalculationExecutionCode"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetCalculationExecutionCodeResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetCalculationExecutionCode").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetCalculationExecutionCodeRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getCalculationExecutionCodeRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Gets the status of a current calculation. *

* * @param getCalculationExecutionStatusRequest * @return A Java Future containing the result of the GetCalculationExecutionStatus operation returned by the * service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • ResourceNotFoundException A resource, such as a workgroup, was not found.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.GetCalculationExecutionStatus * @see AWS API Documentation */ @Override public CompletableFuture getCalculationExecutionStatus( GetCalculationExecutionStatusRequest getCalculationExecutionStatusRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getCalculationExecutionStatusRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getCalculationExecutionStatusRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetCalculationExecutionStatus"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetCalculationExecutionStatusResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetCalculationExecutionStatus").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetCalculationExecutionStatusRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getCalculationExecutionStatusRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Gets the capacity assignment configuration for a capacity reservation, if one exists. *

* * @param getCapacityAssignmentConfigurationRequest * @return A Java Future containing the result of the GetCapacityAssignmentConfiguration operation returned by the * service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.GetCapacityAssignmentConfiguration * @see AWS API Documentation */ @Override public CompletableFuture getCapacityAssignmentConfiguration( GetCapacityAssignmentConfigurationRequest getCapacityAssignmentConfigurationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getCapacityAssignmentConfigurationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getCapacityAssignmentConfigurationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetCapacityAssignmentConfiguration"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, GetCapacityAssignmentConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetCapacityAssignmentConfiguration").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetCapacityAssignmentConfigurationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getCapacityAssignmentConfigurationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns information about the capacity reservation with the specified name. *

* * @param getCapacityReservationRequest * @return A Java Future containing the result of the GetCapacityReservation operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.GetCapacityReservation * @see AWS * API Documentation */ @Override public CompletableFuture getCapacityReservation( GetCapacityReservationRequest getCapacityReservationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getCapacityReservationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getCapacityReservationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetCapacityReservation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetCapacityReservationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetCapacityReservation").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetCapacityReservationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getCapacityReservationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns the specified data catalog. *

* * @param getDataCatalogRequest * @return A Java Future containing the result of the GetDataCatalog operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.GetDataCatalog * @see AWS API * Documentation */ @Override public CompletableFuture getDataCatalog(GetDataCatalogRequest getDataCatalogRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getDataCatalogRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getDataCatalogRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetDataCatalog"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetDataCatalogResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetDataCatalog").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetDataCatalogRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getDataCatalogRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns a database object for the specified database and data catalog. *

* * @param getDatabaseRequest * @return A Java Future containing the result of the GetDatabase operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • MetadataException An exception that Athena received when it called a custom metastore. Occurs if the * error is not caused by user input (InvalidRequestException) or from the Athena platform ( * InternalServerException). For example, if a user-created Lambda function is missing * permissions, the Lambda 4XX exception is returned in a MetadataException.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.GetDatabase * @see AWS API * Documentation */ @Override public CompletableFuture getDatabase(GetDatabaseRequest getDatabaseRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getDatabaseRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getDatabaseRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetDatabase"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetDatabaseResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetDatabase").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetDatabaseRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getDatabaseRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns information about a single query. Requires that you have access to the workgroup in which the query was * saved. *

* * @param getNamedQueryRequest * @return A Java Future containing the result of the GetNamedQuery operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.GetNamedQuery * @see AWS API * Documentation */ @Override public CompletableFuture getNamedQuery(GetNamedQueryRequest getNamedQueryRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getNamedQueryRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getNamedQueryRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetNamedQuery"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetNamedQueryResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetNamedQuery").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetNamedQueryRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getNamedQueryRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Retrieves notebook metadata for the specified notebook ID. *

* * @param getNotebookMetadataRequest * @return A Java Future containing the result of the GetNotebookMetadata operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • TooManyRequestsException Indicates that the request was throttled.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.GetNotebookMetadata * @see AWS * API Documentation */ @Override public CompletableFuture getNotebookMetadata( GetNotebookMetadataRequest getNotebookMetadataRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getNotebookMetadataRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getNotebookMetadataRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetNotebookMetadata"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetNotebookMetadataResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetNotebookMetadata").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetNotebookMetadataRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getNotebookMetadataRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Retrieves the prepared statement with the specified name from the specified workgroup. *

* * @param getPreparedStatementRequest * @return A Java Future containing the result of the GetPreparedStatement operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • ResourceNotFoundException A resource, such as a workgroup, was not found.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.GetPreparedStatement * @see AWS * API Documentation */ @Override public CompletableFuture getPreparedStatement( GetPreparedStatementRequest getPreparedStatementRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getPreparedStatementRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getPreparedStatementRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetPreparedStatement"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetPreparedStatementResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetPreparedStatement").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetPreparedStatementRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getPreparedStatementRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns information about a single execution of a query if you have access to the workgroup in which the query * ran. Each time a query executes, information about the query execution is saved with a unique ID. *

* * @param getQueryExecutionRequest * @return A Java Future containing the result of the GetQueryExecution operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.GetQueryExecution * @see AWS API * Documentation */ @Override public CompletableFuture getQueryExecution(GetQueryExecutionRequest getQueryExecutionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getQueryExecutionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getQueryExecutionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetQueryExecution"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetQueryExecutionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetQueryExecution").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetQueryExecutionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getQueryExecutionRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Streams the results of a single query execution specified by QueryExecutionId from the Athena query * results location in Amazon S3. For more information, see Working with query results, recent queries, and * output files in the Amazon Athena User Guide. This request does not execute the query but returns * results. Use StartQueryExecution to run a query. *

*

* To stream query results successfully, the IAM principal with permission to call GetQueryResults also * must have permissions to the Amazon S3 GetObject action for the Athena query results location. *

* *

* IAM principals with permission to the Amazon S3 GetObject action for the query results location are * able to retrieve query results from Amazon S3 even if permission to the GetQueryResults action is * denied. To restrict user or role access, ensure that Amazon S3 permissions to the Athena query location are * denied. *

*
* * @param getQueryResultsRequest * @return A Java Future containing the result of the GetQueryResults operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • TooManyRequestsException Indicates that the request was throttled.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.GetQueryResults * @see AWS API * Documentation */ @Override public CompletableFuture getQueryResults(GetQueryResultsRequest getQueryResultsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getQueryResultsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getQueryResultsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetQueryResults"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetQueryResultsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetQueryResults").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetQueryResultsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getQueryResultsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns query execution runtime statistics related to a single execution of a query if you have access to the * workgroup in which the query ran. Statistics from the Timeline section of the response object are * available as soon as QueryExecutionStatus$State is in a SUCCEEDED or FAILED state. The remaining * non-timeline statistics in the response (like stage-level input and output row count and data size) are updated * asynchronously and may not be available immediately after a query completes. The non-timeline statistics are also * not included when a query has row-level filters defined in Lake Formation. *

* * @param getQueryRuntimeStatisticsRequest * @return A Java Future containing the result of the GetQueryRuntimeStatistics operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.GetQueryRuntimeStatistics * @see AWS API Documentation */ @Override public CompletableFuture getQueryRuntimeStatistics( GetQueryRuntimeStatisticsRequest getQueryRuntimeStatisticsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getQueryRuntimeStatisticsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getQueryRuntimeStatisticsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetQueryRuntimeStatistics"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetQueryRuntimeStatisticsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetQueryRuntimeStatistics").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetQueryRuntimeStatisticsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getQueryRuntimeStatisticsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Gets the full details of a previously created session, including the session status and configuration. *

* * @param getSessionRequest * @return A Java Future containing the result of the GetSession operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • ResourceNotFoundException A resource, such as a workgroup, was not found.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.GetSession * @see AWS API * Documentation */ @Override public CompletableFuture getSession(GetSessionRequest getSessionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getSessionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getSessionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetSession"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetSessionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams().withOperationName("GetSession") .withProtocolMetadata(protocolMetadata) .withMarshaller(new GetSessionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getSessionRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Gets the current status of a session. *

* * @param getSessionStatusRequest * @return A Java Future containing the result of the GetSessionStatus operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • ResourceNotFoundException A resource, such as a workgroup, was not found.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.GetSessionStatus * @see AWS API * Documentation */ @Override public CompletableFuture getSessionStatus(GetSessionStatusRequest getSessionStatusRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getSessionStatusRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getSessionStatusRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetSessionStatus"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetSessionStatusResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetSessionStatus").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetSessionStatusRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getSessionStatusRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns table metadata for the specified catalog, database, and table. *

* * @param getTableMetadataRequest * @return A Java Future containing the result of the GetTableMetadata operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • MetadataException An exception that Athena received when it called a custom metastore. Occurs if the * error is not caused by user input (InvalidRequestException) or from the Athena platform ( * InternalServerException). For example, if a user-created Lambda function is missing * permissions, the Lambda 4XX exception is returned in a MetadataException.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.GetTableMetadata * @see AWS API * Documentation */ @Override public CompletableFuture getTableMetadata(GetTableMetadataRequest getTableMetadataRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getTableMetadataRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getTableMetadataRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetTableMetadata"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetTableMetadataResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetTableMetadata").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetTableMetadataRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getTableMetadataRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns information about the workgroup with the specified name. *

* * @param getWorkGroupRequest * @return A Java Future containing the result of the GetWorkGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.GetWorkGroup * @see AWS API * Documentation */ @Override public CompletableFuture getWorkGroup(GetWorkGroupRequest getWorkGroupRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getWorkGroupRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getWorkGroupRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetWorkGroup"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, GetWorkGroupResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("GetWorkGroup").withProtocolMetadata(protocolMetadata) .withMarshaller(new GetWorkGroupRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(getWorkGroupRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Imports a single ipynb file to a Spark enabled workgroup. To import the notebook, the request must * specify a value for either Payload or NoteBookS3LocationUri. If neither is specified or * both are specified, an InvalidRequestException occurs. The maximum file size that can be imported is * 10 megabytes. If an ipynb file with the same name already exists in the workgroup, throws an error. *

* * @param importNotebookRequest * @return A Java Future containing the result of the ImportNotebook operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • TooManyRequestsException Indicates that the request was throttled.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.ImportNotebook * @see AWS API * Documentation */ @Override public CompletableFuture importNotebook(ImportNotebookRequest importNotebookRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(importNotebookRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, importNotebookRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ImportNotebook"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ImportNotebookResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ImportNotebook").withProtocolMetadata(protocolMetadata) .withMarshaller(new ImportNotebookRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(importNotebookRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns the supported DPU sizes for the supported application runtimes (for example, * Athena notebook version 1). *

* * @param listApplicationDpuSizesRequest * @return A Java Future containing the result of the ListApplicationDPUSizes operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • TooManyRequestsException Indicates that the request was throttled.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.ListApplicationDPUSizes * @see AWS API Documentation */ @Override public CompletableFuture listApplicationDPUSizes( ListApplicationDpuSizesRequest listApplicationDpuSizesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listApplicationDpuSizesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listApplicationDpuSizesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListApplicationDPUSizes"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListApplicationDpuSizesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListApplicationDPUSizes").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListApplicationDpuSizesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listApplicationDpuSizesRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Lists the calculations that have been submitted to a session in descending order. Newer calculations are listed * first; older calculations are listed later. *

* * @param listCalculationExecutionsRequest * @return A Java Future containing the result of the ListCalculationExecutions operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • ResourceNotFoundException A resource, such as a workgroup, was not found.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.ListCalculationExecutions * @see AWS API Documentation */ @Override public CompletableFuture listCalculationExecutions( ListCalculationExecutionsRequest listCalculationExecutionsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listCalculationExecutionsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listCalculationExecutionsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListCalculationExecutions"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListCalculationExecutionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListCalculationExecutions").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListCalculationExecutionsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listCalculationExecutionsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Lists the capacity reservations for the current account. *

* * @param listCapacityReservationsRequest * @return A Java Future containing the result of the ListCapacityReservations operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.ListCapacityReservations * @see AWS API Documentation */ @Override public CompletableFuture listCapacityReservations( ListCapacityReservationsRequest listCapacityReservationsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listCapacityReservationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listCapacityReservationsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListCapacityReservations"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListCapacityReservationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListCapacityReservations").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListCapacityReservationsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listCapacityReservationsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Lists the data catalogs in the current Amazon Web Services account. *

* *

* In the Athena console, data catalogs are listed as "data sources" on the Data sources page under the * Data source name column. *

*
* * @param listDataCatalogsRequest * @return A Java Future containing the result of the ListDataCatalogs operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.ListDataCatalogs * @see AWS API * Documentation */ @Override public CompletableFuture listDataCatalogs(ListDataCatalogsRequest listDataCatalogsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listDataCatalogsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listDataCatalogsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListDataCatalogs"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListDataCatalogsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListDataCatalogs").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListDataCatalogsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listDataCatalogsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Lists the databases in the specified data catalog. *

* * @param listDatabasesRequest * @return A Java Future containing the result of the ListDatabases operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • MetadataException An exception that Athena received when it called a custom metastore. Occurs if the * error is not caused by user input (InvalidRequestException) or from the Athena platform ( * InternalServerException). For example, if a user-created Lambda function is missing * permissions, the Lambda 4XX exception is returned in a MetadataException.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.ListDatabases * @see AWS API * Documentation */ @Override public CompletableFuture listDatabases(ListDatabasesRequest listDatabasesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listDatabasesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listDatabasesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListDatabases"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListDatabasesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListDatabases").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListDatabasesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listDatabasesRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Returns a list of engine versions that are available to choose from, including the Auto option. *

* * @param listEngineVersionsRequest * @return A Java Future containing the result of the ListEngineVersions operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.ListEngineVersions * @see AWS API * Documentation */ @Override public CompletableFuture listEngineVersions(ListEngineVersionsRequest listEngineVersionsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listEngineVersionsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listEngineVersionsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListEngineVersions"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListEngineVersionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListEngineVersions").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListEngineVersionsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listEngineVersionsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Lists, in descending order, the executors that joined a session. Newer executors are listed first; older * executors are listed later. The result can be optionally filtered by state. *

* * @param listExecutorsRequest * @return A Java Future containing the result of the ListExecutors operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • ResourceNotFoundException A resource, such as a workgroup, was not found.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.ListExecutors * @see AWS API * Documentation */ @Override public CompletableFuture listExecutors(ListExecutorsRequest listExecutorsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listExecutorsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listExecutorsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListExecutors"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListExecutorsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListExecutors").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListExecutorsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listExecutorsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Provides a list of available query IDs only for queries saved in the specified workgroup. Requires that you have * access to the specified workgroup. If a workgroup is not specified, lists the saved queries for the primary * workgroup. *

* * @param listNamedQueriesRequest * @return A Java Future containing the result of the ListNamedQueries operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.ListNamedQueries * @see AWS API * Documentation */ @Override public CompletableFuture listNamedQueries(ListNamedQueriesRequest listNamedQueriesRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listNamedQueriesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listNamedQueriesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListNamedQueries"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListNamedQueriesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListNamedQueries").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListNamedQueriesRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listNamedQueriesRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Displays the notebook files for the specified workgroup in paginated format. *

* * @param listNotebookMetadataRequest * @return A Java Future containing the result of the ListNotebookMetadata operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • TooManyRequestsException Indicates that the request was throttled.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.ListNotebookMetadata * @see AWS * API Documentation */ @Override public CompletableFuture listNotebookMetadata( ListNotebookMetadataRequest listNotebookMetadataRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listNotebookMetadataRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listNotebookMetadataRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListNotebookMetadata"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListNotebookMetadataResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListNotebookMetadata").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListNotebookMetadataRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listNotebookMetadataRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Lists, in descending order, the sessions that have been created in a notebook that are in an active state like * CREATING, CREATED, IDLE or BUSY. Newer sessions are listed * first; older sessions are listed later. *

* * @param listNotebookSessionsRequest * @return A Java Future containing the result of the ListNotebookSessions operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • ResourceNotFoundException A resource, such as a workgroup, was not found.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.ListNotebookSessions * @see AWS * API Documentation */ @Override public CompletableFuture listNotebookSessions( ListNotebookSessionsRequest listNotebookSessionsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listNotebookSessionsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listNotebookSessionsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListNotebookSessions"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListNotebookSessionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListNotebookSessions").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListNotebookSessionsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listNotebookSessionsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Lists the prepared statements in the specified workgroup. *

* * @param listPreparedStatementsRequest * @return A Java Future containing the result of the ListPreparedStatements operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.ListPreparedStatements * @see AWS * API Documentation */ @Override public CompletableFuture listPreparedStatements( ListPreparedStatementsRequest listPreparedStatementsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listPreparedStatementsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listPreparedStatementsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListPreparedStatements"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListPreparedStatementsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListPreparedStatements").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListPreparedStatementsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listPreparedStatementsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Provides a list of available query execution IDs for the queries in the specified workgroup. Athena keeps a query * history for 45 days. If a workgroup is not specified, returns a list of query execution IDs for the primary * workgroup. Requires you to have access to the workgroup in which the queries ran. *

* * @param listQueryExecutionsRequest * @return A Java Future containing the result of the ListQueryExecutions operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.ListQueryExecutions * @see AWS * API Documentation */ @Override public CompletableFuture listQueryExecutions( ListQueryExecutionsRequest listQueryExecutionsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listQueryExecutionsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listQueryExecutionsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListQueryExecutions"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListQueryExecutionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListQueryExecutions").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListQueryExecutionsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listQueryExecutionsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Lists the sessions in a workgroup that are in an active state like CREATING, CREATED, * IDLE, or BUSY. Newer sessions are listed first; older sessions are listed later. *

* * @param listSessionsRequest * @return A Java Future containing the result of the ListSessions operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • ResourceNotFoundException A resource, such as a workgroup, was not found.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.ListSessions * @see AWS API * Documentation */ @Override public CompletableFuture listSessions(ListSessionsRequest listSessionsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listSessionsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listSessionsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListSessions"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListSessionsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListSessions").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListSessionsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listSessionsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Lists the metadata for the tables in the specified data catalog database. *

* * @param listTableMetadataRequest * @return A Java Future containing the result of the ListTableMetadata operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • MetadataException An exception that Athena received when it called a custom metastore. Occurs if the * error is not caused by user input (InvalidRequestException) or from the Athena platform ( * InternalServerException). For example, if a user-created Lambda function is missing * permissions, the Lambda 4XX exception is returned in a MetadataException.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.ListTableMetadata * @see AWS API * Documentation */ @Override public CompletableFuture listTableMetadata(ListTableMetadataRequest listTableMetadataRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listTableMetadataRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listTableMetadataRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTableMetadata"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListTableMetadataResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListTableMetadata").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListTableMetadataRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listTableMetadataRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Lists the tags associated with an Athena resource. *

* * @param listTagsForResourceRequest * @return A Java Future containing the result of the ListTagsForResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • ResourceNotFoundException A resource, such as a workgroup, was not found.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.ListTagsForResource * @see AWS * API Documentation */ @Override public CompletableFuture listTagsForResource( ListTagsForResourceRequest listTagsForResourceRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listTagsForResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListTagsForResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListTagsForResource").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listTagsForResourceRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Lists available workgroups for the account. *

* * @param listWorkGroupsRequest * @return A Java Future containing the result of the ListWorkGroups operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.ListWorkGroups * @see AWS API * Documentation */ @Override public CompletableFuture listWorkGroups(ListWorkGroupsRequest listWorkGroupsRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listWorkGroupsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listWorkGroupsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListWorkGroups"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListWorkGroupsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListWorkGroups").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListWorkGroupsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listWorkGroupsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Puts a new capacity assignment configuration for a specified capacity reservation. If a capacity assignment * configuration already exists for the capacity reservation, replaces the existing capacity assignment * configuration. *

* * @param putCapacityAssignmentConfigurationRequest * @return A Java Future containing the result of the PutCapacityAssignmentConfiguration operation returned by the * service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.PutCapacityAssignmentConfiguration * @see AWS API Documentation */ @Override public CompletableFuture putCapacityAssignmentConfiguration( PutCapacityAssignmentConfigurationRequest putCapacityAssignmentConfigurationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putCapacityAssignmentConfigurationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putCapacityAssignmentConfigurationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutCapacityAssignmentConfiguration"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, PutCapacityAssignmentConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("PutCapacityAssignmentConfiguration").withProtocolMetadata(protocolMetadata) .withMarshaller(new PutCapacityAssignmentConfigurationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(putCapacityAssignmentConfigurationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Submits calculations for execution within a session. You can supply the code to run as an inline code block * within the request. *

* *

* The request syntax requires the StartCalculationExecutionRequest$CodeBlock parameter or the * CalculationConfiguration$CodeBlock parameter, but not both. Because * CalculationConfiguration$CodeBlock is deprecated, use the * StartCalculationExecutionRequest$CodeBlock parameter instead. *

*
* * @param startCalculationExecutionRequest * @return A Java Future containing the result of the StartCalculationExecution operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • ResourceNotFoundException A resource, such as a workgroup, was not found.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.StartCalculationExecution * @see AWS API Documentation */ @Override public CompletableFuture startCalculationExecution( StartCalculationExecutionRequest startCalculationExecutionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(startCalculationExecutionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, startCalculationExecutionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartCalculationExecution"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StartCalculationExecutionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("StartCalculationExecution").withProtocolMetadata(protocolMetadata) .withMarshaller(new StartCalculationExecutionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(startCalculationExecutionRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Runs the SQL query statements contained in the Query. Requires you to have access to the workgroup * in which the query ran. Running queries against an external catalog requires GetDataCatalog permission to * the catalog. For code samples using the Amazon Web Services SDK for Java, see Examples and Code Samples in the * Amazon Athena User Guide. *

* * @param startQueryExecutionRequest * @return A Java Future containing the result of the StartQueryExecution operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • TooManyRequestsException Indicates that the request was throttled.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.StartQueryExecution * @see AWS * API Documentation */ @Override public CompletableFuture startQueryExecution( StartQueryExecutionRequest startQueryExecutionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(startQueryExecutionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, startQueryExecutionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartQueryExecution"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StartQueryExecutionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("StartQueryExecution").withProtocolMetadata(protocolMetadata) .withMarshaller(new StartQueryExecutionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(startQueryExecutionRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Creates a session for running calculations within a workgroup. The session is ready when it reaches an * IDLE state. *

* * @param startSessionRequest * @return A Java Future containing the result of the StartSession operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • ResourceNotFoundException A resource, such as a workgroup, was not found.
  • *
  • SessionAlreadyExistsException The specified session already exists.
  • *
  • TooManyRequestsException Indicates that the request was throttled.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.StartSession * @see AWS API * Documentation */ @Override public CompletableFuture startSession(StartSessionRequest startSessionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(startSessionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, startSessionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StartSession"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, StartSessionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("StartSession").withProtocolMetadata(protocolMetadata) .withMarshaller(new StartSessionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(startSessionRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Requests the cancellation of a calculation. A StopCalculationExecution call on a calculation that is * already in a terminal state (for example, STOPPED, FAILED, or COMPLETED) * succeeds but has no effect. *

* *

* Cancelling a calculation is done on a best effort basis. If a calculation cannot be cancelled, you can be charged * for its completion. If you are concerned about being charged for a calculation that cannot be cancelled, consider * terminating the session in which the calculation is running. *

*
* * @param stopCalculationExecutionRequest * @return A Java Future containing the result of the StopCalculationExecution operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • ResourceNotFoundException A resource, such as a workgroup, was not found.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.StopCalculationExecution * @see AWS API Documentation */ @Override public CompletableFuture stopCalculationExecution( StopCalculationExecutionRequest stopCalculationExecutionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(stopCalculationExecutionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, stopCalculationExecutionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StopCalculationExecution"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StopCalculationExecutionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("StopCalculationExecution").withProtocolMetadata(protocolMetadata) .withMarshaller(new StopCalculationExecutionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(stopCalculationExecutionRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Stops a query execution. Requires you to have access to the workgroup in which the query ran. *

* * @param stopQueryExecutionRequest * @return A Java Future containing the result of the StopQueryExecution operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.StopQueryExecution * @see AWS API * Documentation */ @Override public CompletableFuture stopQueryExecution(StopQueryExecutionRequest stopQueryExecutionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(stopQueryExecutionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, stopQueryExecutionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StopQueryExecution"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, StopQueryExecutionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("StopQueryExecution").withProtocolMetadata(protocolMetadata) .withMarshaller(new StopQueryExecutionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(stopQueryExecutionRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Adds one or more tags to an Athena resource. A tag is a label that you assign to a resource. Each tag consists of * a key and an optional value, both of which you define. For example, you can use tags to categorize Athena * workgroups, data catalogs, or capacity reservations by purpose, owner, or environment. Use a consistent set of * tag keys to make it easier to search and filter the resources in your account. For best practices, see Tagging * Best Practices. Tag keys can be from 1 to 128 UTF-8 Unicode characters, and tag values can be from 0 to 256 * UTF-8 Unicode characters. Tags can use letters and numbers representable in UTF-8, and the following characters: * + - = . _ : / @. Tag keys and values are case-sensitive. Tag keys must be unique per resource. If you specify * more than one tag, separate them by commas. *

* * @param tagResourceRequest * @return A Java Future containing the result of the TagResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • ResourceNotFoundException A resource, such as a workgroup, was not found.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.TagResource * @see AWS API * Documentation */ @Override public CompletableFuture tagResource(TagResourceRequest tagResourceRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(tagResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, tagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, TagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("TagResource").withProtocolMetadata(protocolMetadata) .withMarshaller(new TagResourceRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(tagResourceRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Terminates an active session. A TerminateSession call on a session that is already inactive (for * example, in a FAILED, TERMINATED or TERMINATING state) succeeds but has no * effect. Calculations running in the session when TerminateSession is called are forcefully stopped, * but may display as FAILED instead of STOPPED. *

* * @param terminateSessionRequest * @return A Java Future containing the result of the TerminateSession operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • ResourceNotFoundException A resource, such as a workgroup, was not found.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.TerminateSession * @see AWS API * Documentation */ @Override public CompletableFuture terminateSession(TerminateSessionRequest terminateSessionRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(terminateSessionRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, terminateSessionRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TerminateSession"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, TerminateSessionResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("TerminateSession").withProtocolMetadata(protocolMetadata) .withMarshaller(new TerminateSessionRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(terminateSessionRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Removes one or more tags from an Athena resource. *

* * @param untagResourceRequest * @return A Java Future containing the result of the UntagResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • ResourceNotFoundException A resource, such as a workgroup, was not found.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.UntagResource * @see AWS API * Documentation */ @Override public CompletableFuture untagResource(UntagResourceRequest untagResourceRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(untagResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, untagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UntagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UntagResource").withProtocolMetadata(protocolMetadata) .withMarshaller(new UntagResourceRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(untagResourceRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Updates the number of requested data processing units for the capacity reservation with the specified name. *

* * @param updateCapacityReservationRequest * @return A Java Future containing the result of the UpdateCapacityReservation operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.UpdateCapacityReservation * @see AWS API Documentation */ @Override public CompletableFuture updateCapacityReservation( UpdateCapacityReservationRequest updateCapacityReservationRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateCapacityReservationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateCapacityReservationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateCapacityReservation"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateCapacityReservationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateCapacityReservation").withProtocolMetadata(protocolMetadata) .withMarshaller(new UpdateCapacityReservationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(updateCapacityReservationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Updates the data catalog that has the specified name. *

* * @param updateDataCatalogRequest * @return A Java Future containing the result of the UpdateDataCatalog operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.UpdateDataCatalog * @see AWS API * Documentation */ @Override public CompletableFuture updateDataCatalog(UpdateDataCatalogRequest updateDataCatalogRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateDataCatalogRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateDataCatalogRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateDataCatalog"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateDataCatalogResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateDataCatalog").withProtocolMetadata(protocolMetadata) .withMarshaller(new UpdateDataCatalogRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(updateDataCatalogRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Updates a NamedQuery object. The database or workgroup cannot be updated. *

* * @param updateNamedQueryRequest * @return A Java Future containing the result of the UpdateNamedQuery operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.UpdateNamedQuery * @see AWS API * Documentation */ @Override public CompletableFuture updateNamedQuery(UpdateNamedQueryRequest updateNamedQueryRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateNamedQueryRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateNamedQueryRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateNamedQuery"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateNamedQueryResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateNamedQuery").withProtocolMetadata(protocolMetadata) .withMarshaller(new UpdateNamedQueryRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(updateNamedQueryRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Updates the contents of a Spark notebook. *

* * @param updateNotebookRequest * @return A Java Future containing the result of the UpdateNotebook operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • TooManyRequestsException Indicates that the request was throttled.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.UpdateNotebook * @see AWS API * Documentation */ @Override public CompletableFuture updateNotebook(UpdateNotebookRequest updateNotebookRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateNotebookRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateNotebookRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateNotebook"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateNotebookResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateNotebook").withProtocolMetadata(protocolMetadata) .withMarshaller(new UpdateNotebookRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(updateNotebookRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Updates the metadata for a notebook. *

* * @param updateNotebookMetadataRequest * @return A Java Future containing the result of the UpdateNotebookMetadata operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • TooManyRequestsException Indicates that the request was throttled.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.UpdateNotebookMetadata * @see AWS * API Documentation */ @Override public CompletableFuture updateNotebookMetadata( UpdateNotebookMetadataRequest updateNotebookMetadataRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateNotebookMetadataRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateNotebookMetadataRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateNotebookMetadata"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateNotebookMetadataResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateNotebookMetadata").withProtocolMetadata(protocolMetadata) .withMarshaller(new UpdateNotebookMetadataRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(updateNotebookMetadataRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Updates a prepared statement. *

* * @param updatePreparedStatementRequest * @return A Java Future containing the result of the UpdatePreparedStatement operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • ResourceNotFoundException A resource, such as a workgroup, was not found.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.UpdatePreparedStatement * @see AWS API Documentation */ @Override public CompletableFuture updatePreparedStatement( UpdatePreparedStatementRequest updatePreparedStatementRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updatePreparedStatementRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updatePreparedStatementRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdatePreparedStatement"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdatePreparedStatementResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdatePreparedStatement").withProtocolMetadata(protocolMetadata) .withMarshaller(new UpdatePreparedStatementRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(updatePreparedStatementRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Updates the workgroup with the specified name. The workgroup's name cannot be changed. Only * ConfigurationUpdates can be specified. *

* * @param updateWorkGroupRequest * @return A Java Future containing the result of the UpdateWorkGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException Indicates a platform issue, which may be due to a transient condition or * outage.
  • *
  • InvalidRequestException Indicates that something is wrong with the input to the request. For example, * a required parameter may be missing or out of range.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • AthenaException Base class for all service exceptions. Unknown exceptions will be thrown as an * instance of this type.
  • *
* @sample AthenaAsyncClient.UpdateWorkGroup * @see AWS API * Documentation */ @Override public CompletableFuture updateWorkGroup(UpdateWorkGroupRequest updateWorkGroupRequest) { SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateWorkGroupRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateWorkGroupRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Athena"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateWorkGroup"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateWorkGroupResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateWorkGroup").withProtocolMetadata(protocolMetadata) .withMarshaller(new UpdateWorkGroupRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(updateWorkGroupRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } @Override public final AthenaServiceClientConfiguration serviceClientConfiguration() { return new AthenaServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build(); } @Override public final String serviceName() { return SERVICE_NAME; } private > T init(T builder) { return builder .clientConfiguration(clientConfiguration) .defaultServiceExceptionSupplier(AthenaException::builder) .protocol(AwsJsonProtocol.AWS_JSON) .protocolVersion("1.1") .registerModeledException( ExceptionMetadata.builder().errorCode("InvalidRequestException") .exceptionBuilderSupplier(InvalidRequestException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InternalServerException") .exceptionBuilderSupplier(InternalServerException::builder).httpStatusCode(500).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ResourceNotFoundException") .exceptionBuilderSupplier(ResourceNotFoundException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("MetadataException") .exceptionBuilderSupplier(MetadataException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("SessionAlreadyExistsException") .exceptionBuilderSupplier(SessionAlreadyExistsException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("TooManyRequestsException") .exceptionBuilderSupplier(TooManyRequestsException::builder).httpStatusCode(400).build()); } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); } if (publishers == null || publishers.isEmpty()) { publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS); } if (publishers == null) { publishers = Collections.emptyList(); } return publishers; } private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { ClientOverrideConfiguration.Builder builder = configuration.asOverrideConfigurationBuilder(); RetryMode retryMode = builder.retryMode(); if (retryMode != null) { configuration.option(SdkClientOption.RETRY_STRATEGY, AwsRetryStrategy.forRetryMode(retryMode)); } else { Consumer> configurator = builder.retryStrategyConfigurator(); if (configurator != null) { RetryStrategy.Builder defaultBuilder = AwsRetryStrategy.defaultRetryStrategy().toBuilder(); configurator.accept(defaultBuilder); configuration.option(SdkClientOption.RETRY_STRATEGY, defaultBuilder.build()); } else { RetryStrategy retryStrategy = builder.retryStrategy(); if (retryStrategy != null) { configuration.option(SdkClientOption.RETRY_STRATEGY, retryStrategy); } } } configuration.option(SdkClientOption.CONFIGURED_RETRY_MODE, null); configuration.option(SdkClientOption.CONFIGURED_RETRY_STRATEGY, null); configuration.option(SdkClientOption.CONFIGURED_RETRY_CONFIGURATOR, null); } private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, SdkClientConfiguration clientConfiguration) { List plugins = request.overrideConfiguration().map(c -> c.plugins()).orElse(Collections.emptyList()); SdkClientConfiguration.Builder configuration = clientConfiguration.toBuilder(); if (plugins.isEmpty()) { return configuration.build(); } AthenaServiceClientConfigurationBuilder serviceConfigBuilder = new AthenaServiceClientConfigurationBuilder(configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } updateRetryStrategyClientConfiguration(configuration); return configuration.build(); } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata) { return protocolFactory.createErrorResponseHandler(operationMetadata); } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata, Function> exceptionMetadataMapper) { return protocolFactory.createErrorResponseHandler(operationMetadata, exceptionMetadataMapper); } @Override public void close() { clientHandler.close(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy