createModelVersion method

Future<CreateModelVersionResult> createModelVersion({
  1. required String modelId,
  2. required ModelTypeEnum modelType,
  3. required TrainingDataSchema trainingDataSchema,
  4. required TrainingDataSourceEnum trainingDataSource,
  5. ExternalEventsDetail? externalEventsDetail,
  6. List<Tag>? tags,
})

Creates a version of the model using the specified model type and model id.

May throw ValidationException. May throw ResourceNotFoundException. May throw AccessDeniedException. May throw InternalServerException.

Parameter modelId : The model ID.

Parameter modelType : The model type.

Parameter trainingDataSchema : The training data schema.

Parameter trainingDataSource : The training data source location in Amazon S3.

Parameter externalEventsDetail : Details for the external events data used for model version training. Required if trainingDataSource is EXTERNAL_EVENTS.

Parameter tags : A collection of key and value pairs.

Implementation

Future<CreateModelVersionResult> createModelVersion({
  required String modelId,
  required ModelTypeEnum modelType,
  required TrainingDataSchema trainingDataSchema,
  required TrainingDataSourceEnum trainingDataSource,
  ExternalEventsDetail? externalEventsDetail,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(modelId, 'modelId');
  _s.validateStringLength(
    'modelId',
    modelId,
    1,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(modelType, 'modelType');
  ArgumentError.checkNotNull(trainingDataSchema, 'trainingDataSchema');
  ArgumentError.checkNotNull(trainingDataSource, 'trainingDataSource');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSHawksNestServiceFacade.CreateModelVersion'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'modelId': modelId,
      'modelType': modelType.toValue(),
      'trainingDataSchema': trainingDataSchema,
      'trainingDataSource': trainingDataSource.toValue(),
      if (externalEventsDetail != null)
        'externalEventsDetail': externalEventsDetail,
      if (tags != null) 'tags': tags,
    },
  );

  return CreateModelVersionResult.fromJson(jsonResponse.body);
}