Skip to content

Commit 044caf2

Browse files
feat(aws-android-sdk-translate): update models to latest (#3298)
Co-authored-by: Thomas Leing <[email protected]>
1 parent 59ce640 commit 044caf2

File tree

175 files changed

+2591
-253
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+2591
-253
lines changed

aws-android-sdk-translate/src/main/java/com/amazonaws/services/translate/AmazonTranslate.java

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
* Copyright 2010-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License").
55
* You may not use this file except in compliance with the License.
@@ -492,6 +492,47 @@ StopTextTranslationJobResult stopTextTranslationJob(
492492
TagResourceResult tagResource(TagResourceRequest tagResourceRequest)
493493
throws AmazonClientException, AmazonServiceException;
494494

495+
/**
496+
* <p>
497+
* Translates the input document from the source language to the target
498+
* language. This synchronous operation supports plain text or HTML for the
499+
* input document. <code>TranslateDocument</code> supports translations from
500+
* English to any supported language, and from any supported language to
501+
* English. Therefore, specify either the source language code or the target
502+
* language code as “en” (English).
503+
* </p>
504+
* <p>
505+
* <code>TranslateDocument</code> does not support language auto-detection.
506+
* </p>
507+
* <p>
508+
* If you set the <code>Formality</code> parameter, the request will fail if
509+
* the target language does not support formality. For a list of target
510+
* languages that support formality, see <a href=
511+
* "https://docs.aws.amazon.com/translate/latest/dg/customizing-translations-formality.html"
512+
* >Setting formality</a>.
513+
* </p>
514+
*
515+
* @param translateDocumentRequest
516+
* @return translateDocumentResult The response from the TranslateDocument
517+
* service method, as returned by Amazon Translate.
518+
* @throws InvalidRequestException
519+
* @throws LimitExceededException
520+
* @throws TooManyRequestsException
521+
* @throws ResourceNotFoundException
522+
* @throws UnsupportedLanguagePairException
523+
* @throws InternalServerException
524+
* @throws ServiceUnavailableException
525+
* @throws AmazonClientException If any internal errors are encountered
526+
* inside the client while attempting to make the request or
527+
* handle the response. For example if a network connection is
528+
* not available.
529+
* @throws AmazonServiceException If an error response is returned by Amazon
530+
* Translate indicating either a problem with the data in the
531+
* request, or a server side issue.
532+
*/
533+
TranslateDocumentResult translateDocument(TranslateDocumentRequest translateDocumentRequest)
534+
throws AmazonClientException, AmazonServiceException;
535+
495536
/**
496537
* <p>
497538
* Translates input text from the source language to the target language.

aws-android-sdk-translate/src/main/java/com/amazonaws/services/translate/AmazonTranslateAsync.java

Lines changed: 92 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
* Copyright 2010-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License").
55
* You may not use this file except in compliance with the License.
@@ -942,6 +942,97 @@ Future<TagResourceResult> tagResourceAsync(TagResourceRequest tagResourceRequest
942942
AsyncHandler<TagResourceRequest, TagResourceResult> asyncHandler)
943943
throws AmazonServiceException, AmazonClientException;
944944

945+
/**
946+
* <p>
947+
* Translates the input document from the source language to the target
948+
* language. This synchronous operation supports plain text or HTML for the
949+
* input document. <code>TranslateDocument</code> supports translations from
950+
* English to any supported language, and from any supported language to
951+
* English. Therefore, specify either the source language code or the target
952+
* language code as “en” (English).
953+
* </p>
954+
* <p>
955+
* <code>TranslateDocument</code> does not support language auto-detection.
956+
* </p>
957+
* <p>
958+
* If you set the <code>Formality</code> parameter, the request will fail if
959+
* the target language does not support formality. For a list of target
960+
* languages that support formality, see <a href=
961+
* "https://docs.aws.amazon.com/translate/latest/dg/customizing-translations-formality.html"
962+
* >Setting formality</a>.
963+
* </p>
964+
*
965+
* @param translateDocumentRequest
966+
* @return A Java Future object containing the response from the
967+
* TranslateDocument service method, as returned by Amazon
968+
* Translate.
969+
* @throws InvalidRequestException
970+
* @throws LimitExceededException
971+
* @throws TooManyRequestsException
972+
* @throws ResourceNotFoundException
973+
* @throws UnsupportedLanguagePairException
974+
* @throws InternalServerException
975+
* @throws ServiceUnavailableException
976+
* @throws AmazonClientException If any internal errors are encountered
977+
* inside the client while attempting to make the request or
978+
* handle the response. For example if a network connection is
979+
* not available.
980+
* @throws AmazonServiceException If an error response is returned by Amazon
981+
* Translate indicating either a problem with the data in the
982+
* request, or a server side issue.
983+
*/
984+
Future<TranslateDocumentResult> translateDocumentAsync(
985+
TranslateDocumentRequest translateDocumentRequest) throws AmazonServiceException,
986+
AmazonClientException;
987+
988+
/**
989+
* <p>
990+
* Translates the input document from the source language to the target
991+
* language. This synchronous operation supports plain text or HTML for the
992+
* input document. <code>TranslateDocument</code> supports translations from
993+
* English to any supported language, and from any supported language to
994+
* English. Therefore, specify either the source language code or the target
995+
* language code as “en” (English).
996+
* </p>
997+
* <p>
998+
* <code>TranslateDocument</code> does not support language auto-detection.
999+
* </p>
1000+
* <p>
1001+
* If you set the <code>Formality</code> parameter, the request will fail if
1002+
* the target language does not support formality. For a list of target
1003+
* languages that support formality, see <a href=
1004+
* "https://docs.aws.amazon.com/translate/latest/dg/customizing-translations-formality.html"
1005+
* >Setting formality</a>.
1006+
* </p>
1007+
*
1008+
* @param translateDocumentRequest
1009+
* @param asyncHandler Asynchronous callback handler for events in the
1010+
* life-cycle of the request. Users could provide the
1011+
* implementation of the four callback methods in this interface
1012+
* to process the operation result or handle the exception.
1013+
* @return A Java Future object containing the response from the
1014+
* TranslateDocument service method, as returned by Amazon
1015+
* Translate.
1016+
* @throws InvalidRequestException
1017+
* @throws LimitExceededException
1018+
* @throws TooManyRequestsException
1019+
* @throws ResourceNotFoundException
1020+
* @throws UnsupportedLanguagePairException
1021+
* @throws InternalServerException
1022+
* @throws ServiceUnavailableException
1023+
* @throws AmazonClientException If any internal errors are encountered
1024+
* inside the client while attempting to make the request or
1025+
* handle the response. For example if a network connection is
1026+
* not available.
1027+
* @throws AmazonServiceException If an error response is returned by Amazon
1028+
* Translate indicating either a problem with the data in the
1029+
* request, or a server side issue.
1030+
*/
1031+
Future<TranslateDocumentResult> translateDocumentAsync(
1032+
TranslateDocumentRequest translateDocumentRequest,
1033+
AsyncHandler<TranslateDocumentRequest, TranslateDocumentResult> asyncHandler)
1034+
throws AmazonServiceException, AmazonClientException;
1035+
9451036
/**
9461037
* <p>
9471038
* Translates input text from the source language to the target language.

aws-android-sdk-translate/src/main/java/com/amazonaws/services/translate/AmazonTranslateAsyncClient.java

Lines changed: 108 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
* Copyright 2010-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License").
55
* You may not use this file except in compliance with the License.
@@ -1417,6 +1417,113 @@ public TagResourceResult call() throws Exception {
14171417
});
14181418
}
14191419

1420+
/**
1421+
* <p>
1422+
* Translates the input document from the source language to the target
1423+
* language. This synchronous operation supports plain text or HTML for the
1424+
* input document. <code>TranslateDocument</code> supports translations from
1425+
* English to any supported language, and from any supported language to
1426+
* English. Therefore, specify either the source language code or the target
1427+
* language code as “en” (English).
1428+
* </p>
1429+
* <p>
1430+
* <code>TranslateDocument</code> does not support language auto-detection.
1431+
* </p>
1432+
* <p>
1433+
* If you set the <code>Formality</code> parameter, the request will fail if
1434+
* the target language does not support formality. For a list of target
1435+
* languages that support formality, see <a href=
1436+
* "https://docs.aws.amazon.com/translate/latest/dg/customizing-translations-formality.html"
1437+
* >Setting formality</a>.
1438+
* </p>
1439+
*
1440+
* @param translateDocumentRequest
1441+
* @return A Java Future object containing the response from the
1442+
* TranslateDocument service method, as returned by Amazon
1443+
* Translate.
1444+
* @throws InvalidRequestException
1445+
* @throws LimitExceededException
1446+
* @throws TooManyRequestsException
1447+
* @throws ResourceNotFoundException
1448+
* @throws UnsupportedLanguagePairException
1449+
* @throws InternalServerException
1450+
* @throws ServiceUnavailableException
1451+
* @throws AmazonClientException If any internal errors are encountered
1452+
* inside the client while attempting to make the request or
1453+
* handle the response. For example if a network connection is
1454+
* not available.
1455+
* @throws AmazonServiceException If an error response is returned by Amazon
1456+
* Translate indicating either a problem with the data in the
1457+
* request, or a server side issue.
1458+
*/
1459+
public Future<TranslateDocumentResult> translateDocumentAsync(
1460+
final TranslateDocumentRequest translateDocumentRequest) throws AmazonServiceException,
1461+
AmazonClientException {
1462+
return executorService.submit(new Callable<TranslateDocumentResult>() {
1463+
public TranslateDocumentResult call() throws Exception {
1464+
return translateDocument(translateDocumentRequest);
1465+
}
1466+
});
1467+
}
1468+
1469+
/**
1470+
* <p>
1471+
* Translates the input document from the source language to the target
1472+
* language. This synchronous operation supports plain text or HTML for the
1473+
* input document. <code>TranslateDocument</code> supports translations from
1474+
* English to any supported language, and from any supported language to
1475+
* English. Therefore, specify either the source language code or the target
1476+
* language code as “en” (English).
1477+
* </p>
1478+
* <p>
1479+
* <code>TranslateDocument</code> does not support language auto-detection.
1480+
* </p>
1481+
* <p>
1482+
* If you set the <code>Formality</code> parameter, the request will fail if
1483+
* the target language does not support formality. For a list of target
1484+
* languages that support formality, see <a href=
1485+
* "https://docs.aws.amazon.com/translate/latest/dg/customizing-translations-formality.html"
1486+
* >Setting formality</a>.
1487+
* </p>
1488+
*
1489+
* @param translateDocumentRequest
1490+
* @return A Java Future object containing the response from the
1491+
* TranslateDocument service method, as returned by Amazon
1492+
* Translate.
1493+
* @throws InvalidRequestException
1494+
* @throws LimitExceededException
1495+
* @throws TooManyRequestsException
1496+
* @throws ResourceNotFoundException
1497+
* @throws UnsupportedLanguagePairException
1498+
* @throws InternalServerException
1499+
* @throws ServiceUnavailableException
1500+
* @throws AmazonClientException If any internal errors are encountered
1501+
* inside the client while attempting to make the request or
1502+
* handle the response. For example if a network connection is
1503+
* not available.
1504+
* @throws AmazonServiceException If an error response is returned by Amazon
1505+
* Translate indicating either a problem with the data in the
1506+
* request, or a server side issue.
1507+
*/
1508+
public Future<TranslateDocumentResult> translateDocumentAsync(
1509+
final TranslateDocumentRequest translateDocumentRequest,
1510+
final AsyncHandler<TranslateDocumentRequest, TranslateDocumentResult> asyncHandler)
1511+
throws AmazonServiceException, AmazonClientException {
1512+
return executorService.submit(new Callable<TranslateDocumentResult>() {
1513+
public TranslateDocumentResult call() throws Exception {
1514+
TranslateDocumentResult result = null;
1515+
try {
1516+
result = translateDocument(translateDocumentRequest);
1517+
} catch (Exception ex) {
1518+
asyncHandler.onError(ex);
1519+
throw ex;
1520+
}
1521+
asyncHandler.onSuccess(translateDocumentRequest, result);
1522+
return result;
1523+
}
1524+
});
1525+
}
1526+
14201527
/**
14211528
* <p>
14221529
* Translates input text from the source language to the target language.

aws-android-sdk-translate/src/main/java/com/amazonaws/services/translate/AmazonTranslateClient.java

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
* Copyright 2010-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License").
55
* You may not use this file except in compliance with the License.
@@ -1165,6 +1165,75 @@ public TagResourceResult tagResource(TagResourceRequest tagResourceRequest)
11651165
}
11661166
}
11671167

1168+
/**
1169+
* <p>
1170+
* Translates the input document from the source language to the target
1171+
* language. This synchronous operation supports plain text or HTML for the
1172+
* input document. <code>TranslateDocument</code> supports translations from
1173+
* English to any supported language, and from any supported language to
1174+
* English. Therefore, specify either the source language code or the target
1175+
* language code as “en” (English).
1176+
* </p>
1177+
* <p>
1178+
* <code>TranslateDocument</code> does not support language auto-detection.
1179+
* </p>
1180+
* <p>
1181+
* If you set the <code>Formality</code> parameter, the request will fail if
1182+
* the target language does not support formality. For a list of target
1183+
* languages that support formality, see <a href=
1184+
* "https://docs.aws.amazon.com/translate/latest/dg/customizing-translations-formality.html"
1185+
* >Setting formality</a>.
1186+
* </p>
1187+
*
1188+
* @param translateDocumentRequest
1189+
* @return translateDocumentResult The response from the TranslateDocument
1190+
* service method, as returned by Amazon Translate.
1191+
* @throws InvalidRequestException
1192+
* @throws LimitExceededException
1193+
* @throws TooManyRequestsException
1194+
* @throws ResourceNotFoundException
1195+
* @throws UnsupportedLanguagePairException
1196+
* @throws InternalServerException
1197+
* @throws ServiceUnavailableException
1198+
* @throws AmazonClientException If any internal errors are encountered
1199+
* inside the client while attempting to make the request or
1200+
* handle the response. For example if a network connection is
1201+
* not available.
1202+
* @throws AmazonServiceException If an error response is returned by Amazon
1203+
* Translate indicating either a problem with the data in the
1204+
* request, or a server side issue.
1205+
*/
1206+
public TranslateDocumentResult translateDocument(
1207+
TranslateDocumentRequest translateDocumentRequest)
1208+
throws AmazonServiceException, AmazonClientException {
1209+
ExecutionContext executionContext = createExecutionContext(translateDocumentRequest);
1210+
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
1211+
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
1212+
Request<TranslateDocumentRequest> request = null;
1213+
Response<TranslateDocumentResult> response = null;
1214+
try {
1215+
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
1216+
try {
1217+
request = new TranslateDocumentRequestMarshaller()
1218+
.marshall(translateDocumentRequest);
1219+
// Binds the request metrics to the current request.
1220+
request.setAWSRequestMetrics(awsRequestMetrics);
1221+
} finally {
1222+
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
1223+
}
1224+
Unmarshaller<TranslateDocumentResult, JsonUnmarshallerContext> unmarshaller = new TranslateDocumentResultJsonUnmarshaller();
1225+
JsonResponseHandler<TranslateDocumentResult> responseHandler = new JsonResponseHandler<TranslateDocumentResult>(
1226+
unmarshaller);
1227+
1228+
response = invoke(request, responseHandler, executionContext);
1229+
1230+
return response.getAwsResponse();
1231+
} finally {
1232+
awsRequestMetrics.endEvent(Field.ClientExecuteTime);
1233+
endClientExecution(awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC);
1234+
}
1235+
}
1236+
11681237
/**
11691238
* <p>
11701239
* Translates input text from the source language to the target language.

aws-android-sdk-translate/src/main/java/com/amazonaws/services/translate/model/AppliedTerminology.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
* Copyright 2010-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License").
55
* You may not use this file except in compliance with the License.

aws-android-sdk-translate/src/main/java/com/amazonaws/services/translate/model/ConcurrentModificationException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
* Copyright 2010-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License").
55
* You may not use this file except in compliance with the License.

aws-android-sdk-translate/src/main/java/com/amazonaws/services/translate/model/ConflictException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
* Copyright 2010-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License").
55
* You may not use this file except in compliance with the License.

aws-android-sdk-translate/src/main/java/com/amazonaws/services/translate/model/CreateParallelDataRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
* Copyright 2010-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License").
55
* You may not use this file except in compliance with the License.

aws-android-sdk-translate/src/main/java/com/amazonaws/services/translate/model/CreateParallelDataResult.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
* Copyright 2010-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License").
55
* You may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)