createAdapterVersion method
Creates a new version of an adapter. Operates on a provided AdapterId and a specified dataset provided via the DatasetConfig argument. Requires that you specify an Amazon S3 bucket with the OutputConfig argument. You can provide an optional KMSKeyId, an optional ClientRequestToken, and optional tags.
May throw AccessDeniedException.
May throw ConflictException.
May throw IdempotentParameterMismatchException.
May throw InternalServerError.
May throw InvalidKMSKeyException.
May throw InvalidParameterException.
May throw InvalidS3ObjectException.
May throw LimitExceededException.
May throw ProvisionedThroughputExceededException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter adapterId :
A string containing a unique ID for the adapter that will receive a new
version.
Parameter datasetConfig :
Specifies a dataset used to train a new adapter version. Takes a
ManifestS3Object as the value.
Parameter clientRequestToken :
Idempotent token is used to recognize the request. If the same token is
used with multiple CreateAdapterVersion requests, the same session is
returned. This token is employed to avoid unintentionally creating the
same session multiple times.
Parameter kMSKeyId :
The identifier for your AWS Key Management Service key (AWS KMS key). Used
to encrypt your documents.
Parameter tags :
A set of tags (key-value pairs) that you want to attach to the adapter
version.
Implementation
Future<CreateAdapterVersionResponse> createAdapterVersion({
required String adapterId,
required AdapterVersionDatasetConfig datasetConfig,
required OutputConfig outputConfig,
String? clientRequestToken,
String? kMSKeyId,
Map<String, String>? tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'Textract.CreateAdapterVersion'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'AdapterId': adapterId,
'DatasetConfig': datasetConfig,
'OutputConfig': outputConfig,
'ClientRequestToken':
clientRequestToken ?? _s.generateIdempotencyToken(),
if (kMSKeyId != null) 'KMSKeyId': kMSKeyId,
if (tags != null) 'Tags': tags,
},
);
return CreateAdapterVersionResponse.fromJson(jsonResponse.body);
}