software.amazon.awssdk.services.cloudsearch.DefaultCloudSearchAsyncClient Maven / Gradle / Ivy
Show all versions of cloudsearch Show documentation
/*
* 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.cloudsearch;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
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.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.core.ApiName;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
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.util.VersionInfo;
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.query.AwsQueryProtocolFactory;
import software.amazon.awssdk.services.cloudsearch.model.BaseException;
import software.amazon.awssdk.services.cloudsearch.model.BuildSuggestersRequest;
import software.amazon.awssdk.services.cloudsearch.model.BuildSuggestersResponse;
import software.amazon.awssdk.services.cloudsearch.model.CloudSearchException;
import software.amazon.awssdk.services.cloudsearch.model.CloudSearchRequest;
import software.amazon.awssdk.services.cloudsearch.model.CreateDomainRequest;
import software.amazon.awssdk.services.cloudsearch.model.CreateDomainResponse;
import software.amazon.awssdk.services.cloudsearch.model.DefineAnalysisSchemeRequest;
import software.amazon.awssdk.services.cloudsearch.model.DefineAnalysisSchemeResponse;
import software.amazon.awssdk.services.cloudsearch.model.DefineExpressionRequest;
import software.amazon.awssdk.services.cloudsearch.model.DefineExpressionResponse;
import software.amazon.awssdk.services.cloudsearch.model.DefineIndexFieldRequest;
import software.amazon.awssdk.services.cloudsearch.model.DefineIndexFieldResponse;
import software.amazon.awssdk.services.cloudsearch.model.DefineSuggesterRequest;
import software.amazon.awssdk.services.cloudsearch.model.DefineSuggesterResponse;
import software.amazon.awssdk.services.cloudsearch.model.DeleteAnalysisSchemeRequest;
import software.amazon.awssdk.services.cloudsearch.model.DeleteAnalysisSchemeResponse;
import software.amazon.awssdk.services.cloudsearch.model.DeleteDomainRequest;
import software.amazon.awssdk.services.cloudsearch.model.DeleteDomainResponse;
import software.amazon.awssdk.services.cloudsearch.model.DeleteExpressionRequest;
import software.amazon.awssdk.services.cloudsearch.model.DeleteExpressionResponse;
import software.amazon.awssdk.services.cloudsearch.model.DeleteIndexFieldRequest;
import software.amazon.awssdk.services.cloudsearch.model.DeleteIndexFieldResponse;
import software.amazon.awssdk.services.cloudsearch.model.DeleteSuggesterRequest;
import software.amazon.awssdk.services.cloudsearch.model.DeleteSuggesterResponse;
import software.amazon.awssdk.services.cloudsearch.model.DescribeAnalysisSchemesRequest;
import software.amazon.awssdk.services.cloudsearch.model.DescribeAnalysisSchemesResponse;
import software.amazon.awssdk.services.cloudsearch.model.DescribeAvailabilityOptionsRequest;
import software.amazon.awssdk.services.cloudsearch.model.DescribeAvailabilityOptionsResponse;
import software.amazon.awssdk.services.cloudsearch.model.DescribeDomainEndpointOptionsRequest;
import software.amazon.awssdk.services.cloudsearch.model.DescribeDomainEndpointOptionsResponse;
import software.amazon.awssdk.services.cloudsearch.model.DescribeDomainsRequest;
import software.amazon.awssdk.services.cloudsearch.model.DescribeDomainsResponse;
import software.amazon.awssdk.services.cloudsearch.model.DescribeExpressionsRequest;
import software.amazon.awssdk.services.cloudsearch.model.DescribeExpressionsResponse;
import software.amazon.awssdk.services.cloudsearch.model.DescribeIndexFieldsRequest;
import software.amazon.awssdk.services.cloudsearch.model.DescribeIndexFieldsResponse;
import software.amazon.awssdk.services.cloudsearch.model.DescribeScalingParametersRequest;
import software.amazon.awssdk.services.cloudsearch.model.DescribeScalingParametersResponse;
import software.amazon.awssdk.services.cloudsearch.model.DescribeServiceAccessPoliciesRequest;
import software.amazon.awssdk.services.cloudsearch.model.DescribeServiceAccessPoliciesResponse;
import software.amazon.awssdk.services.cloudsearch.model.DescribeSuggestersRequest;
import software.amazon.awssdk.services.cloudsearch.model.DescribeSuggestersResponse;
import software.amazon.awssdk.services.cloudsearch.model.DisabledOperationException;
import software.amazon.awssdk.services.cloudsearch.model.IndexDocumentsRequest;
import software.amazon.awssdk.services.cloudsearch.model.IndexDocumentsResponse;
import software.amazon.awssdk.services.cloudsearch.model.InternalException;
import software.amazon.awssdk.services.cloudsearch.model.InvalidTypeException;
import software.amazon.awssdk.services.cloudsearch.model.LimitExceededException;
import software.amazon.awssdk.services.cloudsearch.model.ListDomainNamesRequest;
import software.amazon.awssdk.services.cloudsearch.model.ListDomainNamesResponse;
import software.amazon.awssdk.services.cloudsearch.model.ResourceAlreadyExistsException;
import software.amazon.awssdk.services.cloudsearch.model.ResourceNotFoundException;
import software.amazon.awssdk.services.cloudsearch.model.UpdateAvailabilityOptionsRequest;
import software.amazon.awssdk.services.cloudsearch.model.UpdateAvailabilityOptionsResponse;
import software.amazon.awssdk.services.cloudsearch.model.UpdateDomainEndpointOptionsRequest;
import software.amazon.awssdk.services.cloudsearch.model.UpdateDomainEndpointOptionsResponse;
import software.amazon.awssdk.services.cloudsearch.model.UpdateScalingParametersRequest;
import software.amazon.awssdk.services.cloudsearch.model.UpdateScalingParametersResponse;
import software.amazon.awssdk.services.cloudsearch.model.UpdateServiceAccessPoliciesRequest;
import software.amazon.awssdk.services.cloudsearch.model.UpdateServiceAccessPoliciesResponse;
import software.amazon.awssdk.services.cloudsearch.model.ValidationException;
import software.amazon.awssdk.services.cloudsearch.transform.BuildSuggestersRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.CreateDomainRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.DefineAnalysisSchemeRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.DefineExpressionRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.DefineIndexFieldRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.DefineSuggesterRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.DeleteAnalysisSchemeRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.DeleteDomainRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.DeleteExpressionRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.DeleteIndexFieldRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.DeleteSuggesterRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.DescribeAnalysisSchemesRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.DescribeAvailabilityOptionsRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.DescribeDomainEndpointOptionsRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.DescribeDomainsRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.DescribeExpressionsRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.DescribeIndexFieldsRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.DescribeScalingParametersRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.DescribeServiceAccessPoliciesRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.DescribeSuggestersRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.IndexDocumentsRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.ListDomainNamesRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.UpdateAvailabilityOptionsRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.UpdateDomainEndpointOptionsRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.UpdateScalingParametersRequestMarshaller;
import software.amazon.awssdk.services.cloudsearch.transform.UpdateServiceAccessPoliciesRequestMarshaller;
import software.amazon.awssdk.utils.CompletableFutureUtils;
/**
* Internal implementation of {@link CloudSearchAsyncClient}.
*
* @see CloudSearchAsyncClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultCloudSearchAsyncClient implements CloudSearchAsyncClient {
private static final Logger log = LoggerFactory.getLogger(DefaultCloudSearchAsyncClient.class);
private final AsyncClientHandler clientHandler;
private final AwsQueryProtocolFactory protocolFactory;
private final SdkClientConfiguration clientConfiguration;
protected DefaultCloudSearchAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration;
this.protocolFactory = init();
}
@Override
public final String serviceName() {
return SERVICE_NAME;
}
/**
*
* Indexes the search suggestions. For more information, see Configuring Suggesters in the Amazon CloudSearch Developer Guide.
*
*
* @param buildSuggestersRequest
* Container for the parameters to the BuildSuggester
operation. Specifies the name of
* the domain you want to update.
* @return A Java Future containing the result of the BuildSuggesters operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.BuildSuggesters
*/
@Override
public CompletableFuture buildSuggesters(BuildSuggestersRequest buildSuggestersRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, buildSuggestersRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "BuildSuggesters");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(BuildSuggestersResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("BuildSuggesters")
.withMarshaller(new BuildSuggestersRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(buildSuggestersRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = buildSuggestersRequest.overrideConfiguration().orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Creates a new search domain. For more information, see Creating a Search Domain in the Amazon CloudSearch Developer Guide.
*
*
* @param createDomainRequest
* Container for the parameters to the CreateDomain
operation. Specifies a name for the
* new search domain.
* @return A Java Future containing the result of the CreateDomain operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - LimitExceededException The request was rejected because a resource limit has already been met.
* - ResourceAlreadyExistsException The request was rejected because it attempted to create a resource
* that already exists.
* - ValidationException The request was rejected because it has invalid parameters.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.CreateDomain
*/
@Override
public CompletableFuture createDomain(CreateDomainRequest createDomainRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, createDomainRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateDomain");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(CreateDomainResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateDomain").withMarshaller(new CreateDomainRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(createDomainRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = createDomainRequest.overrideConfiguration().orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Configures an analysis scheme that can be applied to a text
or text-array
field to
* define language-specific text processing options. For more information, see Configuring Analysis Schemes in the Amazon CloudSearch Developer Guide.
*
*
* @param defineAnalysisSchemeRequest
* Container for the parameters to the DefineAnalysisScheme
operation. Specifies the name
* of the domain you want to update and the analysis scheme configuration.
* @return A Java Future containing the result of the DefineAnalysisScheme operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - LimitExceededException The request was rejected because a resource limit has already been met.
* - InvalidTypeException The request was rejected because it specified an invalid type definition.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.DefineAnalysisScheme
*/
@Override
public CompletableFuture defineAnalysisScheme(
DefineAnalysisSchemeRequest defineAnalysisSchemeRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, defineAnalysisSchemeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DefineAnalysisScheme");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(DefineAnalysisSchemeResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DefineAnalysisScheme")
.withMarshaller(new DefineAnalysisSchemeRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(defineAnalysisSchemeRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = defineAnalysisSchemeRequest.overrideConfiguration().orElse(
null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Configures an Expression
for the search domain. Used to create new expressions and modify
* existing ones. If the expression exists, the new configuration replaces the old one. For more information, see Configuring Expressions in the Amazon CloudSearch Developer Guide.
*
*
* @param defineExpressionRequest
* Container for the parameters to the DefineExpression
operation. Specifies the name of
* the domain you want to update and the expression you want to configure.
* @return A Java Future containing the result of the DefineExpression operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - LimitExceededException The request was rejected because a resource limit has already been met.
* - InvalidTypeException The request was rejected because it specified an invalid type definition.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.DefineExpression
*/
@Override
public CompletableFuture defineExpression(DefineExpressionRequest defineExpressionRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, defineExpressionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DefineExpression");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(DefineExpressionResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DefineExpression")
.withMarshaller(new DefineExpressionRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(defineExpressionRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = defineExpressionRequest.overrideConfiguration().orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Configures an IndexField
for the search domain. Used to create new fields and modify existing
* ones. You must specify the name of the domain you are configuring and an index field configuration. The index
* field configuration specifies a unique name, the index field type, and the options you want to configure for the
* field. The options you can specify depend on the IndexFieldType
. If the field exists, the new
* configuration replaces the old one. For more information, see Configuring Index Fields in the Amazon CloudSearch Developer Guide.
*
*
* @param defineIndexFieldRequest
* Container for the parameters to the DefineIndexField
operation. Specifies the name of
* the domain you want to update and the index field configuration.
* @return A Java Future containing the result of the DefineIndexField operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - LimitExceededException The request was rejected because a resource limit has already been met.
* - InvalidTypeException The request was rejected because it specified an invalid type definition.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.DefineIndexField
*/
@Override
public CompletableFuture defineIndexField(DefineIndexFieldRequest defineIndexFieldRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, defineIndexFieldRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DefineIndexField");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(DefineIndexFieldResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DefineIndexField")
.withMarshaller(new DefineIndexFieldRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(defineIndexFieldRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = defineIndexFieldRequest.overrideConfiguration().orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Configures a suggester for a domain. A suggester enables you to display possible matches before users finish
* typing their queries. When you configure a suggester, you must specify the name of the text field you want to
* search for possible matches and a unique name for the suggester. For more information, see Getting Search Suggestions in the Amazon CloudSearch Developer Guide.
*
*
* @param defineSuggesterRequest
* Container for the parameters to the DefineSuggester
operation. Specifies the name of
* the domain you want to update and the suggester configuration.
* @return A Java Future containing the result of the DefineSuggester operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - LimitExceededException The request was rejected because a resource limit has already been met.
* - InvalidTypeException The request was rejected because it specified an invalid type definition.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.DefineSuggester
*/
@Override
public CompletableFuture defineSuggester(DefineSuggesterRequest defineSuggesterRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, defineSuggesterRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DefineSuggester");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(DefineSuggesterResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DefineSuggester")
.withMarshaller(new DefineSuggesterRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(defineSuggesterRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = defineSuggesterRequest.overrideConfiguration().orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deletes an analysis scheme. For more information, see Configuring Analysis Schemes in the Amazon CloudSearch Developer Guide.
*
*
* @param deleteAnalysisSchemeRequest
* Container for the parameters to the DeleteAnalysisScheme
operation. Specifies the name
* of the domain you want to update and the analysis scheme you want to delete.
* @return A Java Future containing the result of the DeleteAnalysisScheme operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - InvalidTypeException The request was rejected because it specified an invalid type definition.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.DeleteAnalysisScheme
*/
@Override
public CompletableFuture deleteAnalysisScheme(
DeleteAnalysisSchemeRequest deleteAnalysisSchemeRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteAnalysisSchemeRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteAnalysisScheme");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(DeleteAnalysisSchemeResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteAnalysisScheme")
.withMarshaller(new DeleteAnalysisSchemeRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteAnalysisSchemeRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = deleteAnalysisSchemeRequest.overrideConfiguration().orElse(
null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Permanently deletes a search domain and all of its data. Once a domain has been deleted, it cannot be recovered.
* For more information, see Deleting a Search Domain in the Amazon CloudSearch Developer Guide.
*
*
* @param deleteDomainRequest
* Container for the parameters to the DeleteDomain
operation. Specifies the name of the
* domain you want to delete.
* @return A Java Future containing the result of the DeleteDomain operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.DeleteDomain
*/
@Override
public CompletableFuture deleteDomain(DeleteDomainRequest deleteDomainRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteDomainRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteDomain");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(DeleteDomainResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteDomain").withMarshaller(new DeleteDomainRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteDomainRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = deleteDomainRequest.overrideConfiguration().orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Removes an Expression
from the search domain. For more information, see Configuring Expressions in the Amazon CloudSearch Developer Guide.
*
*
* @param deleteExpressionRequest
* Container for the parameters to the DeleteExpression
operation. Specifies the name of
* the domain you want to update and the name of the expression you want to delete.
* @return A Java Future containing the result of the DeleteExpression operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - InvalidTypeException The request was rejected because it specified an invalid type definition.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.DeleteExpression
*/
@Override
public CompletableFuture deleteExpression(DeleteExpressionRequest deleteExpressionRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteExpressionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteExpression");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(DeleteExpressionResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteExpression")
.withMarshaller(new DeleteExpressionRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteExpressionRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = deleteExpressionRequest.overrideConfiguration().orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Removes an IndexField
from the search domain. For more information, see Configuring Index Fields in the Amazon CloudSearch Developer Guide.
*
*
* @param deleteIndexFieldRequest
* Container for the parameters to the DeleteIndexField
operation. Specifies the name of
* the domain you want to update and the name of the index field you want to delete.
* @return A Java Future containing the result of the DeleteIndexField operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - InvalidTypeException The request was rejected because it specified an invalid type definition.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.DeleteIndexField
*/
@Override
public CompletableFuture deleteIndexField(DeleteIndexFieldRequest deleteIndexFieldRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteIndexFieldRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteIndexField");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(DeleteIndexFieldResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteIndexField")
.withMarshaller(new DeleteIndexFieldRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteIndexFieldRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = deleteIndexFieldRequest.overrideConfiguration().orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Deletes a suggester. For more information, see Getting Search Suggestions in the Amazon CloudSearch Developer Guide.
*
*
* @param deleteSuggesterRequest
* Container for the parameters to the DeleteSuggester
operation. Specifies the name of
* the domain you want to update and name of the suggester you want to delete.
* @return A Java Future containing the result of the DeleteSuggester operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - InvalidTypeException The request was rejected because it specified an invalid type definition.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.DeleteSuggester
*/
@Override
public CompletableFuture deleteSuggester(DeleteSuggesterRequest deleteSuggesterRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteSuggesterRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteSuggester");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(DeleteSuggesterResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteSuggester")
.withMarshaller(new DeleteSuggesterRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(deleteSuggesterRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = deleteSuggesterRequest.overrideConfiguration().orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Gets the analysis schemes configured for a domain. An analysis scheme defines language-specific text processing
* options for a text
field. Can be limited to specific analysis schemes by name. By default, shows all
* analysis schemes and includes any pending changes to the configuration. Set the Deployed
option to
* true
to show the active configuration and exclude pending changes. For more information, see Configuring Analysis Schemes in the Amazon CloudSearch Developer Guide.
*
*
* @param describeAnalysisSchemesRequest
* Container for the parameters to the DescribeAnalysisSchemes
operation. Specifies the
* name of the domain you want to describe. To limit the response to particular analysis schemes, specify the
* names of the analysis schemes you want to describe. To show the active configuration and exclude any
* pending changes, set the Deployed
option to true
.
* @return A Java Future containing the result of the DescribeAnalysisSchemes operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.DescribeAnalysisSchemes
*/
@Override
public CompletableFuture describeAnalysisSchemes(
DescribeAnalysisSchemesRequest describeAnalysisSchemesRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeAnalysisSchemesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeAnalysisSchemes");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(DescribeAnalysisSchemesResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeAnalysisSchemes")
.withMarshaller(new DescribeAnalysisSchemesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeAnalysisSchemesRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = describeAnalysisSchemesRequest.overrideConfiguration()
.orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Gets the availability options configured for a domain. By default, shows the configuration with any pending
* changes. Set the Deployed
option to true
to show the active configuration and exclude
* pending changes. For more information, see Configuring Availability Options in the Amazon CloudSearch Developer Guide.
*
*
* @param describeAvailabilityOptionsRequest
* Container for the parameters to the DescribeAvailabilityOptions
operation. Specifies
* the name of the domain you want to describe. To show the active configuration and exclude any pending
* changes, set the Deployed option to true
.
* @return A Java Future containing the result of the DescribeAvailabilityOptions operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - InvalidTypeException The request was rejected because it specified an invalid type definition.
* - LimitExceededException The request was rejected because a resource limit has already been met.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - DisabledOperationException The request was rejected because it attempted an operation which is not
* enabled.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.DescribeAvailabilityOptions
*/
@Override
public CompletableFuture describeAvailabilityOptions(
DescribeAvailabilityOptionsRequest describeAvailabilityOptionsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeAvailabilityOptionsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeAvailabilityOptions");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(DescribeAvailabilityOptionsResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeAvailabilityOptions")
.withMarshaller(new DescribeAvailabilityOptionsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeAvailabilityOptionsRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = describeAvailabilityOptionsRequest.overrideConfiguration()
.orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Returns the domain's endpoint options, specifically whether all requests to the domain must arrive over HTTPS.
* For more information, see Configuring Domain Endpoint Options in the Amazon CloudSearch Developer Guide.
*
*
* @param describeDomainEndpointOptionsRequest
* Container for the parameters to the DescribeDomainEndpointOptions
operation. Specify
* the name of the domain you want to describe. To show the active configuration and exclude any pending
* changes, set the Deployed option to true
.
* @return A Java Future containing the result of the DescribeDomainEndpointOptions operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - LimitExceededException The request was rejected because a resource limit has already been met.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - DisabledOperationException The request was rejected because it attempted an operation which is not
* enabled.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.DescribeDomainEndpointOptions
*/
@Override
public CompletableFuture describeDomainEndpointOptions(
DescribeDomainEndpointOptionsRequest describeDomainEndpointOptionsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
describeDomainEndpointOptionsRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeDomainEndpointOptions");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(DescribeDomainEndpointOptionsResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeDomainEndpointOptions")
.withMarshaller(new DescribeDomainEndpointOptionsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeDomainEndpointOptionsRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = describeDomainEndpointOptionsRequest.overrideConfiguration()
.orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Gets information about the search domains owned by this account. Can be limited to specific domains. Shows all
* domains by default. To get the number of searchable documents in a domain, use the console or submit a
* matchall
request to your domain's search endpoint:
* q=matchall&q.parser=structured&size=0
. For more information, see Getting Information about a Search Domain in the Amazon CloudSearch Developer Guide.
*
*
* @param describeDomainsRequest
* Container for the parameters to the DescribeDomains
operation. By default shows the
* status of all domains. To restrict the response to particular domains, specify the names of the domains
* you want to describe.
* @return A Java Future containing the result of the DescribeDomains operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.DescribeDomains
*/
@Override
public CompletableFuture describeDomains(DescribeDomainsRequest describeDomainsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeDomainsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeDomains");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(DescribeDomainsResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeDomains")
.withMarshaller(new DescribeDomainsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeDomainsRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = describeDomainsRequest.overrideConfiguration().orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Gets the expressions configured for the search domain. Can be limited to specific expressions by name. By
* default, shows all expressions and includes any pending changes to the configuration. Set the
* Deployed
option to true
to show the active configuration and exclude pending changes.
* For more information, see Configuring Expressions in the Amazon CloudSearch Developer Guide.
*
*
* @param describeExpressionsRequest
* Container for the parameters to the DescribeDomains
operation. Specifies the name of
* the domain you want to describe. To restrict the response to particular expressions, specify the names of
* the expressions you want to describe. To show the active configuration and exclude any pending changes,
* set the Deployed
option to true
.
* @return A Java Future containing the result of the DescribeExpressions operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.DescribeExpressions
*/
@Override
public CompletableFuture describeExpressions(
DescribeExpressionsRequest describeExpressionsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeExpressionsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeExpressions");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(DescribeExpressionsResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeExpressions")
.withMarshaller(new DescribeExpressionsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeExpressionsRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = describeExpressionsRequest.overrideConfiguration().orElse(
null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Gets information about the index fields configured for the search domain. Can be limited to specific fields by
* name. By default, shows all fields and includes any pending changes to the configuration. Set the
* Deployed
option to true
to show the active configuration and exclude pending changes.
* For more information, see Getting Domain Information in the Amazon CloudSearch Developer Guide.
*
*
* @param describeIndexFieldsRequest
* Container for the parameters to the DescribeIndexFields
operation. Specifies the name
* of the domain you want to describe. To restrict the response to particular index fields, specify the names
* of the index fields you want to describe. To show the active configuration and exclude any pending
* changes, set the Deployed
option to true
.
* @return A Java Future containing the result of the DescribeIndexFields operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.DescribeIndexFields
*/
@Override
public CompletableFuture describeIndexFields(
DescribeIndexFieldsRequest describeIndexFieldsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeIndexFieldsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeIndexFields");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(DescribeIndexFieldsResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeIndexFields")
.withMarshaller(new DescribeIndexFieldsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeIndexFieldsRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = describeIndexFieldsRequest.overrideConfiguration().orElse(
null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Gets the scaling parameters configured for a domain. A domain's scaling parameters specify the desired search
* instance type and replication count. For more information, see Configuring Scaling Options in the Amazon CloudSearch Developer Guide.
*
*
* @param describeScalingParametersRequest
* Container for the parameters to the DescribeScalingParameters
operation. Specifies the
* name of the domain you want to describe.
* @return A Java Future containing the result of the DescribeScalingParameters operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.DescribeScalingParameters
*/
@Override
public CompletableFuture describeScalingParameters(
DescribeScalingParametersRequest describeScalingParametersRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeScalingParametersRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeScalingParameters");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(DescribeScalingParametersResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeScalingParameters")
.withMarshaller(new DescribeScalingParametersRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeScalingParametersRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = describeScalingParametersRequest.overrideConfiguration()
.orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Gets information about the access policies that control access to the domain's document and search endpoints. By
* default, shows the configuration with any pending changes. Set the Deployed
option to
* true
to show the active configuration and exclude pending changes. For more information, see Configuring Access for a Search Domain in the Amazon CloudSearch Developer Guide.
*
*
* @param describeServiceAccessPoliciesRequest
* Container for the parameters to the DescribeServiceAccessPolicies
operation. Specifies
* the name of the domain you want to describe. To show the active configuration and exclude any pending
* changes, set the Deployed
option to true
.
* @return A Java Future containing the result of the DescribeServiceAccessPolicies operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.DescribeServiceAccessPolicies
*/
@Override
public CompletableFuture describeServiceAccessPolicies(
DescribeServiceAccessPoliciesRequest describeServiceAccessPoliciesRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration,
describeServiceAccessPoliciesRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeServiceAccessPolicies");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(DescribeServiceAccessPoliciesResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeServiceAccessPolicies")
.withMarshaller(new DescribeServiceAccessPoliciesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeServiceAccessPoliciesRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = describeServiceAccessPoliciesRequest.overrideConfiguration()
.orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Gets the suggesters configured for a domain. A suggester enables you to display possible matches before users
* finish typing their queries. Can be limited to specific suggesters by name. By default, shows all suggesters and
* includes any pending changes to the configuration. Set the Deployed
option to true
to
* show the active configuration and exclude pending changes. For more information, see Getting Search Suggestions in the Amazon CloudSearch Developer Guide.
*
*
* @param describeSuggestersRequest
* Container for the parameters to the DescribeSuggester
operation. Specifies the name of
* the domain you want to describe. To restrict the response to particular suggesters, specify the names of
* the suggesters you want to describe. To show the active configuration and exclude any pending changes, set
* the Deployed
option to true
.
* @return A Java Future containing the result of the DescribeSuggesters operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.DescribeSuggesters
*/
@Override
public CompletableFuture describeSuggesters(DescribeSuggestersRequest describeSuggestersRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeSuggestersRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeSuggesters");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(DescribeSuggestersResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeSuggesters")
.withMarshaller(new DescribeSuggestersRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(describeSuggestersRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = describeSuggestersRequest.overrideConfiguration()
.orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Tells the search domain to start indexing its documents using the latest indexing options. This operation must be
* invoked to activate options whose OptionStatus is RequiresIndexDocuments
.
*
*
* @param indexDocumentsRequest
* Container for the parameters to the IndexDocuments
operation. Specifies the name of
* the domain you want to re-index.
* @return A Java Future containing the result of the IndexDocuments operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.IndexDocuments
*/
@Override
public CompletableFuture indexDocuments(IndexDocumentsRequest indexDocumentsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, indexDocumentsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "IndexDocuments");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(IndexDocumentsResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("IndexDocuments")
.withMarshaller(new IndexDocumentsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(indexDocumentsRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = indexDocumentsRequest.overrideConfiguration().orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Lists all search domains owned by an account.
*
*
* @param listDomainNamesRequest
* @return A Java Future containing the result of the ListDomainNames operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.ListDomainNames
*/
@Override
public CompletableFuture listDomainNames(ListDomainNamesRequest listDomainNamesRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, listDomainNamesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListDomainNames");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(ListDomainNamesResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("ListDomainNames")
.withMarshaller(new ListDomainNamesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(listDomainNamesRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = listDomainNamesRequest.overrideConfiguration().orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Configures the availability options for a domain. Enabling the Multi-AZ option expands an Amazon CloudSearch
* domain to an additional Availability Zone in the same Region to increase fault tolerance in the event of a
* service disruption. Changes to the Multi-AZ option can take about half an hour to become active. For more
* information, see Configuring Availability Options in the Amazon CloudSearch Developer Guide.
*
*
* @param updateAvailabilityOptionsRequest
* Container for the parameters to the UpdateAvailabilityOptions
operation. Specifies the
* name of the domain you want to update and the Multi-AZ availability option.
* @return A Java Future containing the result of the UpdateAvailabilityOptions operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - InvalidTypeException The request was rejected because it specified an invalid type definition.
* - LimitExceededException The request was rejected because a resource limit has already been met.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - DisabledOperationException The request was rejected because it attempted an operation which is not
* enabled.
* - ValidationException The request was rejected because it has invalid parameters.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.UpdateAvailabilityOptions
*/
@Override
public CompletableFuture updateAvailabilityOptions(
UpdateAvailabilityOptionsRequest updateAvailabilityOptionsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateAvailabilityOptionsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateAvailabilityOptions");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(UpdateAvailabilityOptionsResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateAvailabilityOptions")
.withMarshaller(new UpdateAvailabilityOptionsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(updateAvailabilityOptionsRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = updateAvailabilityOptionsRequest.overrideConfiguration()
.orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Updates the domain's endpoint options, specifically whether all requests to the domain must arrive over HTTPS.
* For more information, see Configuring Domain Endpoint Options in the Amazon CloudSearch Developer Guide.
*
*
* @param updateDomainEndpointOptionsRequest
* Container for the parameters to the UpdateDomainEndpointOptions
operation. Specifies
* the name of the domain you want to update and the domain endpoint options.
* @return A Java Future containing the result of the UpdateDomainEndpointOptions operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - InvalidTypeException The request was rejected because it specified an invalid type definition.
* - LimitExceededException The request was rejected because a resource limit has already been met.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - DisabledOperationException The request was rejected because it attempted an operation which is not
* enabled.
* - ValidationException The request was rejected because it has invalid parameters.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.UpdateDomainEndpointOptions
*/
@Override
public CompletableFuture updateDomainEndpointOptions(
UpdateDomainEndpointOptionsRequest updateDomainEndpointOptionsRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateDomainEndpointOptionsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateDomainEndpointOptions");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(UpdateDomainEndpointOptionsResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateDomainEndpointOptions")
.withMarshaller(new UpdateDomainEndpointOptionsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(updateDomainEndpointOptionsRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = updateDomainEndpointOptionsRequest.overrideConfiguration()
.orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Configures scaling parameters for a domain. A domain's scaling parameters specify the desired search instance
* type and replication count. Amazon CloudSearch will still automatically scale your domain based on the volume of
* data and traffic, but not below the desired instance type and replication count. If the Multi-AZ option is
* enabled, these values control the resources used per Availability Zone. For more information, see Configuring Scaling Options in the Amazon CloudSearch Developer Guide.
*
*
* @param updateScalingParametersRequest
* Container for the parameters to the UpdateScalingParameters
operation. Specifies the
* name of the domain you want to update and the scaling parameters you want to configure.
* @return A Java Future containing the result of the UpdateScalingParameters operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - LimitExceededException The request was rejected because a resource limit has already been met.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - InvalidTypeException The request was rejected because it specified an invalid type definition.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.UpdateScalingParameters
*/
@Override
public CompletableFuture updateScalingParameters(
UpdateScalingParametersRequest updateScalingParametersRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateScalingParametersRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateScalingParameters");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(UpdateScalingParametersResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateScalingParameters")
.withMarshaller(new UpdateScalingParametersRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(updateScalingParametersRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = updateScalingParametersRequest.overrideConfiguration()
.orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
/**
*
* Configures the access rules that control access to the domain's document and search endpoints. For more
* information, see Configuring Access for an Amazon CloudSearch Domain.
*
*
* @param updateServiceAccessPoliciesRequest
* Container for the parameters to the UpdateServiceAccessPolicies
operation. Specifies
* the name of the domain you want to update and the access rules you want to configure.
* @return A Java Future containing the result of the UpdateServiceAccessPolicies operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BaseException An error occurred while processing the request.
* - InternalException An internal error occurred while processing the request. If this problem persists,
* report an issue from the Service Health
* Dashboard.
* - LimitExceededException The request was rejected because a resource limit has already been met.
* - ResourceNotFoundException The request was rejected because it attempted to reference a resource that
* does not exist.
* - InvalidTypeException The request was rejected because it specified an invalid type definition.
* - 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.
* - CloudSearchException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample CloudSearchAsyncClient.UpdateServiceAccessPolicies
*/
@Override
public CompletableFuture updateServiceAccessPolicies(
UpdateServiceAccessPoliciesRequest updateServiceAccessPoliciesRequest) {
List metricPublishers = resolveMetricPublishers(clientConfiguration, updateServiceAccessPoliciesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudSearch");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateServiceAccessPolicies");
HttpResponseHandler responseHandler = protocolFactory
.createResponseHandler(UpdateServiceAccessPoliciesResponse::builder);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler();
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("UpdateServiceAccessPolicies")
.withMarshaller(new UpdateServiceAccessPoliciesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withMetricCollector(apiCallMetricCollector).withInput(updateServiceAccessPoliciesRequest));
AwsRequestOverrideConfiguration requestOverrideConfig = updateServiceAccessPoliciesRequest.overrideConfiguration()
.orElse(null);
CompletableFuture whenCompleteFuture = null;
whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
});
return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
} catch (Throwable t) {
metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
return CompletableFutureUtils.failedFuture(t);
}
}
@Override
public void close() {
clientHandler.close();
}
private AwsQueryProtocolFactory init() {
return AwsQueryProtocolFactory
.builder()
.registerModeledException(
ExceptionMetadata.builder().errorCode("DisabledAction")
.exceptionBuilderSupplier(DisabledOperationException::builder).httpStatusCode(409).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("LimitExceeded")
.exceptionBuilderSupplier(LimitExceededException::builder).httpStatusCode(409).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InvalidType")
.exceptionBuilderSupplier(InvalidTypeException::builder).httpStatusCode(409).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceNotFound")
.exceptionBuilderSupplier(ResourceNotFoundException::builder).httpStatusCode(409).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ValidationException")
.exceptionBuilderSupplier(ValidationException::builder).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("BaseException").exceptionBuilderSupplier(BaseException::builder)
.build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("ResourceAlreadyExists")
.exceptionBuilderSupplier(ResourceAlreadyExistsException::builder).httpStatusCode(409).build())
.registerModeledException(
ExceptionMetadata.builder().errorCode("InternalException")
.exceptionBuilderSupplier(InternalException::builder).httpStatusCode(500).build())
.clientConfiguration(clientConfiguration).defaultServiceExceptionSupplier(CloudSearchException::builder).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 T applyPaginatorUserAgent(T request) {
Consumer userAgentApplier = b -> b.addApiName(ApiName.builder()
.version(VersionInfo.SDK_VERSION).name("PAGINATED").build());
AwsRequestOverrideConfiguration overrideConfiguration = request.overrideConfiguration()
.map(c -> c.toBuilder().applyMutation(userAgentApplier).build())
.orElse((AwsRequestOverrideConfiguration.builder().applyMutation(userAgentApplier).build()));
return (T) request.toBuilder().overrideConfiguration(overrideConfiguration).build();
}
}