importTerminology method

Future<ImportTerminologyResponse> importTerminology({
  1. required MergeStrategy mergeStrategy,
  2. required String name,
  3. required TerminologyData terminologyData,
  4. String? description,
  5. EncryptionKey? encryptionKey,
})

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.

May throw InvalidParameterValueException. May throw LimitExceededException. May throw TooManyRequestsException. May throw InternalServerException.

Parameter mergeStrategy : The merge strategy of the custom terminology being imported. Currently, only the OVERWRITE merge strategy is supported. In this case, the imported terminology will overwrite an existing terminology of the same name.

Parameter name : The name of the custom terminology being imported.

Parameter terminologyData : The terminology data for the custom terminology being imported.

Parameter description : The description of the custom terminology being imported.

Parameter encryptionKey : The encryption key for the custom terminology being imported.

Implementation

Future<ImportTerminologyResponse> importTerminology({
  required MergeStrategy mergeStrategy,
  required String name,
  required TerminologyData terminologyData,
  String? description,
  EncryptionKey? encryptionKey,
}) async {
  ArgumentError.checkNotNull(mergeStrategy, 'mergeStrategy');
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(terminologyData, 'terminologyData');
  _s.validateStringLength(
    'description',
    description,
    0,
    256,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSShineFrontendService_20170701.ImportTerminology'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'MergeStrategy': mergeStrategy.toValue(),
      'Name': name,
      'TerminologyData': terminologyData,
      if (description != null) 'Description': description,
      if (encryptionKey != null) 'EncryptionKey': encryptionKey,
    },
  );

  return ImportTerminologyResponse.fromJson(jsonResponse.body);
}