com.amazonaws.services.comprehend.AmazonComprehendClient Maven / Gradle / Ivy
Show all versions of aws-java-sdk-comprehend Show documentation
/*
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.comprehend;
import org.w3c.dom.*;
import java.net.*;
import java.util.*;
import javax.annotation.Generated;
import org.apache.commons.logging.*;
import com.amazonaws.*;
import com.amazonaws.annotation.SdkInternalApi;
import com.amazonaws.auth.*;
import com.amazonaws.handlers.*;
import com.amazonaws.http.*;
import com.amazonaws.internal.*;
import com.amazonaws.internal.auth.*;
import com.amazonaws.metrics.*;
import com.amazonaws.regions.*;
import com.amazonaws.transform.*;
import com.amazonaws.util.*;
import com.amazonaws.protocol.json.*;
import com.amazonaws.util.AWSRequestMetrics.Field;
import com.amazonaws.annotation.ThreadSafe;
import com.amazonaws.client.AwsSyncClientParams;
import com.amazonaws.client.builder.AdvancedConfig;
import com.amazonaws.services.comprehend.AmazonComprehendClientBuilder;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.services.comprehend.model.*;
import com.amazonaws.services.comprehend.model.transform.*;
/**
* Client for accessing Amazon Comprehend. All service calls made using this client are blocking, and will not return
* until the service call completes.
*
*
* Amazon Comprehend is an Amazon Web Services service for gaining insight into the content of documents. Use these
* actions to determine the topics contained in your documents, the topics they discuss, the predominant sentiment
* expressed in them, the predominant language used, and more.
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AmazonComprehendClient extends AmazonWebServiceClient implements AmazonComprehend {
/** Provider for AWS credentials. */
private final AWSCredentialsProvider awsCredentialsProvider;
private static final Log log = LogFactory.getLog(AmazonComprehend.class);
/** Default signing name for the service. */
private static final String DEFAULT_SIGNING_NAME = "comprehend";
/** Client configuration factory providing ClientConfigurations tailored to this client */
protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory();
private final AdvancedConfig advancedConfig;
private static final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory = new com.amazonaws.protocol.json.SdkJsonProtocolFactory(
new JsonClientMetadata()
.withProtocolVersion("1.1")
.withSupportsCbor(false)
.withSupportsIon(false)
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ConcurrentModificationException").withExceptionUnmarshaller(
com.amazonaws.services.comprehend.model.transform.ConcurrentModificationExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("InvalidRequestException").withExceptionUnmarshaller(
com.amazonaws.services.comprehend.model.transform.InvalidRequestExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("KmsKeyValidationException").withExceptionUnmarshaller(
com.amazonaws.services.comprehend.model.transform.KmsKeyValidationExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("InvalidFilterException").withExceptionUnmarshaller(
com.amazonaws.services.comprehend.model.transform.InvalidFilterExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("TooManyTagKeysException").withExceptionUnmarshaller(
com.amazonaws.services.comprehend.model.transform.TooManyTagKeysExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("UnsupportedLanguageException").withExceptionUnmarshaller(
com.amazonaws.services.comprehend.model.transform.UnsupportedLanguageExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("InternalServerException").withExceptionUnmarshaller(
com.amazonaws.services.comprehend.model.transform.InternalServerExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ResourceNotFoundException").withExceptionUnmarshaller(
com.amazonaws.services.comprehend.model.transform.ResourceNotFoundExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ResourceUnavailableException").withExceptionUnmarshaller(
com.amazonaws.services.comprehend.model.transform.ResourceUnavailableExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ResourceLimitExceededException").withExceptionUnmarshaller(
com.amazonaws.services.comprehend.model.transform.ResourceLimitExceededExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ResourceInUseException").withExceptionUnmarshaller(
com.amazonaws.services.comprehend.model.transform.ResourceInUseExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("BatchSizeLimitExceededException").withExceptionUnmarshaller(
com.amazonaws.services.comprehend.model.transform.BatchSizeLimitExceededExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("TextSizeLimitExceededException").withExceptionUnmarshaller(
com.amazonaws.services.comprehend.model.transform.TextSizeLimitExceededExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("TooManyTagsException").withExceptionUnmarshaller(
com.amazonaws.services.comprehend.model.transform.TooManyTagsExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("JobNotFoundException").withExceptionUnmarshaller(
com.amazonaws.services.comprehend.model.transform.JobNotFoundExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("TooManyRequestsException").withExceptionUnmarshaller(
com.amazonaws.services.comprehend.model.transform.TooManyRequestsExceptionUnmarshaller.getInstance()))
.withBaseServiceExceptionClass(com.amazonaws.services.comprehend.model.AmazonComprehendException.class));
public static AmazonComprehendClientBuilder builder() {
return AmazonComprehendClientBuilder.standard();
}
/**
* Constructs a new client to invoke service methods on Amazon Comprehend using the specified parameters.
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AmazonComprehendClient(AwsSyncClientParams clientParams) {
this(clientParams, false);
}
/**
* Constructs a new client to invoke service methods on Amazon Comprehend using the specified parameters.
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AmazonComprehendClient(AwsSyncClientParams clientParams, boolean endpointDiscoveryEnabled) {
super(clientParams);
this.awsCredentialsProvider = clientParams.getCredentialsProvider();
this.advancedConfig = clientParams.getAdvancedConfig();
init();
}
private void init() {
setServiceNameIntern(DEFAULT_SIGNING_NAME);
setEndpointPrefix(ENDPOINT_PREFIX);
// calling this.setEndPoint(...) will also modify the signer accordingly
setEndpoint("comprehend.us-east-1.amazonaws.com");
HandlerChainFactory chainFactory = new HandlerChainFactory();
requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/comprehend/request.handlers"));
requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/comprehend/request.handler2s"));
requestHandler2s.addAll(chainFactory.getGlobalHandlers());
}
/**
*
* Determines the dominant language of the input text for a batch of documents. For a list of languages that Amazon
* Comprehend can detect, see Amazon
* Comprehend Supported Languages.
*
*
* @param batchDetectDominantLanguageRequest
* @return Result of the BatchDetectDominantLanguage operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TextSizeLimitExceededException
* The size of the input text exceeds the limit. Use a smaller document.
* @throws BatchSizeLimitExceededException
* The number of documents in the request exceeds the limit of 25. Try your request again with fewer
* documents.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.BatchDetectDominantLanguage
* @see AWS API Documentation
*/
@Override
public BatchDetectDominantLanguageResult batchDetectDominantLanguage(BatchDetectDominantLanguageRequest request) {
request = beforeClientExecution(request);
return executeBatchDetectDominantLanguage(request);
}
@SdkInternalApi
final BatchDetectDominantLanguageResult executeBatchDetectDominantLanguage(BatchDetectDominantLanguageRequest batchDetectDominantLanguageRequest) {
ExecutionContext executionContext = createExecutionContext(batchDetectDominantLanguageRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new BatchDetectDominantLanguageRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(batchDetectDominantLanguageRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "BatchDetectDominantLanguage");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new BatchDetectDominantLanguageResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Inspects the text of a batch of documents for named entities and returns information about them. For more
* information about named entities, see Entities in the Comprehend
* Developer Guide.
*
*
* @param batchDetectEntitiesRequest
* @return Result of the BatchDetectEntities operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TextSizeLimitExceededException
* The size of the input text exceeds the limit. Use a smaller document.
* @throws UnsupportedLanguageException
* Amazon Comprehend can't process the language of the input text. For custom entity recognition APIs, only
* English, Spanish, French, Italian, German, or Portuguese are accepted. For a list of supported languages,
* Supported
* languages in the Comprehend Developer Guide.
* @throws BatchSizeLimitExceededException
* The number of documents in the request exceeds the limit of 25. Try your request again with fewer
* documents.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.BatchDetectEntities
* @see AWS
* API Documentation
*/
@Override
public BatchDetectEntitiesResult batchDetectEntities(BatchDetectEntitiesRequest request) {
request = beforeClientExecution(request);
return executeBatchDetectEntities(request);
}
@SdkInternalApi
final BatchDetectEntitiesResult executeBatchDetectEntities(BatchDetectEntitiesRequest batchDetectEntitiesRequest) {
ExecutionContext executionContext = createExecutionContext(batchDetectEntitiesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new BatchDetectEntitiesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(batchDetectEntitiesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "BatchDetectEntities");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new BatchDetectEntitiesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Detects the key noun phrases found in a batch of documents.
*
*
* @param batchDetectKeyPhrasesRequest
* @return Result of the BatchDetectKeyPhrases operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TextSizeLimitExceededException
* The size of the input text exceeds the limit. Use a smaller document.
* @throws UnsupportedLanguageException
* Amazon Comprehend can't process the language of the input text. For custom entity recognition APIs, only
* English, Spanish, French, Italian, German, or Portuguese are accepted. For a list of supported languages,
* Supported
* languages in the Comprehend Developer Guide.
* @throws BatchSizeLimitExceededException
* The number of documents in the request exceeds the limit of 25. Try your request again with fewer
* documents.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.BatchDetectKeyPhrases
* @see AWS API Documentation
*/
@Override
public BatchDetectKeyPhrasesResult batchDetectKeyPhrases(BatchDetectKeyPhrasesRequest request) {
request = beforeClientExecution(request);
return executeBatchDetectKeyPhrases(request);
}
@SdkInternalApi
final BatchDetectKeyPhrasesResult executeBatchDetectKeyPhrases(BatchDetectKeyPhrasesRequest batchDetectKeyPhrasesRequest) {
ExecutionContext executionContext = createExecutionContext(batchDetectKeyPhrasesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new BatchDetectKeyPhrasesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(batchDetectKeyPhrasesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "BatchDetectKeyPhrases");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new BatchDetectKeyPhrasesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Inspects a batch of documents and returns an inference of the prevailing sentiment, POSITIVE
,
* NEUTRAL
, MIXED
, or NEGATIVE
, in each one.
*
*
* @param batchDetectSentimentRequest
* @return Result of the BatchDetectSentiment operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TextSizeLimitExceededException
* The size of the input text exceeds the limit. Use a smaller document.
* @throws UnsupportedLanguageException
* Amazon Comprehend can't process the language of the input text. For custom entity recognition APIs, only
* English, Spanish, French, Italian, German, or Portuguese are accepted. For a list of supported languages,
* Supported
* languages in the Comprehend Developer Guide.
* @throws BatchSizeLimitExceededException
* The number of documents in the request exceeds the limit of 25. Try your request again with fewer
* documents.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.BatchDetectSentiment
* @see AWS API Documentation
*/
@Override
public BatchDetectSentimentResult batchDetectSentiment(BatchDetectSentimentRequest request) {
request = beforeClientExecution(request);
return executeBatchDetectSentiment(request);
}
@SdkInternalApi
final BatchDetectSentimentResult executeBatchDetectSentiment(BatchDetectSentimentRequest batchDetectSentimentRequest) {
ExecutionContext executionContext = createExecutionContext(batchDetectSentimentRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new BatchDetectSentimentRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(batchDetectSentimentRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "BatchDetectSentiment");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new BatchDetectSentimentResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Inspects the text of a batch of documents for the syntax and part of speech of the words in the document and
* returns information about them. For more information, see Syntax in the Comprehend Developer
* Guide.
*
*
* @param batchDetectSyntaxRequest
* @return Result of the BatchDetectSyntax operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TextSizeLimitExceededException
* The size of the input text exceeds the limit. Use a smaller document.
* @throws UnsupportedLanguageException
* Amazon Comprehend can't process the language of the input text. For custom entity recognition APIs, only
* English, Spanish, French, Italian, German, or Portuguese are accepted. For a list of supported languages,
* Supported
* languages in the Comprehend Developer Guide.
* @throws BatchSizeLimitExceededException
* The number of documents in the request exceeds the limit of 25. Try your request again with fewer
* documents.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.BatchDetectSyntax
* @see AWS
* API Documentation
*/
@Override
public BatchDetectSyntaxResult batchDetectSyntax(BatchDetectSyntaxRequest request) {
request = beforeClientExecution(request);
return executeBatchDetectSyntax(request);
}
@SdkInternalApi
final BatchDetectSyntaxResult executeBatchDetectSyntax(BatchDetectSyntaxRequest batchDetectSyntaxRequest) {
ExecutionContext executionContext = createExecutionContext(batchDetectSyntaxRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new BatchDetectSyntaxRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(batchDetectSyntaxRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "BatchDetectSyntax");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new BatchDetectSyntaxResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Inspects a batch of documents and returns a sentiment analysis for each entity identified in the documents.
*
*
* For more information about targeted sentiment, see Targeted sentiment in the
* Amazon Comprehend Developer Guide.
*
*
* @param batchDetectTargetedSentimentRequest
* @return Result of the BatchDetectTargetedSentiment operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TextSizeLimitExceededException
* The size of the input text exceeds the limit. Use a smaller document.
* @throws UnsupportedLanguageException
* Amazon Comprehend can't process the language of the input text. For custom entity recognition APIs, only
* English, Spanish, French, Italian, German, or Portuguese are accepted. For a list of supported languages,
* Supported
* languages in the Comprehend Developer Guide.
* @throws BatchSizeLimitExceededException
* The number of documents in the request exceeds the limit of 25. Try your request again with fewer
* documents.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.BatchDetectTargetedSentiment
* @see AWS API Documentation
*/
@Override
public BatchDetectTargetedSentimentResult batchDetectTargetedSentiment(BatchDetectTargetedSentimentRequest request) {
request = beforeClientExecution(request);
return executeBatchDetectTargetedSentiment(request);
}
@SdkInternalApi
final BatchDetectTargetedSentimentResult executeBatchDetectTargetedSentiment(BatchDetectTargetedSentimentRequest batchDetectTargetedSentimentRequest) {
ExecutionContext executionContext = createExecutionContext(batchDetectTargetedSentimentRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new BatchDetectTargetedSentimentRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(batchDetectTargetedSentimentRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "BatchDetectTargetedSentiment");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new BatchDetectTargetedSentimentResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates a classification request to analyze a single document in real-time. ClassifyDocument
* supports the following model types:
*
*
* -
*
* Custom classifier - a custom model that you have created and trained. For input, you can provide plain text, a
* single-page document (PDF, Word, or image), or Textract API output. For more information, see Custom
* classification in the Amazon Comprehend Developer Guide.
*
*
* -
*
* Prompt classifier - Amazon Comprehend provides a model for classifying prompts. For input, you provide English
* plain text input. For prompt classification, the response includes only the Classes
field. For more
* information about prompt classifiers, see Prompt classifiers in the
* Amazon Comprehend Developer Guide.
*
*
*
*
* If the system detects errors while processing a page in the input document, the API response includes an entry in
* Errors
that describes the errors.
*
*
* If the system detects a document-level error in your input document, the API returns an
* InvalidRequestException
error response. For details about this exception, see Errors in semi-structured
* documents in the Comprehend Developer Guide.
*
*
* @param classifyDocumentRequest
* @return Result of the ClassifyDocument operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws ResourceUnavailableException
* The specified resource is not available. Check the resource and try your request again.
* @throws TextSizeLimitExceededException
* The size of the input text exceeds the limit. Use a smaller document.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.ClassifyDocument
* @see AWS
* API Documentation
*/
@Override
public ClassifyDocumentResult classifyDocument(ClassifyDocumentRequest request) {
request = beforeClientExecution(request);
return executeClassifyDocument(request);
}
@SdkInternalApi
final ClassifyDocumentResult executeClassifyDocument(ClassifyDocumentRequest classifyDocumentRequest) {
ExecutionContext executionContext = createExecutionContext(classifyDocumentRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ClassifyDocumentRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(classifyDocumentRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ClassifyDocument");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ClassifyDocumentResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Analyzes input text for the presence of personally identifiable information (PII) and returns the labels of
* identified PII entity types such as name, address, bank account number, or phone number.
*
*
* @param containsPiiEntitiesRequest
* @return Result of the ContainsPiiEntities operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TextSizeLimitExceededException
* The size of the input text exceeds the limit. Use a smaller document.
* @throws UnsupportedLanguageException
* Amazon Comprehend can't process the language of the input text. For custom entity recognition APIs, only
* English, Spanish, French, Italian, German, or Portuguese are accepted. For a list of supported languages,
* Supported
* languages in the Comprehend Developer Guide.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.ContainsPiiEntities
* @see AWS
* API Documentation
*/
@Override
public ContainsPiiEntitiesResult containsPiiEntities(ContainsPiiEntitiesRequest request) {
request = beforeClientExecution(request);
return executeContainsPiiEntities(request);
}
@SdkInternalApi
final ContainsPiiEntitiesResult executeContainsPiiEntities(ContainsPiiEntitiesRequest containsPiiEntitiesRequest) {
ExecutionContext executionContext = createExecutionContext(containsPiiEntitiesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ContainsPiiEntitiesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(containsPiiEntitiesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ContainsPiiEntities");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ContainsPiiEntitiesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates a dataset to upload training or test data for a model associated with a flywheel. For more information
* about datasets, see Flywheel
* overview in the Amazon Comprehend Developer Guide.
*
*
* @param createDatasetRequest
* @return Result of the CreateDataset operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws ResourceInUseException
* The specified resource name is already in use. Use a different name and try your request again.
* @throws TooManyTagsException
* The request contains more tags than can be associated with a resource (50 tags per resource). The maximum
* number of tags includes both existing tags and those included in your current request.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws ResourceLimitExceededException
* The maximum number of resources per account has been exceeded. Review the resources, and then try your
* request again.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.CreateDataset
* @see AWS API
* Documentation
*/
@Override
public CreateDatasetResult createDataset(CreateDatasetRequest request) {
request = beforeClientExecution(request);
return executeCreateDataset(request);
}
@SdkInternalApi
final CreateDatasetResult executeCreateDataset(CreateDatasetRequest createDatasetRequest) {
ExecutionContext executionContext = createExecutionContext(createDatasetRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateDatasetRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createDatasetRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateDataset");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateDatasetResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates a new document classifier that you can use to categorize documents. To create a classifier, you provide a
* set of training documents that are labeled with the categories that you want to use. For more information, see Training classifier
* models in the Comprehend Developer Guide.
*
*
* @param createDocumentClassifierRequest
* @return Result of the CreateDocumentClassifier operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws ResourceInUseException
* The specified resource name is already in use. Use a different name and try your request again.
* @throws TooManyTagsException
* The request contains more tags than can be associated with a resource (50 tags per resource). The maximum
* number of tags includes both existing tags and those included in your current request.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws ResourceLimitExceededException
* The maximum number of resources per account has been exceeded. Review the resources, and then try your
* request again.
* @throws UnsupportedLanguageException
* Amazon Comprehend can't process the language of the input text. For custom entity recognition APIs, only
* English, Spanish, French, Italian, German, or Portuguese are accepted. For a list of supported languages,
* Supported
* languages in the Comprehend Developer Guide.
* @throws KmsKeyValidationException
* The KMS customer managed key (CMK) entered cannot be validated. Verify the key and re-enter it.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.CreateDocumentClassifier
* @see AWS API Documentation
*/
@Override
public CreateDocumentClassifierResult createDocumentClassifier(CreateDocumentClassifierRequest request) {
request = beforeClientExecution(request);
return executeCreateDocumentClassifier(request);
}
@SdkInternalApi
final CreateDocumentClassifierResult executeCreateDocumentClassifier(CreateDocumentClassifierRequest createDocumentClassifierRequest) {
ExecutionContext executionContext = createExecutionContext(createDocumentClassifierRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateDocumentClassifierRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(createDocumentClassifierRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateDocumentClassifier");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new CreateDocumentClassifierResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates a model-specific endpoint for synchronous inference for a previously trained custom model For information
* about endpoints, see Managing
* endpoints.
*
*
* @param createEndpointRequest
* @return Result of the CreateEndpoint operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws ResourceInUseException
* The specified resource name is already in use. Use a different name and try your request again.
* @throws ResourceLimitExceededException
* The maximum number of resources per account has been exceeded. Review the resources, and then try your
* request again.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws ResourceUnavailableException
* The specified resource is not available. Check the resource and try your request again.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws TooManyTagsException
* The request contains more tags than can be associated with a resource (50 tags per resource). The maximum
* number of tags includes both existing tags and those included in your current request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.CreateEndpoint
* @see AWS API
* Documentation
*/
@Override
public CreateEndpointResult createEndpoint(CreateEndpointRequest request) {
request = beforeClientExecution(request);
return executeCreateEndpoint(request);
}
@SdkInternalApi
final CreateEndpointResult executeCreateEndpoint(CreateEndpointRequest createEndpointRequest) {
ExecutionContext executionContext = createExecutionContext(createEndpointRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateEndpointRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createEndpointRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateEndpoint");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateEndpointResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates an entity recognizer using submitted files. After your CreateEntityRecognizer
request is
* submitted, you can check job status using the DescribeEntityRecognizer
API.
*
*
* @param createEntityRecognizerRequest
* @return Result of the CreateEntityRecognizer operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws ResourceInUseException
* The specified resource name is already in use. Use a different name and try your request again.
* @throws TooManyTagsException
* The request contains more tags than can be associated with a resource (50 tags per resource). The maximum
* number of tags includes both existing tags and those included in your current request.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws ResourceLimitExceededException
* The maximum number of resources per account has been exceeded. Review the resources, and then try your
* request again.
* @throws UnsupportedLanguageException
* Amazon Comprehend can't process the language of the input text. For custom entity recognition APIs, only
* English, Spanish, French, Italian, German, or Portuguese are accepted. For a list of supported languages,
* Supported
* languages in the Comprehend Developer Guide.
* @throws KmsKeyValidationException
* The KMS customer managed key (CMK) entered cannot be validated. Verify the key and re-enter it.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.CreateEntityRecognizer
* @see AWS API Documentation
*/
@Override
public CreateEntityRecognizerResult createEntityRecognizer(CreateEntityRecognizerRequest request) {
request = beforeClientExecution(request);
return executeCreateEntityRecognizer(request);
}
@SdkInternalApi
final CreateEntityRecognizerResult executeCreateEntityRecognizer(CreateEntityRecognizerRequest createEntityRecognizerRequest) {
ExecutionContext executionContext = createExecutionContext(createEntityRecognizerRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateEntityRecognizerRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createEntityRecognizerRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateEntityRecognizer");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new CreateEntityRecognizerResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* A flywheel is an Amazon Web Services resource that orchestrates the ongoing training of a model for custom
* classification or custom entity recognition. You can create a flywheel to start with an existing trained model,
* or Comprehend can create and train a new model.
*
*
* When you create the flywheel, Comprehend creates a data lake in your account. The data lake holds the training
* data and test data for all versions of the model.
*
*
* To use a flywheel with an existing trained model, you specify the active model version. Comprehend copies the
* model's training data and test data into the flywheel's data lake.
*
*
* To use the flywheel with a new model, you need to provide a dataset for training data (and optional test data)
* when you create the flywheel.
*
*
* For more information about flywheels, see Flywheel overview in the
* Amazon Comprehend Developer Guide.
*
*
* @param createFlywheelRequest
* @return Result of the CreateFlywheel operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws ResourceInUseException
* The specified resource name is already in use. Use a different name and try your request again.
* @throws TooManyTagsException
* The request contains more tags than can be associated with a resource (50 tags per resource). The maximum
* number of tags includes both existing tags and those included in your current request.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws ResourceLimitExceededException
* The maximum number of resources per account has been exceeded. Review the resources, and then try your
* request again.
* @throws UnsupportedLanguageException
* Amazon Comprehend can't process the language of the input text. For custom entity recognition APIs, only
* English, Spanish, French, Italian, German, or Portuguese are accepted. For a list of supported languages,
* Supported
* languages in the Comprehend Developer Guide.
* @throws KmsKeyValidationException
* The KMS customer managed key (CMK) entered cannot be validated. Verify the key and re-enter it.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws ResourceUnavailableException
* The specified resource is not available. Check the resource and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.CreateFlywheel
* @see AWS API
* Documentation
*/
@Override
public CreateFlywheelResult createFlywheel(CreateFlywheelRequest request) {
request = beforeClientExecution(request);
return executeCreateFlywheel(request);
}
@SdkInternalApi
final CreateFlywheelResult executeCreateFlywheel(CreateFlywheelRequest createFlywheelRequest) {
ExecutionContext executionContext = createExecutionContext(createFlywheelRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateFlywheelRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createFlywheelRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateFlywheel");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateFlywheelResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes a previously created document classifier
*
*
* Only those classifiers that are in terminated states (IN_ERROR, TRAINED) will be deleted. If an active inference
* job is using the model, a ResourceInUseException
will be returned.
*
*
* This is an asynchronous action that puts the classifier into a DELETING state, and it is then removed by a
* background job. Once removed, the classifier disappears from your account and is no longer available for use.
*
*
* @param deleteDocumentClassifierRequest
* @return Result of the DeleteDocumentClassifier operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws ResourceUnavailableException
* The specified resource is not available. Check the resource and try your request again.
* @throws ResourceInUseException
* The specified resource name is already in use. Use a different name and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DeleteDocumentClassifier
* @see AWS API Documentation
*/
@Override
public DeleteDocumentClassifierResult deleteDocumentClassifier(DeleteDocumentClassifierRequest request) {
request = beforeClientExecution(request);
return executeDeleteDocumentClassifier(request);
}
@SdkInternalApi
final DeleteDocumentClassifierResult executeDeleteDocumentClassifier(DeleteDocumentClassifierRequest deleteDocumentClassifierRequest) {
ExecutionContext executionContext = createExecutionContext(deleteDocumentClassifierRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteDocumentClassifierRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(deleteDocumentClassifierRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteDocumentClassifier");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DeleteDocumentClassifierResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes a model-specific endpoint for a previously-trained custom model. All endpoints must be deleted in order
* for the model to be deleted. For information about endpoints, see Managing endpoints.
*
*
* @param deleteEndpointRequest
* @return Result of the DeleteEndpoint operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws ResourceInUseException
* The specified resource name is already in use. Use a different name and try your request again.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DeleteEndpoint
* @see AWS API
* Documentation
*/
@Override
public DeleteEndpointResult deleteEndpoint(DeleteEndpointRequest request) {
request = beforeClientExecution(request);
return executeDeleteEndpoint(request);
}
@SdkInternalApi
final DeleteEndpointResult executeDeleteEndpoint(DeleteEndpointRequest deleteEndpointRequest) {
ExecutionContext executionContext = createExecutionContext(deleteEndpointRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteEndpointRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteEndpointRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteEndpoint");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteEndpointResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes an entity recognizer.
*
*
* Only those recognizers that are in terminated states (IN_ERROR, TRAINED) will be deleted. If an active inference
* job is using the model, a ResourceInUseException
will be returned.
*
*
* This is an asynchronous action that puts the recognizer into a DELETING state, and it is then removed by a
* background job. Once removed, the recognizer disappears from your account and is no longer available for use.
*
*
* @param deleteEntityRecognizerRequest
* @return Result of the DeleteEntityRecognizer operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws ResourceUnavailableException
* The specified resource is not available. Check the resource and try your request again.
* @throws ResourceInUseException
* The specified resource name is already in use. Use a different name and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DeleteEntityRecognizer
* @see AWS API Documentation
*/
@Override
public DeleteEntityRecognizerResult deleteEntityRecognizer(DeleteEntityRecognizerRequest request) {
request = beforeClientExecution(request);
return executeDeleteEntityRecognizer(request);
}
@SdkInternalApi
final DeleteEntityRecognizerResult executeDeleteEntityRecognizer(DeleteEntityRecognizerRequest deleteEntityRecognizerRequest) {
ExecutionContext executionContext = createExecutionContext(deleteEntityRecognizerRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteEntityRecognizerRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteEntityRecognizerRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteEntityRecognizer");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DeleteEntityRecognizerResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes a flywheel. When you delete the flywheel, Amazon Comprehend does not delete the data lake or the model
* associated with the flywheel.
*
*
* For more information about flywheels, see Flywheel overview in the
* Amazon Comprehend Developer Guide.
*
*
* @param deleteFlywheelRequest
* @return Result of the DeleteFlywheel operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws ResourceUnavailableException
* The specified resource is not available. Check the resource and try your request again.
* @throws ResourceInUseException
* The specified resource name is already in use. Use a different name and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DeleteFlywheel
* @see AWS API
* Documentation
*/
@Override
public DeleteFlywheelResult deleteFlywheel(DeleteFlywheelRequest request) {
request = beforeClientExecution(request);
return executeDeleteFlywheel(request);
}
@SdkInternalApi
final DeleteFlywheelResult executeDeleteFlywheel(DeleteFlywheelRequest deleteFlywheelRequest) {
ExecutionContext executionContext = createExecutionContext(deleteFlywheelRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteFlywheelRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteFlywheelRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteFlywheel");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteFlywheelResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes a resource-based policy that is attached to a custom model.
*
*
* @param deleteResourcePolicyRequest
* @return Result of the DeleteResourcePolicy operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DeleteResourcePolicy
* @see AWS API Documentation
*/
@Override
public DeleteResourcePolicyResult deleteResourcePolicy(DeleteResourcePolicyRequest request) {
request = beforeClientExecution(request);
return executeDeleteResourcePolicy(request);
}
@SdkInternalApi
final DeleteResourcePolicyResult executeDeleteResourcePolicy(DeleteResourcePolicyRequest deleteResourcePolicyRequest) {
ExecutionContext executionContext = createExecutionContext(deleteResourcePolicyRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteResourcePolicyRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteResourcePolicyRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteResourcePolicy");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteResourcePolicyResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns information about the dataset that you specify. For more information about datasets, see Flywheel overview in the
* Amazon Comprehend Developer Guide.
*
*
* @param describeDatasetRequest
* @return Result of the DescribeDataset operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DescribeDataset
* @see AWS API
* Documentation
*/
@Override
public DescribeDatasetResult describeDataset(DescribeDatasetRequest request) {
request = beforeClientExecution(request);
return executeDescribeDataset(request);
}
@SdkInternalApi
final DescribeDatasetResult executeDescribeDataset(DescribeDatasetRequest describeDatasetRequest) {
ExecutionContext executionContext = createExecutionContext(describeDatasetRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeDatasetRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeDatasetRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeDataset");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeDatasetResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets the properties associated with a document classification job. Use this operation to get the status of a
* classification job.
*
*
* @param describeDocumentClassificationJobRequest
* @return Result of the DescribeDocumentClassificationJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws JobNotFoundException
* The specified job was not found. Check the job ID and try again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DescribeDocumentClassificationJob
* @see AWS API Documentation
*/
@Override
public DescribeDocumentClassificationJobResult describeDocumentClassificationJob(DescribeDocumentClassificationJobRequest request) {
request = beforeClientExecution(request);
return executeDescribeDocumentClassificationJob(request);
}
@SdkInternalApi
final DescribeDocumentClassificationJobResult executeDescribeDocumentClassificationJob(
DescribeDocumentClassificationJobRequest describeDocumentClassificationJobRequest) {
ExecutionContext executionContext = createExecutionContext(describeDocumentClassificationJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeDocumentClassificationJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(describeDocumentClassificationJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeDocumentClassificationJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DescribeDocumentClassificationJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets the properties associated with a document classifier.
*
*
* @param describeDocumentClassifierRequest
* @return Result of the DescribeDocumentClassifier operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DescribeDocumentClassifier
* @see AWS API Documentation
*/
@Override
public DescribeDocumentClassifierResult describeDocumentClassifier(DescribeDocumentClassifierRequest request) {
request = beforeClientExecution(request);
return executeDescribeDocumentClassifier(request);
}
@SdkInternalApi
final DescribeDocumentClassifierResult executeDescribeDocumentClassifier(DescribeDocumentClassifierRequest describeDocumentClassifierRequest) {
ExecutionContext executionContext = createExecutionContext(describeDocumentClassifierRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeDocumentClassifierRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(describeDocumentClassifierRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeDocumentClassifier");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DescribeDocumentClassifierResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets the properties associated with a dominant language detection job. Use this operation to get the status of a
* detection job.
*
*
* @param describeDominantLanguageDetectionJobRequest
* @return Result of the DescribeDominantLanguageDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws JobNotFoundException
* The specified job was not found. Check the job ID and try again.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DescribeDominantLanguageDetectionJob
* @see AWS API Documentation
*/
@Override
public DescribeDominantLanguageDetectionJobResult describeDominantLanguageDetectionJob(DescribeDominantLanguageDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeDescribeDominantLanguageDetectionJob(request);
}
@SdkInternalApi
final DescribeDominantLanguageDetectionJobResult executeDescribeDominantLanguageDetectionJob(
DescribeDominantLanguageDetectionJobRequest describeDominantLanguageDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(describeDominantLanguageDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeDominantLanguageDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(describeDominantLanguageDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeDominantLanguageDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DescribeDominantLanguageDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets the properties associated with a specific endpoint. Use this operation to get the status of an endpoint. For
* information about endpoints, see Managing endpoints.
*
*
* @param describeEndpointRequest
* @return Result of the DescribeEndpoint operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DescribeEndpoint
* @see AWS
* API Documentation
*/
@Override
public DescribeEndpointResult describeEndpoint(DescribeEndpointRequest request) {
request = beforeClientExecution(request);
return executeDescribeEndpoint(request);
}
@SdkInternalApi
final DescribeEndpointResult executeDescribeEndpoint(DescribeEndpointRequest describeEndpointRequest) {
ExecutionContext executionContext = createExecutionContext(describeEndpointRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeEndpointRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeEndpointRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeEndpoint");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeEndpointResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets the properties associated with an entities detection job. Use this operation to get the status of a
* detection job.
*
*
* @param describeEntitiesDetectionJobRequest
* @return Result of the DescribeEntitiesDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws JobNotFoundException
* The specified job was not found. Check the job ID and try again.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DescribeEntitiesDetectionJob
* @see AWS API Documentation
*/
@Override
public DescribeEntitiesDetectionJobResult describeEntitiesDetectionJob(DescribeEntitiesDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeDescribeEntitiesDetectionJob(request);
}
@SdkInternalApi
final DescribeEntitiesDetectionJobResult executeDescribeEntitiesDetectionJob(DescribeEntitiesDetectionJobRequest describeEntitiesDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(describeEntitiesDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeEntitiesDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(describeEntitiesDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeEntitiesDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DescribeEntitiesDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Provides details about an entity recognizer including status, S3 buckets containing training data, recognizer
* metadata, metrics, and so on.
*
*
* @param describeEntityRecognizerRequest
* @return Result of the DescribeEntityRecognizer operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DescribeEntityRecognizer
* @see AWS API Documentation
*/
@Override
public DescribeEntityRecognizerResult describeEntityRecognizer(DescribeEntityRecognizerRequest request) {
request = beforeClientExecution(request);
return executeDescribeEntityRecognizer(request);
}
@SdkInternalApi
final DescribeEntityRecognizerResult executeDescribeEntityRecognizer(DescribeEntityRecognizerRequest describeEntityRecognizerRequest) {
ExecutionContext executionContext = createExecutionContext(describeEntityRecognizerRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeEntityRecognizerRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(describeEntityRecognizerRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeEntityRecognizer");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DescribeEntityRecognizerResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets the status and details of an events detection job.
*
*
* @param describeEventsDetectionJobRequest
* @return Result of the DescribeEventsDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws JobNotFoundException
* The specified job was not found. Check the job ID and try again.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DescribeEventsDetectionJob
* @see AWS API Documentation
*/
@Override
public DescribeEventsDetectionJobResult describeEventsDetectionJob(DescribeEventsDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeDescribeEventsDetectionJob(request);
}
@SdkInternalApi
final DescribeEventsDetectionJobResult executeDescribeEventsDetectionJob(DescribeEventsDetectionJobRequest describeEventsDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(describeEventsDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeEventsDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(describeEventsDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeEventsDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DescribeEventsDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Provides configuration information about the flywheel. For more information about flywheels, see Flywheel overview in the
* Amazon Comprehend Developer Guide.
*
*
* @param describeFlywheelRequest
* @return Result of the DescribeFlywheel operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DescribeFlywheel
* @see AWS
* API Documentation
*/
@Override
public DescribeFlywheelResult describeFlywheel(DescribeFlywheelRequest request) {
request = beforeClientExecution(request);
return executeDescribeFlywheel(request);
}
@SdkInternalApi
final DescribeFlywheelResult executeDescribeFlywheel(DescribeFlywheelRequest describeFlywheelRequest) {
ExecutionContext executionContext = createExecutionContext(describeFlywheelRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeFlywheelRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeFlywheelRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeFlywheel");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeFlywheelResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Retrieve the configuration properties of a flywheel iteration. For more information about flywheels, see Flywheel overview in the
* Amazon Comprehend Developer Guide.
*
*
* @param describeFlywheelIterationRequest
* @return Result of the DescribeFlywheelIteration operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DescribeFlywheelIteration
* @see AWS API Documentation
*/
@Override
public DescribeFlywheelIterationResult describeFlywheelIteration(DescribeFlywheelIterationRequest request) {
request = beforeClientExecution(request);
return executeDescribeFlywheelIteration(request);
}
@SdkInternalApi
final DescribeFlywheelIterationResult executeDescribeFlywheelIteration(DescribeFlywheelIterationRequest describeFlywheelIterationRequest) {
ExecutionContext executionContext = createExecutionContext(describeFlywheelIterationRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeFlywheelIterationRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(describeFlywheelIterationRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeFlywheelIteration");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DescribeFlywheelIterationResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets the properties associated with a key phrases detection job. Use this operation to get the status of a
* detection job.
*
*
* @param describeKeyPhrasesDetectionJobRequest
* @return Result of the DescribeKeyPhrasesDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws JobNotFoundException
* The specified job was not found. Check the job ID and try again.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DescribeKeyPhrasesDetectionJob
* @see AWS API Documentation
*/
@Override
public DescribeKeyPhrasesDetectionJobResult describeKeyPhrasesDetectionJob(DescribeKeyPhrasesDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeDescribeKeyPhrasesDetectionJob(request);
}
@SdkInternalApi
final DescribeKeyPhrasesDetectionJobResult executeDescribeKeyPhrasesDetectionJob(DescribeKeyPhrasesDetectionJobRequest describeKeyPhrasesDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(describeKeyPhrasesDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeKeyPhrasesDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(describeKeyPhrasesDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeKeyPhrasesDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DescribeKeyPhrasesDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets the properties associated with a PII entities detection job. For example, you can use this operation to get
* the job status.
*
*
* @param describePiiEntitiesDetectionJobRequest
* @return Result of the DescribePiiEntitiesDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws JobNotFoundException
* The specified job was not found. Check the job ID and try again.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DescribePiiEntitiesDetectionJob
* @see AWS API Documentation
*/
@Override
public DescribePiiEntitiesDetectionJobResult describePiiEntitiesDetectionJob(DescribePiiEntitiesDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeDescribePiiEntitiesDetectionJob(request);
}
@SdkInternalApi
final DescribePiiEntitiesDetectionJobResult executeDescribePiiEntitiesDetectionJob(
DescribePiiEntitiesDetectionJobRequest describePiiEntitiesDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(describePiiEntitiesDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribePiiEntitiesDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(describePiiEntitiesDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribePiiEntitiesDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DescribePiiEntitiesDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets the details of a resource-based policy that is attached to a custom model, including the JSON body of the
* policy.
*
*
* @param describeResourcePolicyRequest
* @return Result of the DescribeResourcePolicy operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DescribeResourcePolicy
* @see AWS API Documentation
*/
@Override
public DescribeResourcePolicyResult describeResourcePolicy(DescribeResourcePolicyRequest request) {
request = beforeClientExecution(request);
return executeDescribeResourcePolicy(request);
}
@SdkInternalApi
final DescribeResourcePolicyResult executeDescribeResourcePolicy(DescribeResourcePolicyRequest describeResourcePolicyRequest) {
ExecutionContext executionContext = createExecutionContext(describeResourcePolicyRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeResourcePolicyRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeResourcePolicyRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeResourcePolicy");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DescribeResourcePolicyResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets the properties associated with a sentiment detection job. Use this operation to get the status of a
* detection job.
*
*
* @param describeSentimentDetectionJobRequest
* @return Result of the DescribeSentimentDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws JobNotFoundException
* The specified job was not found. Check the job ID and try again.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DescribeSentimentDetectionJob
* @see AWS API Documentation
*/
@Override
public DescribeSentimentDetectionJobResult describeSentimentDetectionJob(DescribeSentimentDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeDescribeSentimentDetectionJob(request);
}
@SdkInternalApi
final DescribeSentimentDetectionJobResult executeDescribeSentimentDetectionJob(DescribeSentimentDetectionJobRequest describeSentimentDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(describeSentimentDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeSentimentDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(describeSentimentDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeSentimentDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DescribeSentimentDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets the properties associated with a targeted sentiment detection job. Use this operation to get the status of
* the job.
*
*
* @param describeTargetedSentimentDetectionJobRequest
* @return Result of the DescribeTargetedSentimentDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws JobNotFoundException
* The specified job was not found. Check the job ID and try again.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DescribeTargetedSentimentDetectionJob
* @see AWS API Documentation
*/
@Override
public DescribeTargetedSentimentDetectionJobResult describeTargetedSentimentDetectionJob(DescribeTargetedSentimentDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeDescribeTargetedSentimentDetectionJob(request);
}
@SdkInternalApi
final DescribeTargetedSentimentDetectionJobResult executeDescribeTargetedSentimentDetectionJob(
DescribeTargetedSentimentDetectionJobRequest describeTargetedSentimentDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(describeTargetedSentimentDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeTargetedSentimentDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(describeTargetedSentimentDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeTargetedSentimentDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DescribeTargetedSentimentDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets the properties associated with a topic detection job. Use this operation to get the status of a detection
* job.
*
*
* @param describeTopicsDetectionJobRequest
* @return Result of the DescribeTopicsDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws JobNotFoundException
* The specified job was not found. Check the job ID and try again.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DescribeTopicsDetectionJob
* @see AWS API Documentation
*/
@Override
public DescribeTopicsDetectionJobResult describeTopicsDetectionJob(DescribeTopicsDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeDescribeTopicsDetectionJob(request);
}
@SdkInternalApi
final DescribeTopicsDetectionJobResult executeDescribeTopicsDetectionJob(DescribeTopicsDetectionJobRequest describeTopicsDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(describeTopicsDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeTopicsDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(describeTopicsDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeTopicsDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DescribeTopicsDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Determines the dominant language of the input text. For a list of languages that Amazon Comprehend can detect,
* see Amazon Comprehend Supported
* Languages.
*
*
* @param detectDominantLanguageRequest
* @return Result of the DetectDominantLanguage operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TextSizeLimitExceededException
* The size of the input text exceeds the limit. Use a smaller document.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DetectDominantLanguage
* @see AWS API Documentation
*/
@Override
public DetectDominantLanguageResult detectDominantLanguage(DetectDominantLanguageRequest request) {
request = beforeClientExecution(request);
return executeDetectDominantLanguage(request);
}
@SdkInternalApi
final DetectDominantLanguageResult executeDetectDominantLanguage(DetectDominantLanguageRequest detectDominantLanguageRequest) {
ExecutionContext executionContext = createExecutionContext(detectDominantLanguageRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DetectDominantLanguageRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(detectDominantLanguageRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DetectDominantLanguage");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DetectDominantLanguageResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Detects named entities in input text when you use the pre-trained model. Detects custom entities if you have a
* custom entity recognition model.
*
*
* When detecting named entities using the pre-trained model, use plain text as the input. For more information
* about named entities, see Entities in the Comprehend
* Developer Guide.
*
*
* When you use a custom entity recognition model, you can input plain text or you can upload a single-page input
* document (text, PDF, Word, or image).
*
*
* If the system detects errors while processing a page in the input document, the API response includes an entry in
* Errors
for each error.
*
*
* If the system detects a document-level error in your input document, the API returns an
* InvalidRequestException
error response. For details about this exception, see Errors in semi-structured
* documents in the Comprehend Developer Guide.
*
*
* @param detectEntitiesRequest
* @return Result of the DetectEntities operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws ResourceUnavailableException
* The specified resource is not available. Check the resource and try your request again.
* @throws TextSizeLimitExceededException
* The size of the input text exceeds the limit. Use a smaller document.
* @throws UnsupportedLanguageException
* Amazon Comprehend can't process the language of the input text. For custom entity recognition APIs, only
* English, Spanish, French, Italian, German, or Portuguese are accepted. For a list of supported languages,
* Supported
* languages in the Comprehend Developer Guide.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DetectEntities
* @see AWS API
* Documentation
*/
@Override
public DetectEntitiesResult detectEntities(DetectEntitiesRequest request) {
request = beforeClientExecution(request);
return executeDetectEntities(request);
}
@SdkInternalApi
final DetectEntitiesResult executeDetectEntities(DetectEntitiesRequest detectEntitiesRequest) {
ExecutionContext executionContext = createExecutionContext(detectEntitiesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DetectEntitiesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(detectEntitiesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DetectEntities");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DetectEntitiesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Detects the key noun phrases found in the text.
*
*
* @param detectKeyPhrasesRequest
* @return Result of the DetectKeyPhrases operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TextSizeLimitExceededException
* The size of the input text exceeds the limit. Use a smaller document.
* @throws UnsupportedLanguageException
* Amazon Comprehend can't process the language of the input text. For custom entity recognition APIs, only
* English, Spanish, French, Italian, German, or Portuguese are accepted. For a list of supported languages,
* Supported
* languages in the Comprehend Developer Guide.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DetectKeyPhrases
* @see AWS
* API Documentation
*/
@Override
public DetectKeyPhrasesResult detectKeyPhrases(DetectKeyPhrasesRequest request) {
request = beforeClientExecution(request);
return executeDetectKeyPhrases(request);
}
@SdkInternalApi
final DetectKeyPhrasesResult executeDetectKeyPhrases(DetectKeyPhrasesRequest detectKeyPhrasesRequest) {
ExecutionContext executionContext = createExecutionContext(detectKeyPhrasesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DetectKeyPhrasesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(detectKeyPhrasesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DetectKeyPhrases");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DetectKeyPhrasesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Inspects the input text for entities that contain personally identifiable information (PII) and returns
* information about them.
*
*
* @param detectPiiEntitiesRequest
* @return Result of the DetectPiiEntities operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TextSizeLimitExceededException
* The size of the input text exceeds the limit. Use a smaller document.
* @throws UnsupportedLanguageException
* Amazon Comprehend can't process the language of the input text. For custom entity recognition APIs, only
* English, Spanish, French, Italian, German, or Portuguese are accepted. For a list of supported languages,
* Supported
* languages in the Comprehend Developer Guide.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DetectPiiEntities
* @see AWS
* API Documentation
*/
@Override
public DetectPiiEntitiesResult detectPiiEntities(DetectPiiEntitiesRequest request) {
request = beforeClientExecution(request);
return executeDetectPiiEntities(request);
}
@SdkInternalApi
final DetectPiiEntitiesResult executeDetectPiiEntities(DetectPiiEntitiesRequest detectPiiEntitiesRequest) {
ExecutionContext executionContext = createExecutionContext(detectPiiEntitiesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DetectPiiEntitiesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(detectPiiEntitiesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DetectPiiEntities");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DetectPiiEntitiesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Inspects text and returns an inference of the prevailing sentiment (POSITIVE
, NEUTRAL
,
* MIXED
, or NEGATIVE
).
*
*
* @param detectSentimentRequest
* @return Result of the DetectSentiment operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TextSizeLimitExceededException
* The size of the input text exceeds the limit. Use a smaller document.
* @throws UnsupportedLanguageException
* Amazon Comprehend can't process the language of the input text. For custom entity recognition APIs, only
* English, Spanish, French, Italian, German, or Portuguese are accepted. For a list of supported languages,
* Supported
* languages in the Comprehend Developer Guide.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DetectSentiment
* @see AWS API
* Documentation
*/
@Override
public DetectSentimentResult detectSentiment(DetectSentimentRequest request) {
request = beforeClientExecution(request);
return executeDetectSentiment(request);
}
@SdkInternalApi
final DetectSentimentResult executeDetectSentiment(DetectSentimentRequest detectSentimentRequest) {
ExecutionContext executionContext = createExecutionContext(detectSentimentRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DetectSentimentRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(detectSentimentRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DetectSentiment");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DetectSentimentResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Inspects text for syntax and the part of speech of words in the document. For more information, see Syntax in the Comprehend Developer
* Guide.
*
*
* @param detectSyntaxRequest
* @return Result of the DetectSyntax operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TextSizeLimitExceededException
* The size of the input text exceeds the limit. Use a smaller document.
* @throws UnsupportedLanguageException
* Amazon Comprehend can't process the language of the input text. For custom entity recognition APIs, only
* English, Spanish, French, Italian, German, or Portuguese are accepted. For a list of supported languages,
* Supported
* languages in the Comprehend Developer Guide.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DetectSyntax
* @see AWS API
* Documentation
*/
@Override
public DetectSyntaxResult detectSyntax(DetectSyntaxRequest request) {
request = beforeClientExecution(request);
return executeDetectSyntax(request);
}
@SdkInternalApi
final DetectSyntaxResult executeDetectSyntax(DetectSyntaxRequest detectSyntaxRequest) {
ExecutionContext executionContext = createExecutionContext(detectSyntaxRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DetectSyntaxRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(detectSyntaxRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DetectSyntax");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DetectSyntaxResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Inspects the input text and returns a sentiment analysis for each entity identified in the text.
*
*
* For more information about targeted sentiment, see Targeted sentiment in the
* Amazon Comprehend Developer Guide.
*
*
* @param detectTargetedSentimentRequest
* @return Result of the DetectTargetedSentiment operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TextSizeLimitExceededException
* The size of the input text exceeds the limit. Use a smaller document.
* @throws UnsupportedLanguageException
* Amazon Comprehend can't process the language of the input text. For custom entity recognition APIs, only
* English, Spanish, French, Italian, German, or Portuguese are accepted. For a list of supported languages,
* Supported
* languages in the Comprehend Developer Guide.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DetectTargetedSentiment
* @see AWS API Documentation
*/
@Override
public DetectTargetedSentimentResult detectTargetedSentiment(DetectTargetedSentimentRequest request) {
request = beforeClientExecution(request);
return executeDetectTargetedSentiment(request);
}
@SdkInternalApi
final DetectTargetedSentimentResult executeDetectTargetedSentiment(DetectTargetedSentimentRequest detectTargetedSentimentRequest) {
ExecutionContext executionContext = createExecutionContext(detectTargetedSentimentRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DetectTargetedSentimentRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(detectTargetedSentimentRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DetectTargetedSentiment");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DetectTargetedSentimentResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Performs toxicity analysis on the list of text strings that you provide as input. The analysis uses the order of
* strings in the list to determine context when predicting toxicity. The API response contains a results list that
* matches the size of the input list. For more information about toxicity detection, see Toxicity detection in the
* Amazon Comprehend Developer Guide
*
*
* @param detectToxicContentRequest
* @return Result of the DetectToxicContent operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TextSizeLimitExceededException
* The size of the input text exceeds the limit. Use a smaller document.
* @throws UnsupportedLanguageException
* Amazon Comprehend can't process the language of the input text. For custom entity recognition APIs, only
* English, Spanish, French, Italian, German, or Portuguese are accepted. For a list of supported languages,
* Supported
* languages in the Comprehend Developer Guide.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.DetectToxicContent
* @see AWS
* API Documentation
*/
@Override
public DetectToxicContentResult detectToxicContent(DetectToxicContentRequest request) {
request = beforeClientExecution(request);
return executeDetectToxicContent(request);
}
@SdkInternalApi
final DetectToxicContentResult executeDetectToxicContent(DetectToxicContentRequest detectToxicContentRequest) {
ExecutionContext executionContext = createExecutionContext(detectToxicContentRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DetectToxicContentRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(detectToxicContentRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DetectToxicContent");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DetectToxicContentResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates a new custom model that replicates a source custom model that you import. The source model can be in your
* Amazon Web Services account or another one.
*
*
* If the source model is in another Amazon Web Services account, then it must have a resource-based policy that
* authorizes you to import it.
*
*
* The source model must be in the same Amazon Web Services Region that you're using when you import. You can't
* import a model that's in a different Region.
*
*
* @param importModelRequest
* @return Result of the ImportModel operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws ResourceInUseException
* The specified resource name is already in use. Use a different name and try your request again.
* @throws ResourceUnavailableException
* The specified resource is not available. Check the resource and try your request again.
* @throws TooManyTagsException
* The request contains more tags than can be associated with a resource (50 tags per resource). The maximum
* number of tags includes both existing tags and those included in your current request.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws ResourceLimitExceededException
* The maximum number of resources per account has been exceeded. Review the resources, and then try your
* request again.
* @throws KmsKeyValidationException
* The KMS customer managed key (CMK) entered cannot be validated. Verify the key and re-enter it.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.ImportModel
* @see AWS API
* Documentation
*/
@Override
public ImportModelResult importModel(ImportModelRequest request) {
request = beforeClientExecution(request);
return executeImportModel(request);
}
@SdkInternalApi
final ImportModelResult executeImportModel(ImportModelRequest importModelRequest) {
ExecutionContext executionContext = createExecutionContext(importModelRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ImportModelRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(importModelRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ImportModel");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ImportModelResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* List the datasets that you have configured in this Region. For more information about datasets, see Flywheel overview in the
* Amazon Comprehend Developer Guide.
*
*
* @param listDatasetsRequest
* @return Result of the ListDatasets operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InvalidFilterException
* The filter specified for the operation is invalid. Specify a different filter.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.ListDatasets
* @see AWS API
* Documentation
*/
@Override
public ListDatasetsResult listDatasets(ListDatasetsRequest request) {
request = beforeClientExecution(request);
return executeListDatasets(request);
}
@SdkInternalApi
final ListDatasetsResult executeListDatasets(ListDatasetsRequest listDatasetsRequest) {
ExecutionContext executionContext = createExecutionContext(listDatasetsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListDatasetsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listDatasetsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListDatasets");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListDatasetsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets a list of the documentation classification jobs that you have submitted.
*
*
* @param listDocumentClassificationJobsRequest
* @return Result of the ListDocumentClassificationJobs operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InvalidFilterException
* The filter specified for the operation is invalid. Specify a different filter.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.ListDocumentClassificationJobs
* @see AWS API Documentation
*/
@Override
public ListDocumentClassificationJobsResult listDocumentClassificationJobs(ListDocumentClassificationJobsRequest request) {
request = beforeClientExecution(request);
return executeListDocumentClassificationJobs(request);
}
@SdkInternalApi
final ListDocumentClassificationJobsResult executeListDocumentClassificationJobs(ListDocumentClassificationJobsRequest listDocumentClassificationJobsRequest) {
ExecutionContext executionContext = createExecutionContext(listDocumentClassificationJobsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListDocumentClassificationJobsRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listDocumentClassificationJobsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListDocumentClassificationJobs");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListDocumentClassificationJobsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets a list of summaries of the document classifiers that you have created
*
*
* @param listDocumentClassifierSummariesRequest
* @return Result of the ListDocumentClassifierSummaries operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.ListDocumentClassifierSummaries
* @see AWS API Documentation
*/
@Override
public ListDocumentClassifierSummariesResult listDocumentClassifierSummaries(ListDocumentClassifierSummariesRequest request) {
request = beforeClientExecution(request);
return executeListDocumentClassifierSummaries(request);
}
@SdkInternalApi
final ListDocumentClassifierSummariesResult executeListDocumentClassifierSummaries(
ListDocumentClassifierSummariesRequest listDocumentClassifierSummariesRequest) {
ExecutionContext executionContext = createExecutionContext(listDocumentClassifierSummariesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListDocumentClassifierSummariesRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listDocumentClassifierSummariesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListDocumentClassifierSummaries");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListDocumentClassifierSummariesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets a list of the document classifiers that you have created.
*
*
* @param listDocumentClassifiersRequest
* @return Result of the ListDocumentClassifiers operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InvalidFilterException
* The filter specified for the operation is invalid. Specify a different filter.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.ListDocumentClassifiers
* @see AWS API Documentation
*/
@Override
public ListDocumentClassifiersResult listDocumentClassifiers(ListDocumentClassifiersRequest request) {
request = beforeClientExecution(request);
return executeListDocumentClassifiers(request);
}
@SdkInternalApi
final ListDocumentClassifiersResult executeListDocumentClassifiers(ListDocumentClassifiersRequest listDocumentClassifiersRequest) {
ExecutionContext executionContext = createExecutionContext(listDocumentClassifiersRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListDocumentClassifiersRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listDocumentClassifiersRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListDocumentClassifiers");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListDocumentClassifiersResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets a list of the dominant language detection jobs that you have submitted.
*
*
* @param listDominantLanguageDetectionJobsRequest
* @return Result of the ListDominantLanguageDetectionJobs operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InvalidFilterException
* The filter specified for the operation is invalid. Specify a different filter.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.ListDominantLanguageDetectionJobs
* @see AWS API Documentation
*/
@Override
public ListDominantLanguageDetectionJobsResult listDominantLanguageDetectionJobs(ListDominantLanguageDetectionJobsRequest request) {
request = beforeClientExecution(request);
return executeListDominantLanguageDetectionJobs(request);
}
@SdkInternalApi
final ListDominantLanguageDetectionJobsResult executeListDominantLanguageDetectionJobs(
ListDominantLanguageDetectionJobsRequest listDominantLanguageDetectionJobsRequest) {
ExecutionContext executionContext = createExecutionContext(listDominantLanguageDetectionJobsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListDominantLanguageDetectionJobsRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listDominantLanguageDetectionJobsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListDominantLanguageDetectionJobs");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListDominantLanguageDetectionJobsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets a list of all existing endpoints that you've created. For information about endpoints, see Managing endpoints.
*
*
* @param listEndpointsRequest
* @return Result of the ListEndpoints operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.ListEndpoints
* @see AWS API
* Documentation
*/
@Override
public ListEndpointsResult listEndpoints(ListEndpointsRequest request) {
request = beforeClientExecution(request);
return executeListEndpoints(request);
}
@SdkInternalApi
final ListEndpointsResult executeListEndpoints(ListEndpointsRequest listEndpointsRequest) {
ExecutionContext executionContext = createExecutionContext(listEndpointsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListEndpointsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listEndpointsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListEndpoints");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListEndpointsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets a list of the entity detection jobs that you have submitted.
*
*
* @param listEntitiesDetectionJobsRequest
* @return Result of the ListEntitiesDetectionJobs operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InvalidFilterException
* The filter specified for the operation is invalid. Specify a different filter.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.ListEntitiesDetectionJobs
* @see AWS API Documentation
*/
@Override
public ListEntitiesDetectionJobsResult listEntitiesDetectionJobs(ListEntitiesDetectionJobsRequest request) {
request = beforeClientExecution(request);
return executeListEntitiesDetectionJobs(request);
}
@SdkInternalApi
final ListEntitiesDetectionJobsResult executeListEntitiesDetectionJobs(ListEntitiesDetectionJobsRequest listEntitiesDetectionJobsRequest) {
ExecutionContext executionContext = createExecutionContext(listEntitiesDetectionJobsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListEntitiesDetectionJobsRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listEntitiesDetectionJobsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListEntitiesDetectionJobs");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListEntitiesDetectionJobsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets a list of summaries for the entity recognizers that you have created.
*
*
* @param listEntityRecognizerSummariesRequest
* @return Result of the ListEntityRecognizerSummaries operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.ListEntityRecognizerSummaries
* @see AWS API Documentation
*/
@Override
public ListEntityRecognizerSummariesResult listEntityRecognizerSummaries(ListEntityRecognizerSummariesRequest request) {
request = beforeClientExecution(request);
return executeListEntityRecognizerSummaries(request);
}
@SdkInternalApi
final ListEntityRecognizerSummariesResult executeListEntityRecognizerSummaries(ListEntityRecognizerSummariesRequest listEntityRecognizerSummariesRequest) {
ExecutionContext executionContext = createExecutionContext(listEntityRecognizerSummariesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListEntityRecognizerSummariesRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listEntityRecognizerSummariesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListEntityRecognizerSummaries");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListEntityRecognizerSummariesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets a list of the properties of all entity recognizers that you created, including recognizers currently in
* training. Allows you to filter the list of recognizers based on criteria such as status and submission time. This
* call returns up to 500 entity recognizers in the list, with a default number of 100 recognizers in the list.
*
*
* The results of this list are not in any particular order. Please get the list and sort locally if needed.
*
*
* @param listEntityRecognizersRequest
* @return Result of the ListEntityRecognizers operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InvalidFilterException
* The filter specified for the operation is invalid. Specify a different filter.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.ListEntityRecognizers
* @see AWS API Documentation
*/
@Override
public ListEntityRecognizersResult listEntityRecognizers(ListEntityRecognizersRequest request) {
request = beforeClientExecution(request);
return executeListEntityRecognizers(request);
}
@SdkInternalApi
final ListEntityRecognizersResult executeListEntityRecognizers(ListEntityRecognizersRequest listEntityRecognizersRequest) {
ExecutionContext executionContext = createExecutionContext(listEntityRecognizersRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListEntityRecognizersRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listEntityRecognizersRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListEntityRecognizers");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListEntityRecognizersResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets a list of the events detection jobs that you have submitted.
*
*
* @param listEventsDetectionJobsRequest
* @return Result of the ListEventsDetectionJobs operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InvalidFilterException
* The filter specified for the operation is invalid. Specify a different filter.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.ListEventsDetectionJobs
* @see AWS API Documentation
*/
@Override
public ListEventsDetectionJobsResult listEventsDetectionJobs(ListEventsDetectionJobsRequest request) {
request = beforeClientExecution(request);
return executeListEventsDetectionJobs(request);
}
@SdkInternalApi
final ListEventsDetectionJobsResult executeListEventsDetectionJobs(ListEventsDetectionJobsRequest listEventsDetectionJobsRequest) {
ExecutionContext executionContext = createExecutionContext(listEventsDetectionJobsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListEventsDetectionJobsRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listEventsDetectionJobsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListEventsDetectionJobs");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListEventsDetectionJobsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Information about the history of a flywheel iteration. For more information about flywheels, see Flywheel overview in the
* Amazon Comprehend Developer Guide.
*
*
* @param listFlywheelIterationHistoryRequest
* @return Result of the ListFlywheelIterationHistory operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InvalidFilterException
* The filter specified for the operation is invalid. Specify a different filter.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.ListFlywheelIterationHistory
* @see AWS API Documentation
*/
@Override
public ListFlywheelIterationHistoryResult listFlywheelIterationHistory(ListFlywheelIterationHistoryRequest request) {
request = beforeClientExecution(request);
return executeListFlywheelIterationHistory(request);
}
@SdkInternalApi
final ListFlywheelIterationHistoryResult executeListFlywheelIterationHistory(ListFlywheelIterationHistoryRequest listFlywheelIterationHistoryRequest) {
ExecutionContext executionContext = createExecutionContext(listFlywheelIterationHistoryRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListFlywheelIterationHistoryRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listFlywheelIterationHistoryRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListFlywheelIterationHistory");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListFlywheelIterationHistoryResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets a list of the flywheels that you have created.
*
*
* @param listFlywheelsRequest
* @return Result of the ListFlywheels operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InvalidFilterException
* The filter specified for the operation is invalid. Specify a different filter.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.ListFlywheels
* @see AWS API
* Documentation
*/
@Override
public ListFlywheelsResult listFlywheels(ListFlywheelsRequest request) {
request = beforeClientExecution(request);
return executeListFlywheels(request);
}
@SdkInternalApi
final ListFlywheelsResult executeListFlywheels(ListFlywheelsRequest listFlywheelsRequest) {
ExecutionContext executionContext = createExecutionContext(listFlywheelsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListFlywheelsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listFlywheelsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListFlywheels");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListFlywheelsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Get a list of key phrase detection jobs that you have submitted.
*
*
* @param listKeyPhrasesDetectionJobsRequest
* @return Result of the ListKeyPhrasesDetectionJobs operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InvalidFilterException
* The filter specified for the operation is invalid. Specify a different filter.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.ListKeyPhrasesDetectionJobs
* @see AWS API Documentation
*/
@Override
public ListKeyPhrasesDetectionJobsResult listKeyPhrasesDetectionJobs(ListKeyPhrasesDetectionJobsRequest request) {
request = beforeClientExecution(request);
return executeListKeyPhrasesDetectionJobs(request);
}
@SdkInternalApi
final ListKeyPhrasesDetectionJobsResult executeListKeyPhrasesDetectionJobs(ListKeyPhrasesDetectionJobsRequest listKeyPhrasesDetectionJobsRequest) {
ExecutionContext executionContext = createExecutionContext(listKeyPhrasesDetectionJobsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListKeyPhrasesDetectionJobsRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listKeyPhrasesDetectionJobsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListKeyPhrasesDetectionJobs");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListKeyPhrasesDetectionJobsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets a list of the PII entity detection jobs that you have submitted.
*
*
* @param listPiiEntitiesDetectionJobsRequest
* @return Result of the ListPiiEntitiesDetectionJobs operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InvalidFilterException
* The filter specified for the operation is invalid. Specify a different filter.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.ListPiiEntitiesDetectionJobs
* @see AWS API Documentation
*/
@Override
public ListPiiEntitiesDetectionJobsResult listPiiEntitiesDetectionJobs(ListPiiEntitiesDetectionJobsRequest request) {
request = beforeClientExecution(request);
return executeListPiiEntitiesDetectionJobs(request);
}
@SdkInternalApi
final ListPiiEntitiesDetectionJobsResult executeListPiiEntitiesDetectionJobs(ListPiiEntitiesDetectionJobsRequest listPiiEntitiesDetectionJobsRequest) {
ExecutionContext executionContext = createExecutionContext(listPiiEntitiesDetectionJobsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListPiiEntitiesDetectionJobsRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listPiiEntitiesDetectionJobsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListPiiEntitiesDetectionJobs");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListPiiEntitiesDetectionJobsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets a list of sentiment detection jobs that you have submitted.
*
*
* @param listSentimentDetectionJobsRequest
* @return Result of the ListSentimentDetectionJobs operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InvalidFilterException
* The filter specified for the operation is invalid. Specify a different filter.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.ListSentimentDetectionJobs
* @see AWS API Documentation
*/
@Override
public ListSentimentDetectionJobsResult listSentimentDetectionJobs(ListSentimentDetectionJobsRequest request) {
request = beforeClientExecution(request);
return executeListSentimentDetectionJobs(request);
}
@SdkInternalApi
final ListSentimentDetectionJobsResult executeListSentimentDetectionJobs(ListSentimentDetectionJobsRequest listSentimentDetectionJobsRequest) {
ExecutionContext executionContext = createExecutionContext(listSentimentDetectionJobsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListSentimentDetectionJobsRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listSentimentDetectionJobsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListSentimentDetectionJobs");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListSentimentDetectionJobsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Lists all tags associated with a given Amazon Comprehend resource.
*
*
* @param listTagsForResourceRequest
* @return Result of the ListTagsForResource operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.ListTagsForResource
* @see AWS
* API Documentation
*/
@Override
public ListTagsForResourceResult listTagsForResource(ListTagsForResourceRequest request) {
request = beforeClientExecution(request);
return executeListTagsForResource(request);
}
@SdkInternalApi
final ListTagsForResourceResult executeListTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) {
ExecutionContext executionContext = createExecutionContext(listTagsForResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTagsForResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTagsForResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTagsForResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListTagsForResourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets a list of targeted sentiment detection jobs that you have submitted.
*
*
* @param listTargetedSentimentDetectionJobsRequest
* @return Result of the ListTargetedSentimentDetectionJobs operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InvalidFilterException
* The filter specified for the operation is invalid. Specify a different filter.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.ListTargetedSentimentDetectionJobs
* @see AWS API Documentation
*/
@Override
public ListTargetedSentimentDetectionJobsResult listTargetedSentimentDetectionJobs(ListTargetedSentimentDetectionJobsRequest request) {
request = beforeClientExecution(request);
return executeListTargetedSentimentDetectionJobs(request);
}
@SdkInternalApi
final ListTargetedSentimentDetectionJobsResult executeListTargetedSentimentDetectionJobs(
ListTargetedSentimentDetectionJobsRequest listTargetedSentimentDetectionJobsRequest) {
ExecutionContext executionContext = createExecutionContext(listTargetedSentimentDetectionJobsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTargetedSentimentDetectionJobsRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listTargetedSentimentDetectionJobsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTargetedSentimentDetectionJobs");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListTargetedSentimentDetectionJobsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets a list of the topic detection jobs that you have submitted.
*
*
* @param listTopicsDetectionJobsRequest
* @return Result of the ListTopicsDetectionJobs operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws InvalidFilterException
* The filter specified for the operation is invalid. Specify a different filter.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.ListTopicsDetectionJobs
* @see AWS API Documentation
*/
@Override
public ListTopicsDetectionJobsResult listTopicsDetectionJobs(ListTopicsDetectionJobsRequest request) {
request = beforeClientExecution(request);
return executeListTopicsDetectionJobs(request);
}
@SdkInternalApi
final ListTopicsDetectionJobsResult executeListTopicsDetectionJobs(ListTopicsDetectionJobsRequest listTopicsDetectionJobsRequest) {
ExecutionContext executionContext = createExecutionContext(listTopicsDetectionJobsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTopicsDetectionJobsRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listTopicsDetectionJobsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTopicsDetectionJobs");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListTopicsDetectionJobsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Attaches a resource-based policy to a custom model. You can use this policy to authorize an entity in another
* Amazon Web Services account to import the custom model, which replicates it in Amazon Comprehend in their
* account.
*
*
* @param putResourcePolicyRequest
* @return Result of the PutResourcePolicy operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.PutResourcePolicy
* @see AWS
* API Documentation
*/
@Override
public PutResourcePolicyResult putResourcePolicy(PutResourcePolicyRequest request) {
request = beforeClientExecution(request);
return executePutResourcePolicy(request);
}
@SdkInternalApi
final PutResourcePolicyResult executePutResourcePolicy(PutResourcePolicyRequest putResourcePolicyRequest) {
ExecutionContext executionContext = createExecutionContext(putResourcePolicyRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new PutResourcePolicyRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(putResourcePolicyRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PutResourcePolicy");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new PutResourcePolicyResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Starts an asynchronous document classification job. Use the DescribeDocumentClassificationJob
* operation to track the progress of the job.
*
*
* @param startDocumentClassificationJobRequest
* @return Result of the StartDocumentClassificationJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws ResourceUnavailableException
* The specified resource is not available. Check the resource and try your request again.
* @throws KmsKeyValidationException
* The KMS customer managed key (CMK) entered cannot be validated. Verify the key and re-enter it.
* @throws TooManyTagsException
* The request contains more tags than can be associated with a resource (50 tags per resource). The maximum
* number of tags includes both existing tags and those included in your current request.
* @throws ResourceInUseException
* The specified resource name is already in use. Use a different name and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.StartDocumentClassificationJob
* @see AWS API Documentation
*/
@Override
public StartDocumentClassificationJobResult startDocumentClassificationJob(StartDocumentClassificationJobRequest request) {
request = beforeClientExecution(request);
return executeStartDocumentClassificationJob(request);
}
@SdkInternalApi
final StartDocumentClassificationJobResult executeStartDocumentClassificationJob(StartDocumentClassificationJobRequest startDocumentClassificationJobRequest) {
ExecutionContext executionContext = createExecutionContext(startDocumentClassificationJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StartDocumentClassificationJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(startDocumentClassificationJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartDocumentClassificationJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new StartDocumentClassificationJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Starts an asynchronous dominant language detection job for a collection of documents. Use the operation to track
* the status of a job.
*
*
* @param startDominantLanguageDetectionJobRequest
* @return Result of the StartDominantLanguageDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws KmsKeyValidationException
* The KMS customer managed key (CMK) entered cannot be validated. Verify the key and re-enter it.
* @throws TooManyTagsException
* The request contains more tags than can be associated with a resource (50 tags per resource). The maximum
* number of tags includes both existing tags and those included in your current request.
* @throws ResourceInUseException
* The specified resource name is already in use. Use a different name and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.StartDominantLanguageDetectionJob
* @see AWS API Documentation
*/
@Override
public StartDominantLanguageDetectionJobResult startDominantLanguageDetectionJob(StartDominantLanguageDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeStartDominantLanguageDetectionJob(request);
}
@SdkInternalApi
final StartDominantLanguageDetectionJobResult executeStartDominantLanguageDetectionJob(
StartDominantLanguageDetectionJobRequest startDominantLanguageDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(startDominantLanguageDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StartDominantLanguageDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(startDominantLanguageDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartDominantLanguageDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new StartDominantLanguageDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Starts an asynchronous entity detection job for a collection of documents. Use the operation to track the status
* of a job.
*
*
* This API can be used for either standard entity detection or custom entity recognition. In order to be used for
* custom entity recognition, the optional EntityRecognizerArn
must be used in order to provide access
* to the recognizer being used to detect the custom entity.
*
*
* @param startEntitiesDetectionJobRequest
* @return Result of the StartEntitiesDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws ResourceUnavailableException
* The specified resource is not available. Check the resource and try your request again.
* @throws KmsKeyValidationException
* The KMS customer managed key (CMK) entered cannot be validated. Verify the key and re-enter it.
* @throws TooManyTagsException
* The request contains more tags than can be associated with a resource (50 tags per resource). The maximum
* number of tags includes both existing tags and those included in your current request.
* @throws ResourceInUseException
* The specified resource name is already in use. Use a different name and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.StartEntitiesDetectionJob
* @see AWS API Documentation
*/
@Override
public StartEntitiesDetectionJobResult startEntitiesDetectionJob(StartEntitiesDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeStartEntitiesDetectionJob(request);
}
@SdkInternalApi
final StartEntitiesDetectionJobResult executeStartEntitiesDetectionJob(StartEntitiesDetectionJobRequest startEntitiesDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(startEntitiesDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StartEntitiesDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(startEntitiesDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartEntitiesDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new StartEntitiesDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Starts an asynchronous event detection job for a collection of documents.
*
*
* @param startEventsDetectionJobRequest
* @return Result of the StartEventsDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws KmsKeyValidationException
* The KMS customer managed key (CMK) entered cannot be validated. Verify the key and re-enter it.
* @throws TooManyTagsException
* The request contains more tags than can be associated with a resource (50 tags per resource). The maximum
* number of tags includes both existing tags and those included in your current request.
* @throws ResourceInUseException
* The specified resource name is already in use. Use a different name and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.StartEventsDetectionJob
* @see AWS API Documentation
*/
@Override
public StartEventsDetectionJobResult startEventsDetectionJob(StartEventsDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeStartEventsDetectionJob(request);
}
@SdkInternalApi
final StartEventsDetectionJobResult executeStartEventsDetectionJob(StartEventsDetectionJobRequest startEventsDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(startEventsDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StartEventsDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(startEventsDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartEventsDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new StartEventsDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Start the flywheel iteration.This operation uses any new datasets to train a new model version. For more
* information about flywheels, see
* Flywheel overview in the Amazon Comprehend Developer Guide.
*
*
* @param startFlywheelIterationRequest
* @return Result of the StartFlywheelIteration operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws ResourceInUseException
* The specified resource name is already in use. Use a different name and try your request again.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.StartFlywheelIteration
* @see AWS API Documentation
*/
@Override
public StartFlywheelIterationResult startFlywheelIteration(StartFlywheelIterationRequest request) {
request = beforeClientExecution(request);
return executeStartFlywheelIteration(request);
}
@SdkInternalApi
final StartFlywheelIterationResult executeStartFlywheelIteration(StartFlywheelIterationRequest startFlywheelIterationRequest) {
ExecutionContext executionContext = createExecutionContext(startFlywheelIterationRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StartFlywheelIterationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(startFlywheelIterationRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartFlywheelIteration");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new StartFlywheelIterationResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Starts an asynchronous key phrase detection job for a collection of documents. Use the operation to track the
* status of a job.
*
*
* @param startKeyPhrasesDetectionJobRequest
* @return Result of the StartKeyPhrasesDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws KmsKeyValidationException
* The KMS customer managed key (CMK) entered cannot be validated. Verify the key and re-enter it.
* @throws TooManyTagsException
* The request contains more tags than can be associated with a resource (50 tags per resource). The maximum
* number of tags includes both existing tags and those included in your current request.
* @throws ResourceInUseException
* The specified resource name is already in use. Use a different name and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.StartKeyPhrasesDetectionJob
* @see AWS API Documentation
*/
@Override
public StartKeyPhrasesDetectionJobResult startKeyPhrasesDetectionJob(StartKeyPhrasesDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeStartKeyPhrasesDetectionJob(request);
}
@SdkInternalApi
final StartKeyPhrasesDetectionJobResult executeStartKeyPhrasesDetectionJob(StartKeyPhrasesDetectionJobRequest startKeyPhrasesDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(startKeyPhrasesDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StartKeyPhrasesDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(startKeyPhrasesDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartKeyPhrasesDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new StartKeyPhrasesDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Starts an asynchronous PII entity detection job for a collection of documents.
*
*
* @param startPiiEntitiesDetectionJobRequest
* @return Result of the StartPiiEntitiesDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws KmsKeyValidationException
* The KMS customer managed key (CMK) entered cannot be validated. Verify the key and re-enter it.
* @throws TooManyTagsException
* The request contains more tags than can be associated with a resource (50 tags per resource). The maximum
* number of tags includes both existing tags and those included in your current request.
* @throws ResourceInUseException
* The specified resource name is already in use. Use a different name and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.StartPiiEntitiesDetectionJob
* @see AWS API Documentation
*/
@Override
public StartPiiEntitiesDetectionJobResult startPiiEntitiesDetectionJob(StartPiiEntitiesDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeStartPiiEntitiesDetectionJob(request);
}
@SdkInternalApi
final StartPiiEntitiesDetectionJobResult executeStartPiiEntitiesDetectionJob(StartPiiEntitiesDetectionJobRequest startPiiEntitiesDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(startPiiEntitiesDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StartPiiEntitiesDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(startPiiEntitiesDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartPiiEntitiesDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new StartPiiEntitiesDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Starts an asynchronous sentiment detection job for a collection of documents. Use the operation to track the
* status of a job.
*
*
* @param startSentimentDetectionJobRequest
* @return Result of the StartSentimentDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws KmsKeyValidationException
* The KMS customer managed key (CMK) entered cannot be validated. Verify the key and re-enter it.
* @throws TooManyTagsException
* The request contains more tags than can be associated with a resource (50 tags per resource). The maximum
* number of tags includes both existing tags and those included in your current request.
* @throws ResourceInUseException
* The specified resource name is already in use. Use a different name and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.StartSentimentDetectionJob
* @see AWS API Documentation
*/
@Override
public StartSentimentDetectionJobResult startSentimentDetectionJob(StartSentimentDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeStartSentimentDetectionJob(request);
}
@SdkInternalApi
final StartSentimentDetectionJobResult executeStartSentimentDetectionJob(StartSentimentDetectionJobRequest startSentimentDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(startSentimentDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StartSentimentDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(startSentimentDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartSentimentDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new StartSentimentDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Starts an asynchronous targeted sentiment detection job for a collection of documents. Use the
* DescribeTargetedSentimentDetectionJob
operation to track the status of a job.
*
*
* @param startTargetedSentimentDetectionJobRequest
* @return Result of the StartTargetedSentimentDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws KmsKeyValidationException
* The KMS customer managed key (CMK) entered cannot be validated. Verify the key and re-enter it.
* @throws TooManyTagsException
* The request contains more tags than can be associated with a resource (50 tags per resource). The maximum
* number of tags includes both existing tags and those included in your current request.
* @throws ResourceInUseException
* The specified resource name is already in use. Use a different name and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.StartTargetedSentimentDetectionJob
* @see AWS API Documentation
*/
@Override
public StartTargetedSentimentDetectionJobResult startTargetedSentimentDetectionJob(StartTargetedSentimentDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeStartTargetedSentimentDetectionJob(request);
}
@SdkInternalApi
final StartTargetedSentimentDetectionJobResult executeStartTargetedSentimentDetectionJob(
StartTargetedSentimentDetectionJobRequest startTargetedSentimentDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(startTargetedSentimentDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StartTargetedSentimentDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(startTargetedSentimentDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartTargetedSentimentDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new StartTargetedSentimentDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Starts an asynchronous topic detection job. Use the DescribeTopicDetectionJob
operation to track the
* status of a job.
*
*
* @param startTopicsDetectionJobRequest
* @return Result of the StartTopicsDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws KmsKeyValidationException
* The KMS customer managed key (CMK) entered cannot be validated. Verify the key and re-enter it.
* @throws TooManyTagsException
* The request contains more tags than can be associated with a resource (50 tags per resource). The maximum
* number of tags includes both existing tags and those included in your current request.
* @throws ResourceInUseException
* The specified resource name is already in use. Use a different name and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.StartTopicsDetectionJob
* @see AWS API Documentation
*/
@Override
public StartTopicsDetectionJobResult startTopicsDetectionJob(StartTopicsDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeStartTopicsDetectionJob(request);
}
@SdkInternalApi
final StartTopicsDetectionJobResult executeStartTopicsDetectionJob(StartTopicsDetectionJobRequest startTopicsDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(startTopicsDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StartTopicsDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(startTopicsDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartTopicsDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new StartTopicsDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Stops a dominant language detection job in progress.
*
*
* If the job state is IN_PROGRESS
the job is marked for termination and put into the
* STOP_REQUESTED
state. If the job completes before it can be stopped, it is put into the
* COMPLETED
state; otherwise the job is stopped and put into the STOPPED
state.
*
*
* If the job is in the COMPLETED
or FAILED
state when you call the
* StopDominantLanguageDetectionJob
operation, the operation returns a 400 Internal Request Exception.
*
*
* When a job is stopped, any documents already processed are written to the output location.
*
*
* @param stopDominantLanguageDetectionJobRequest
* @return Result of the StopDominantLanguageDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws JobNotFoundException
* The specified job was not found. Check the job ID and try again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.StopDominantLanguageDetectionJob
* @see AWS API Documentation
*/
@Override
public StopDominantLanguageDetectionJobResult stopDominantLanguageDetectionJob(StopDominantLanguageDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeStopDominantLanguageDetectionJob(request);
}
@SdkInternalApi
final StopDominantLanguageDetectionJobResult executeStopDominantLanguageDetectionJob(
StopDominantLanguageDetectionJobRequest stopDominantLanguageDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(stopDominantLanguageDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StopDominantLanguageDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(stopDominantLanguageDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StopDominantLanguageDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new StopDominantLanguageDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Stops an entities detection job in progress.
*
*
* If the job state is IN_PROGRESS
the job is marked for termination and put into the
* STOP_REQUESTED
state. If the job completes before it can be stopped, it is put into the
* COMPLETED
state; otherwise the job is stopped and put into the STOPPED
state.
*
*
* If the job is in the COMPLETED
or FAILED
state when you call the
* StopDominantLanguageDetectionJob
operation, the operation returns a 400 Internal Request Exception.
*
*
* When a job is stopped, any documents already processed are written to the output location.
*
*
* @param stopEntitiesDetectionJobRequest
* @return Result of the StopEntitiesDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws JobNotFoundException
* The specified job was not found. Check the job ID and try again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.StopEntitiesDetectionJob
* @see AWS API Documentation
*/
@Override
public StopEntitiesDetectionJobResult stopEntitiesDetectionJob(StopEntitiesDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeStopEntitiesDetectionJob(request);
}
@SdkInternalApi
final StopEntitiesDetectionJobResult executeStopEntitiesDetectionJob(StopEntitiesDetectionJobRequest stopEntitiesDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(stopEntitiesDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StopEntitiesDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(stopEntitiesDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StopEntitiesDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new StopEntitiesDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Stops an events detection job in progress.
*
*
* @param stopEventsDetectionJobRequest
* @return Result of the StopEventsDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws JobNotFoundException
* The specified job was not found. Check the job ID and try again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.StopEventsDetectionJob
* @see AWS API Documentation
*/
@Override
public StopEventsDetectionJobResult stopEventsDetectionJob(StopEventsDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeStopEventsDetectionJob(request);
}
@SdkInternalApi
final StopEventsDetectionJobResult executeStopEventsDetectionJob(StopEventsDetectionJobRequest stopEventsDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(stopEventsDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StopEventsDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(stopEventsDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StopEventsDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new StopEventsDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Stops a key phrases detection job in progress.
*
*
* If the job state is IN_PROGRESS
the job is marked for termination and put into the
* STOP_REQUESTED
state. If the job completes before it can be stopped, it is put into the
* COMPLETED
state; otherwise the job is stopped and put into the STOPPED
state.
*
*
* If the job is in the COMPLETED
or FAILED
state when you call the
* StopDominantLanguageDetectionJob
operation, the operation returns a 400 Internal Request Exception.
*
*
* When a job is stopped, any documents already processed are written to the output location.
*
*
* @param stopKeyPhrasesDetectionJobRequest
* @return Result of the StopKeyPhrasesDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws JobNotFoundException
* The specified job was not found. Check the job ID and try again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.StopKeyPhrasesDetectionJob
* @see AWS API Documentation
*/
@Override
public StopKeyPhrasesDetectionJobResult stopKeyPhrasesDetectionJob(StopKeyPhrasesDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeStopKeyPhrasesDetectionJob(request);
}
@SdkInternalApi
final StopKeyPhrasesDetectionJobResult executeStopKeyPhrasesDetectionJob(StopKeyPhrasesDetectionJobRequest stopKeyPhrasesDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(stopKeyPhrasesDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StopKeyPhrasesDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(stopKeyPhrasesDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StopKeyPhrasesDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new StopKeyPhrasesDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Stops a PII entities detection job in progress.
*
*
* @param stopPiiEntitiesDetectionJobRequest
* @return Result of the StopPiiEntitiesDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws JobNotFoundException
* The specified job was not found. Check the job ID and try again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.StopPiiEntitiesDetectionJob
* @see AWS API Documentation
*/
@Override
public StopPiiEntitiesDetectionJobResult stopPiiEntitiesDetectionJob(StopPiiEntitiesDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeStopPiiEntitiesDetectionJob(request);
}
@SdkInternalApi
final StopPiiEntitiesDetectionJobResult executeStopPiiEntitiesDetectionJob(StopPiiEntitiesDetectionJobRequest stopPiiEntitiesDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(stopPiiEntitiesDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StopPiiEntitiesDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(stopPiiEntitiesDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StopPiiEntitiesDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new StopPiiEntitiesDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Stops a sentiment detection job in progress.
*
*
* If the job state is IN_PROGRESS
, the job is marked for termination and put into the
* STOP_REQUESTED
state. If the job completes before it can be stopped, it is put into the
* COMPLETED
state; otherwise the job is be stopped and put into the STOPPED
state.
*
*
* If the job is in the COMPLETED
or FAILED
state when you call the
* StopDominantLanguageDetectionJob
operation, the operation returns a 400 Internal Request Exception.
*
*
* When a job is stopped, any documents already processed are written to the output location.
*
*
* @param stopSentimentDetectionJobRequest
* @return Result of the StopSentimentDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws JobNotFoundException
* The specified job was not found. Check the job ID and try again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.StopSentimentDetectionJob
* @see AWS API Documentation
*/
@Override
public StopSentimentDetectionJobResult stopSentimentDetectionJob(StopSentimentDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeStopSentimentDetectionJob(request);
}
@SdkInternalApi
final StopSentimentDetectionJobResult executeStopSentimentDetectionJob(StopSentimentDetectionJobRequest stopSentimentDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(stopSentimentDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StopSentimentDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(stopSentimentDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StopSentimentDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new StopSentimentDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Stops a targeted sentiment detection job in progress.
*
*
* If the job state is IN_PROGRESS
, the job is marked for termination and put into the
* STOP_REQUESTED
state. If the job completes before it can be stopped, it is put into the
* COMPLETED
state; otherwise the job is be stopped and put into the STOPPED
state.
*
*
* If the job is in the COMPLETED
or FAILED
state when you call the
* StopDominantLanguageDetectionJob
operation, the operation returns a 400 Internal Request Exception.
*
*
* When a job is stopped, any documents already processed are written to the output location.
*
*
* @param stopTargetedSentimentDetectionJobRequest
* @return Result of the StopTargetedSentimentDetectionJob operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws JobNotFoundException
* The specified job was not found. Check the job ID and try again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.StopTargetedSentimentDetectionJob
* @see AWS API Documentation
*/
@Override
public StopTargetedSentimentDetectionJobResult stopTargetedSentimentDetectionJob(StopTargetedSentimentDetectionJobRequest request) {
request = beforeClientExecution(request);
return executeStopTargetedSentimentDetectionJob(request);
}
@SdkInternalApi
final StopTargetedSentimentDetectionJobResult executeStopTargetedSentimentDetectionJob(
StopTargetedSentimentDetectionJobRequest stopTargetedSentimentDetectionJobRequest) {
ExecutionContext executionContext = createExecutionContext(stopTargetedSentimentDetectionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StopTargetedSentimentDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(stopTargetedSentimentDetectionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StopTargetedSentimentDetectionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new StopTargetedSentimentDetectionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Stops a document classifier training job while in progress.
*
*
* If the training job state is TRAINING
, the job is marked for termination and put into the
* STOP_REQUESTED
state. If the training job completes before it can be stopped, it is put into the
* TRAINED
; otherwise the training job is stopped and put into the STOPPED
state and the
* service sends back an HTTP 200 response with an empty HTTP body.
*
*
* @param stopTrainingDocumentClassifierRequest
* @return Result of the StopTrainingDocumentClassifier operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.StopTrainingDocumentClassifier
* @see AWS API Documentation
*/
@Override
public StopTrainingDocumentClassifierResult stopTrainingDocumentClassifier(StopTrainingDocumentClassifierRequest request) {
request = beforeClientExecution(request);
return executeStopTrainingDocumentClassifier(request);
}
@SdkInternalApi
final StopTrainingDocumentClassifierResult executeStopTrainingDocumentClassifier(StopTrainingDocumentClassifierRequest stopTrainingDocumentClassifierRequest) {
ExecutionContext executionContext = createExecutionContext(stopTrainingDocumentClassifierRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StopTrainingDocumentClassifierRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(stopTrainingDocumentClassifierRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StopTrainingDocumentClassifier");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new StopTrainingDocumentClassifierResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Stops an entity recognizer training job while in progress.
*
*
* If the training job state is TRAINING
, the job is marked for termination and put into the
* STOP_REQUESTED
state. If the training job completes before it can be stopped, it is put into the
* TRAINED
; otherwise the training job is stopped and putted into the STOPPED
state and
* the service sends back an HTTP 200 response with an empty HTTP body.
*
*
* @param stopTrainingEntityRecognizerRequest
* @return Result of the StopTrainingEntityRecognizer operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.StopTrainingEntityRecognizer
* @see AWS API Documentation
*/
@Override
public StopTrainingEntityRecognizerResult stopTrainingEntityRecognizer(StopTrainingEntityRecognizerRequest request) {
request = beforeClientExecution(request);
return executeStopTrainingEntityRecognizer(request);
}
@SdkInternalApi
final StopTrainingEntityRecognizerResult executeStopTrainingEntityRecognizer(StopTrainingEntityRecognizerRequest stopTrainingEntityRecognizerRequest) {
ExecutionContext executionContext = createExecutionContext(stopTrainingEntityRecognizerRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StopTrainingEntityRecognizerRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(stopTrainingEntityRecognizerRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StopTrainingEntityRecognizer");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new StopTrainingEntityRecognizerResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Associates a specific tag with an Amazon Comprehend resource. A tag is a key-value pair that adds as a metadata
* to a resource used by Amazon Comprehend. For example, a tag with "Sales" as the key might be added to a resource
* to indicate its use by the sales department.
*
*
* @param tagResourceRequest
* @return Result of the TagResource operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws ConcurrentModificationException
* Concurrent modification of the tags associated with an Amazon Comprehend resource is not supported.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws TooManyTagsException
* The request contains more tags than can be associated with a resource (50 tags per resource). The maximum
* number of tags includes both existing tags and those included in your current request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.TagResource
* @see AWS API
* Documentation
*/
@Override
public TagResourceResult tagResource(TagResourceRequest request) {
request = beforeClientExecution(request);
return executeTagResource(request);
}
@SdkInternalApi
final TagResourceResult executeTagResource(TagResourceRequest tagResourceRequest) {
ExecutionContext executionContext = createExecutionContext(tagResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new TagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(tagResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TagResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new TagResourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Removes a specific tag associated with an Amazon Comprehend resource.
*
*
* @param untagResourceRequest
* @return Result of the UntagResource operation returned by the service.
* @throws TooManyTagKeysException
* The request contains more tag keys than can be associated with a resource (50 tag keys per resource).
* @throws InvalidRequestException
* The request is invalid.
* @throws ConcurrentModificationException
* Concurrent modification of the tags associated with an Amazon Comprehend resource is not supported.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.UntagResource
* @see AWS API
* Documentation
*/
@Override
public UntagResourceResult untagResource(UntagResourceRequest request) {
request = beforeClientExecution(request);
return executeUntagResource(request);
}
@SdkInternalApi
final UntagResourceResult executeUntagResource(UntagResourceRequest untagResourceRequest) {
ExecutionContext executionContext = createExecutionContext(untagResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UntagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(untagResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UntagResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UntagResourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Updates information about the specified endpoint. For information about endpoints, see Managing endpoints.
*
*
* @param updateEndpointRequest
* @return Result of the UpdateEndpoint operation returned by the service.
* @throws InvalidRequestException
* The request is invalid.
* @throws TooManyRequestsException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws ResourceInUseException
* The specified resource name is already in use. Use a different name and try your request again.
* @throws ResourceLimitExceededException
* The maximum number of resources per account has been exceeded. Review the resources, and then try your
* request again.
* @throws ResourceNotFoundException
* The specified resource ARN was not found. Check the ARN and try your request again.
* @throws ResourceUnavailableException
* The specified resource is not available. Check the resource and try your request again.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AmazonComprehend.UpdateEndpoint
* @see AWS API
* Documentation
*/
@Override
public UpdateEndpointResult updateEndpoint(UpdateEndpointRequest request) {
request = beforeClientExecution(request);
return executeUpdateEndpoint(request);
}
@SdkInternalApi
final UpdateEndpointResult executeUpdateEndpoint(UpdateEndpointRequest updateEndpointRequest) {
ExecutionContext executionContext = createExecutionContext(updateEndpointRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateEndpointRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateEndpointRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateEndpoint");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler