createParallelData method
- required String name,
- required ParallelDataConfig parallelDataConfig,
- String? clientToken,
- String? description,
- EncryptionKey? encryptionKey,
Creates a parallel data resource in Amazon Translate by importing an input file from Amazon S3. Parallel data files contain examples of source phrases and their translations from your translation memory. By adding parallel data, you can influence the style, tone, and word choice in your translation output.
May throw InvalidParameterValueException. May throw InvalidRequestException. May throw LimitExceededException. May throw TooManyRequestsException. May throw ConflictException. May throw InternalServerException.
Parameter name
:
A custom name for the parallel data resource in Amazon Translate. You must
assign a name that is unique in the account and region.
Parameter parallelDataConfig
:
Specifies the format and S3 location of the parallel data input file.
Parameter clientToken
:
A unique identifier for the request. This token is automatically generated
when you use Amazon Translate through an AWS SDK.
Parameter description
:
A custom description for the parallel data resource in Amazon Translate.
Implementation
Future<CreateParallelDataResponse> createParallelData({
required String name,
required ParallelDataConfig parallelDataConfig,
String? clientToken,
String? description,
EncryptionKey? encryptionKey,
}) async {
ArgumentError.checkNotNull(name, 'name');
_s.validateStringLength(
'name',
name,
1,
256,
isRequired: true,
);
ArgumentError.checkNotNull(parallelDataConfig, 'parallelDataConfig');
_s.validateStringLength(
'clientToken',
clientToken,
1,
64,
);
_s.validateStringLength(
'description',
description,
0,
256,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSShineFrontendService_20170701.CreateParallelData'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'Name': name,
'ParallelDataConfig': parallelDataConfig,
'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
if (description != null) 'Description': description,
if (encryptionKey != null) 'EncryptionKey': encryptionKey,
},
);
return CreateParallelDataResponse.fromJson(jsonResponse.body);
}