software.amazon.awssdk.services.translate.TranslateAsyncClient Maven / Gradle / Ivy
Show all versions of translate Show documentation
/*
* Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.translate;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkClient;
import software.amazon.awssdk.services.translate.model.DeleteTerminologyRequest;
import software.amazon.awssdk.services.translate.model.DeleteTerminologyResponse;
import software.amazon.awssdk.services.translate.model.DescribeTextTranslationJobRequest;
import software.amazon.awssdk.services.translate.model.DescribeTextTranslationJobResponse;
import software.amazon.awssdk.services.translate.model.GetTerminologyRequest;
import software.amazon.awssdk.services.translate.model.GetTerminologyResponse;
import software.amazon.awssdk.services.translate.model.ImportTerminologyRequest;
import software.amazon.awssdk.services.translate.model.ImportTerminologyResponse;
import software.amazon.awssdk.services.translate.model.ListTerminologiesRequest;
import software.amazon.awssdk.services.translate.model.ListTerminologiesResponse;
import software.amazon.awssdk.services.translate.model.ListTextTranslationJobsRequest;
import software.amazon.awssdk.services.translate.model.ListTextTranslationJobsResponse;
import software.amazon.awssdk.services.translate.model.StartTextTranslationJobRequest;
import software.amazon.awssdk.services.translate.model.StartTextTranslationJobResponse;
import software.amazon.awssdk.services.translate.model.StopTextTranslationJobRequest;
import software.amazon.awssdk.services.translate.model.StopTextTranslationJobResponse;
import software.amazon.awssdk.services.translate.model.TranslateTextRequest;
import software.amazon.awssdk.services.translate.model.TranslateTextResponse;
import software.amazon.awssdk.services.translate.paginators.ListTerminologiesPublisher;
import software.amazon.awssdk.services.translate.paginators.ListTextTranslationJobsPublisher;
/**
* Service client for accessing Amazon Translate asynchronously. This can be created using the static {@link #builder()}
* method.
*
*
* Provides translation between one source language and another of the same set of languages.
*
*/
@Generated("software.amazon.awssdk:codegen")
public interface TranslateAsyncClient extends SdkClient {
String SERVICE_NAME = "translate";
/**
* Create a {@link TranslateAsyncClient} with the region loaded from the
* {@link software.amazon.awssdk.regions.providers.DefaultAwsRegionProviderChain} and credentials loaded from the
* {@link software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider}.
*/
static TranslateAsyncClient create() {
return builder().build();
}
/**
* Create a builder that can be used to configure and create a {@link TranslateAsyncClient}.
*/
static TranslateAsyncClientBuilder builder() {
return new DefaultTranslateAsyncClientBuilder();
}
/**
*
* A synchronous action that deletes a custom terminology.
*
*
* @param deleteTerminologyRequest
* @return A Java Future containing the result of the DeleteTerminology operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException The resource you are looking for has not been found. Review the resource
* you're looking for and see if a different resource will accomplish your needs before retrying the revised
* request.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.DeleteTerminology
* @see AWS
* API Documentation
*/
default CompletableFuture deleteTerminology(DeleteTerminologyRequest deleteTerminologyRequest) {
throw new UnsupportedOperationException();
}
/**
*
* A synchronous action that deletes a custom terminology.
*
*
*
* This is a convenience which creates an instance of the {@link DeleteTerminologyRequest.Builder} avoiding the need
* to create one manually via {@link DeleteTerminologyRequest#builder()}
*
*
* @param deleteTerminologyRequest
* A {@link Consumer} that will call methods on {@link DeleteTerminologyRequest.Builder} to create a request.
* @return A Java Future containing the result of the DeleteTerminology operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException The resource you are looking for has not been found. Review the resource
* you're looking for and see if a different resource will accomplish your needs before retrying the revised
* request.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.DeleteTerminology
* @see AWS
* API Documentation
*/
default CompletableFuture deleteTerminology(
Consumer deleteTerminologyRequest) {
return deleteTerminology(DeleteTerminologyRequest.builder().applyMutation(deleteTerminologyRequest).build());
}
/**
*
* Gets the properties associated with an asycnhronous batch translation job including name, ID, status, source and
* target languages, input/output S3 buckets, and so on.
*
*
* @param describeTextTranslationJobRequest
* @return A Java Future containing the result of the DescribeTextTranslationJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException The resource you are looking for has not been found. Review the resource
* you're looking for and see if a different resource will accomplish your needs before retrying the revised
* request.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.DescribeTextTranslationJob
* @see AWS API Documentation
*/
default CompletableFuture describeTextTranslationJob(
DescribeTextTranslationJobRequest describeTextTranslationJobRequest) {
throw new UnsupportedOperationException();
}
/**
*
* Gets the properties associated with an asycnhronous batch translation job including name, ID, status, source and
* target languages, input/output S3 buckets, and so on.
*
*
*
* This is a convenience which creates an instance of the {@link DescribeTextTranslationJobRequest.Builder} avoiding
* the need to create one manually via {@link DescribeTextTranslationJobRequest#builder()}
*
*
* @param describeTextTranslationJobRequest
* A {@link Consumer} that will call methods on {@link DescribeTextTranslationJobRequest.Builder} to create a
* request.
* @return A Java Future containing the result of the DescribeTextTranslationJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException The resource you are looking for has not been found. Review the resource
* you're looking for and see if a different resource will accomplish your needs before retrying the revised
* request.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.DescribeTextTranslationJob
* @see AWS API Documentation
*/
default CompletableFuture describeTextTranslationJob(
Consumer describeTextTranslationJobRequest) {
return describeTextTranslationJob(DescribeTextTranslationJobRequest.builder()
.applyMutation(describeTextTranslationJobRequest).build());
}
/**
*
* Retrieves a custom terminology.
*
*
* @param getTerminologyRequest
* @return A Java Future containing the result of the GetTerminology operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException The resource you are looking for has not been found. Review the resource
* you're looking for and see if a different resource will accomplish your needs before retrying the revised
* request.
* - InvalidParameterValueException The value of the parameter is invalid. Review the value of the
* parameter you are using to correct it, and then retry your operation.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.GetTerminology
* @see AWS API
* Documentation
*/
default CompletableFuture getTerminology(GetTerminologyRequest getTerminologyRequest) {
throw new UnsupportedOperationException();
}
/**
*
* Retrieves a custom terminology.
*
*
*
* This is a convenience which creates an instance of the {@link GetTerminologyRequest.Builder} avoiding the need to
* create one manually via {@link GetTerminologyRequest#builder()}
*
*
* @param getTerminologyRequest
* A {@link Consumer} that will call methods on {@link GetTerminologyRequest.Builder} to create a request.
* @return A Java Future containing the result of the GetTerminology operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException The resource you are looking for has not been found. Review the resource
* you're looking for and see if a different resource will accomplish your needs before retrying the revised
* request.
* - InvalidParameterValueException The value of the parameter is invalid. Review the value of the
* parameter you are using to correct it, and then retry your operation.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.GetTerminology
* @see AWS API
* Documentation
*/
default CompletableFuture getTerminology(Consumer getTerminologyRequest) {
return getTerminology(GetTerminologyRequest.builder().applyMutation(getTerminologyRequest).build());
}
/**
*
* Creates or updates a custom terminology, depending on whether or not one already exists for the given terminology
* name. Importing a terminology with the same name as an existing one will merge the terminologies based on the
* chosen merge strategy. Currently, the only supported merge strategy is OVERWRITE, and so the imported terminology
* will overwrite an existing terminology of the same name.
*
*
* If you import a terminology that overwrites an existing one, the new terminology take up to 10 minutes to fully
* propagate and be available for use in a translation due to cache policies with the DataPlane service that
* performs the translations.
*
*
* @param importTerminologyRequest
* @return A Java Future containing the result of the ImportTerminology operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterValueException The value of the parameter is invalid. Review the value of the
* parameter you are using to correct it, and then retry your operation.
* - LimitExceededException The specified limit has been exceeded. Review your request and retry it with a
* quantity below the stated limit.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.ImportTerminology
* @see AWS
* API Documentation
*/
default CompletableFuture importTerminology(ImportTerminologyRequest importTerminologyRequest) {
throw new UnsupportedOperationException();
}
/**
*
* Creates or updates a custom terminology, depending on whether or not one already exists for the given terminology
* name. Importing a terminology with the same name as an existing one will merge the terminologies based on the
* chosen merge strategy. Currently, the only supported merge strategy is OVERWRITE, and so the imported terminology
* will overwrite an existing terminology of the same name.
*
*
* If you import a terminology that overwrites an existing one, the new terminology take up to 10 minutes to fully
* propagate and be available for use in a translation due to cache policies with the DataPlane service that
* performs the translations.
*
*
*
* This is a convenience which creates an instance of the {@link ImportTerminologyRequest.Builder} avoiding the need
* to create one manually via {@link ImportTerminologyRequest#builder()}
*
*
* @param importTerminologyRequest
* A {@link Consumer} that will call methods on {@link ImportTerminologyRequest.Builder} to create a request.
* @return A Java Future containing the result of the ImportTerminology operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterValueException The value of the parameter is invalid. Review the value of the
* parameter you are using to correct it, and then retry your operation.
* - LimitExceededException The specified limit has been exceeded. Review your request and retry it with a
* quantity below the stated limit.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.ImportTerminology
* @see AWS
* API Documentation
*/
default CompletableFuture importTerminology(
Consumer importTerminologyRequest) {
return importTerminology(ImportTerminologyRequest.builder().applyMutation(importTerminologyRequest).build());
}
/**
*
* Provides a list of custom terminologies associated with your account.
*
*
* @param listTerminologiesRequest
* @return A Java Future containing the result of the ListTerminologies operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterValueException The value of the parameter is invalid. Review the value of the
* parameter you are using to correct it, and then retry your operation.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.ListTerminologies
* @see AWS
* API Documentation
*/
default CompletableFuture listTerminologies(ListTerminologiesRequest listTerminologiesRequest) {
throw new UnsupportedOperationException();
}
/**
*
* Provides a list of custom terminologies associated with your account.
*
*
*
* This is a convenience which creates an instance of the {@link ListTerminologiesRequest.Builder} avoiding the need
* to create one manually via {@link ListTerminologiesRequest#builder()}
*
*
* @param listTerminologiesRequest
* A {@link Consumer} that will call methods on {@link ListTerminologiesRequest.Builder} to create a request.
* @return A Java Future containing the result of the ListTerminologies operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterValueException The value of the parameter is invalid. Review the value of the
* parameter you are using to correct it, and then retry your operation.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.ListTerminologies
* @see AWS
* API Documentation
*/
default CompletableFuture listTerminologies(
Consumer listTerminologiesRequest) {
return listTerminologies(ListTerminologiesRequest.builder().applyMutation(listTerminologiesRequest).build());
}
/**
*
* Provides a list of custom terminologies associated with your account.
*
*
* @return A Java Future containing the result of the ListTerminologies operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterValueException The value of the parameter is invalid. Review the value of the
* parameter you are using to correct it, and then retry your operation.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.ListTerminologies
* @see AWS
* API Documentation
*/
default CompletableFuture listTerminologies() {
return listTerminologies(ListTerminologiesRequest.builder().build());
}
/**
*
* Provides a list of custom terminologies associated with your account.
*
*
*
* This is a variant of
* {@link #listTerminologies(software.amazon.awssdk.services.translate.model.ListTerminologiesRequest)} operation.
* The return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will
* internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.translate.paginators.ListTerminologiesPublisher publisher = client.listTerminologiesPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.translate.paginators.ListTerminologiesPublisher publisher = client.listTerminologiesPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.translate.model.ListTerminologiesResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Note: If you prefer to have control on service calls, use the
* {@link #listTerminologies(software.amazon.awssdk.services.translate.model.ListTerminologiesRequest)}
* operation.
*
*
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterValueException The value of the parameter is invalid. Review the value of the
* parameter you are using to correct it, and then retry your operation.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.ListTerminologies
* @see AWS
* API Documentation
*/
default ListTerminologiesPublisher listTerminologiesPaginator() {
return listTerminologiesPaginator(ListTerminologiesRequest.builder().build());
}
/**
*
* Provides a list of custom terminologies associated with your account.
*
*
*
* This is a variant of
* {@link #listTerminologies(software.amazon.awssdk.services.translate.model.ListTerminologiesRequest)} operation.
* The return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will
* internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.translate.paginators.ListTerminologiesPublisher publisher = client.listTerminologiesPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.translate.paginators.ListTerminologiesPublisher publisher = client.listTerminologiesPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.translate.model.ListTerminologiesResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Note: If you prefer to have control on service calls, use the
* {@link #listTerminologies(software.amazon.awssdk.services.translate.model.ListTerminologiesRequest)}
* operation.
*
*
* @param listTerminologiesRequest
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterValueException The value of the parameter is invalid. Review the value of the
* parameter you are using to correct it, and then retry your operation.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.ListTerminologies
* @see AWS
* API Documentation
*/
default ListTerminologiesPublisher listTerminologiesPaginator(ListTerminologiesRequest listTerminologiesRequest) {
throw new UnsupportedOperationException();
}
/**
*
* Provides a list of custom terminologies associated with your account.
*
*
*
* This is a variant of
* {@link #listTerminologies(software.amazon.awssdk.services.translate.model.ListTerminologiesRequest)} operation.
* The return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will
* internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.translate.paginators.ListTerminologiesPublisher publisher = client.listTerminologiesPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.translate.paginators.ListTerminologiesPublisher publisher = client.listTerminologiesPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.translate.model.ListTerminologiesResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Note: If you prefer to have control on service calls, use the
* {@link #listTerminologies(software.amazon.awssdk.services.translate.model.ListTerminologiesRequest)}
* operation.
*
*
* This is a convenience which creates an instance of the {@link ListTerminologiesRequest.Builder} avoiding the need
* to create one manually via {@link ListTerminologiesRequest#builder()}
*
*
* @param listTerminologiesRequest
* A {@link Consumer} that will call methods on {@link ListTerminologiesRequest.Builder} to create a request.
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterValueException The value of the parameter is invalid. Review the value of the
* parameter you are using to correct it, and then retry your operation.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.ListTerminologies
* @see AWS
* API Documentation
*/
default ListTerminologiesPublisher listTerminologiesPaginator(
Consumer listTerminologiesRequest) {
return listTerminologiesPaginator(ListTerminologiesRequest.builder().applyMutation(listTerminologiesRequest).build());
}
/**
*
* Gets a list of the batch translation jobs that you have submitted.
*
*
* @param listTextTranslationJobsRequest
* @return A Java Future containing the result of the ListTextTranslationJobs operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException The request that you made is invalid. Check your request to determine why
* it's invalid and then retry the request.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - InvalidFilterException The filter specified for the operation is invalid. Specify a different filter.
*
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.ListTextTranslationJobs
* @see AWS API Documentation
*/
default CompletableFuture listTextTranslationJobs(
ListTextTranslationJobsRequest listTextTranslationJobsRequest) {
throw new UnsupportedOperationException();
}
/**
*
* Gets a list of the batch translation jobs that you have submitted.
*
*
*
* This is a convenience which creates an instance of the {@link ListTextTranslationJobsRequest.Builder} avoiding
* the need to create one manually via {@link ListTextTranslationJobsRequest#builder()}
*
*
* @param listTextTranslationJobsRequest
* A {@link Consumer} that will call methods on {@link ListTextTranslationJobsRequest.Builder} to create a
* request.
* @return A Java Future containing the result of the ListTextTranslationJobs operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException The request that you made is invalid. Check your request to determine why
* it's invalid and then retry the request.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - InvalidFilterException The filter specified for the operation is invalid. Specify a different filter.
*
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.ListTextTranslationJobs
* @see AWS API Documentation
*/
default CompletableFuture listTextTranslationJobs(
Consumer listTextTranslationJobsRequest) {
return listTextTranslationJobs(ListTextTranslationJobsRequest.builder().applyMutation(listTextTranslationJobsRequest)
.build());
}
/**
*
* Gets a list of the batch translation jobs that you have submitted.
*
*
*
* This is a variant of
* {@link #listTextTranslationJobs(software.amazon.awssdk.services.translate.model.ListTextTranslationJobsRequest)}
* operation. The return type is a custom publisher that can be subscribed to request a stream of response pages.
* SDK will internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.translate.paginators.ListTextTranslationJobsPublisher publisher = client.listTextTranslationJobsPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.translate.paginators.ListTextTranslationJobsPublisher publisher = client.listTextTranslationJobsPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.translate.model.ListTextTranslationJobsResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Note: If you prefer to have control on service calls, use the
* {@link #listTextTranslationJobs(software.amazon.awssdk.services.translate.model.ListTextTranslationJobsRequest)}
* operation.
*
*
* @param listTextTranslationJobsRequest
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException The request that you made is invalid. Check your request to determine why
* it's invalid and then retry the request.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - InvalidFilterException The filter specified for the operation is invalid. Specify a different filter.
*
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.ListTextTranslationJobs
* @see AWS API Documentation
*/
default ListTextTranslationJobsPublisher listTextTranslationJobsPaginator(
ListTextTranslationJobsRequest listTextTranslationJobsRequest) {
throw new UnsupportedOperationException();
}
/**
*
* Gets a list of the batch translation jobs that you have submitted.
*
*
*
* This is a variant of
* {@link #listTextTranslationJobs(software.amazon.awssdk.services.translate.model.ListTextTranslationJobsRequest)}
* operation. The return type is a custom publisher that can be subscribed to request a stream of response pages.
* SDK will internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.translate.paginators.ListTextTranslationJobsPublisher publisher = client.listTextTranslationJobsPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.translate.paginators.ListTextTranslationJobsPublisher publisher = client.listTextTranslationJobsPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.translate.model.ListTextTranslationJobsResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* Note: If you prefer to have control on service calls, use the
* {@link #listTextTranslationJobs(software.amazon.awssdk.services.translate.model.ListTextTranslationJobsRequest)}
* operation.
*
*
* This is a convenience which creates an instance of the {@link ListTextTranslationJobsRequest.Builder} avoiding
* the need to create one manually via {@link ListTextTranslationJobsRequest#builder()}
*
*
* @param listTextTranslationJobsRequest
* A {@link Consumer} that will call methods on {@link ListTextTranslationJobsRequest.Builder} to create a
* request.
* @return A custom publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException The request that you made is invalid. Check your request to determine why
* it's invalid and then retry the request.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - InvalidFilterException The filter specified for the operation is invalid. Specify a different filter.
*
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.ListTextTranslationJobs
* @see AWS API Documentation
*/
default ListTextTranslationJobsPublisher listTextTranslationJobsPaginator(
Consumer listTextTranslationJobsRequest) {
return listTextTranslationJobsPaginator(ListTextTranslationJobsRequest.builder()
.applyMutation(listTextTranslationJobsRequest).build());
}
/**
*
* Starts an asynchronous batch translation job. Batch translation jobs can be used to translate large volumes of
* text across multiple documents at once. For more information, see async.
*
*
* Batch translation jobs can be described with the DescribeTextTranslationJob operation, listed with the
* ListTextTranslationJobs operation, and stopped with the StopTextTranslationJob operation.
*
*
*
* Amazon Translate does not support batch translation of multiple source languages at once.
*
*
*
* @param startTextTranslationJobRequest
* @return A Java Future containing the result of the StartTextTranslationJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - UnsupportedLanguagePairException Amazon Translate does not support translation from the language of
* the source text into the requested target language. For more information, see how-to-error-msg.
* - InvalidRequestException The request that you made is invalid. Check your request to determine why
* it's invalid and then retry the request.
* - ResourceNotFoundException The resource you are looking for has not been found. Review the resource
* you're looking for and see if a different resource will accomplish your needs before retrying the revised
* request.
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.StartTextTranslationJob
* @see AWS API Documentation
*/
default CompletableFuture startTextTranslationJob(
StartTextTranslationJobRequest startTextTranslationJobRequest) {
throw new UnsupportedOperationException();
}
/**
*
* Starts an asynchronous batch translation job. Batch translation jobs can be used to translate large volumes of
* text across multiple documents at once. For more information, see async.
*
*
* Batch translation jobs can be described with the DescribeTextTranslationJob operation, listed with the
* ListTextTranslationJobs operation, and stopped with the StopTextTranslationJob operation.
*
*
*
* Amazon Translate does not support batch translation of multiple source languages at once.
*
*
*
* This is a convenience which creates an instance of the {@link StartTextTranslationJobRequest.Builder} avoiding
* the need to create one manually via {@link StartTextTranslationJobRequest#builder()}
*
*
* @param startTextTranslationJobRequest
* A {@link Consumer} that will call methods on {@link StartTextTranslationJobRequest.Builder} to create a
* request.
* @return A Java Future containing the result of the StartTextTranslationJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - UnsupportedLanguagePairException Amazon Translate does not support translation from the language of
* the source text into the requested target language. For more information, see how-to-error-msg.
* - InvalidRequestException The request that you made is invalid. Check your request to determine why
* it's invalid and then retry the request.
* - ResourceNotFoundException The resource you are looking for has not been found. Review the resource
* you're looking for and see if a different resource will accomplish your needs before retrying the revised
* request.
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.StartTextTranslationJob
* @see AWS API Documentation
*/
default CompletableFuture startTextTranslationJob(
Consumer startTextTranslationJobRequest) {
return startTextTranslationJob(StartTextTranslationJobRequest.builder().applyMutation(startTextTranslationJobRequest)
.build());
}
/**
*
* Stops an asynchronous batch translation job that is in progress.
*
*
* If the job's state is IN_PROGRESS
, the job will be 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 put into the STOPPED
state.
*
*
* Asynchronous batch translation jobs are started with the StartTextTranslationJob operation. You can use
* the DescribeTextTranslationJob or ListTextTranslationJobs operations to get a batch translation
* job's JobId
.
*
*
* @param stopTextTranslationJobRequest
* @return A Java Future containing the result of the StopTextTranslationJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException The resource you are looking for has not been found. Review the resource
* you're looking for and see if a different resource will accomplish your needs before retrying the revised
* request.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.StopTextTranslationJob
* @see AWS API Documentation
*/
default CompletableFuture stopTextTranslationJob(
StopTextTranslationJobRequest stopTextTranslationJobRequest) {
throw new UnsupportedOperationException();
}
/**
*
* Stops an asynchronous batch translation job that is in progress.
*
*
* If the job's state is IN_PROGRESS
, the job will be 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 put into the STOPPED
state.
*
*
* Asynchronous batch translation jobs are started with the StartTextTranslationJob operation. You can use
* the DescribeTextTranslationJob or ListTextTranslationJobs operations to get a batch translation
* job's JobId
.
*
*
*
* This is a convenience which creates an instance of the {@link StopTextTranslationJobRequest.Builder} avoiding the
* need to create one manually via {@link StopTextTranslationJobRequest#builder()}
*
*
* @param stopTextTranslationJobRequest
* A {@link Consumer} that will call methods on {@link StopTextTranslationJobRequest.Builder} to create a
* request.
* @return A Java Future containing the result of the StopTextTranslationJob operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException The resource you are looking for has not been found. Review the resource
* you're looking for and see if a different resource will accomplish your needs before retrying the revised
* request.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - InternalServerException An internal server error occurred. Retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.StopTextTranslationJob
* @see AWS API Documentation
*/
default CompletableFuture stopTextTranslationJob(
Consumer stopTextTranslationJobRequest) {
return stopTextTranslationJob(StopTextTranslationJobRequest.builder().applyMutation(stopTextTranslationJobRequest)
.build());
}
/**
*
* Translates input text from the source language to the target language. For a list of available languages and
* language codes, see what-is-languages.
*
*
* @param translateTextRequest
* @return A Java Future containing the result of the TranslateText operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException The request that you made is invalid. Check your request to determine why
* it's invalid and then retry the request.
* - TextSizeLimitExceededException The size of the text you submitted exceeds the size limit. Reduce the
* size of the text or use a smaller document and then retry your request.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - UnsupportedLanguagePairException Amazon Translate does not support translation from the language of
* the source text into the requested target language. For more information, see how-to-error-msg.
* - DetectedLanguageLowConfidenceException The confidence that Amazon Comprehend accurately detected the
* source language is low. If a low confidence level is acceptable for your application, you can use the
* language in the exception to call Amazon Translate again. For more information, see the DetectDominantLanguage operation in the Amazon Comprehend Developer Guide.
* - ResourceNotFoundException The resource you are looking for has not been found. Review the resource
* you're looking for and see if a different resource will accomplish your needs before retrying the revised
* request.
* - InternalServerException An internal server error occurred. Retry your request.
* - ServiceUnavailableException The Amazon Translate service is temporarily unavailable. Please wait a
* bit and then retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.TranslateText
* @see AWS API
* Documentation
*/
default CompletableFuture translateText(TranslateTextRequest translateTextRequest) {
throw new UnsupportedOperationException();
}
/**
*
* Translates input text from the source language to the target language. For a list of available languages and
* language codes, see what-is-languages.
*
*
*
* This is a convenience which creates an instance of the {@link TranslateTextRequest.Builder} avoiding the need to
* create one manually via {@link TranslateTextRequest#builder()}
*
*
* @param translateTextRequest
* A {@link Consumer} that will call methods on {@link TranslateTextRequest.Builder} to create a request.
* @return A Java Future containing the result of the TranslateText operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidRequestException The request that you made is invalid. Check your request to determine why
* it's invalid and then retry the request.
* - TextSizeLimitExceededException The size of the text you submitted exceeds the size limit. Reduce the
* size of the text or use a smaller document and then retry your request.
* - TooManyRequestsException You have made too many requests within a short period of time. Wait for a
* short time and then try your request again.
* - UnsupportedLanguagePairException Amazon Translate does not support translation from the language of
* the source text into the requested target language. For more information, see how-to-error-msg.
* - DetectedLanguageLowConfidenceException The confidence that Amazon Comprehend accurately detected the
* source language is low. If a low confidence level is acceptable for your application, you can use the
* language in the exception to call Amazon Translate again. For more information, see the DetectDominantLanguage operation in the Amazon Comprehend Developer Guide.
* - ResourceNotFoundException The resource you are looking for has not been found. Review the resource
* you're looking for and see if a different resource will accomplish your needs before retrying the revised
* request.
* - InternalServerException An internal server error occurred. Retry your request.
* - ServiceUnavailableException The Amazon Translate service is temporarily unavailable. Please wait a
* bit and then retry your request.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - TranslateException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample TranslateAsyncClient.TranslateText
* @see AWS API
* Documentation
*/
default CompletableFuture translateText(Consumer translateTextRequest) {
return translateText(TranslateTextRequest.builder().applyMutation(translateTextRequest).build());
}
}