importModelVersion method

Future<ImportModelVersionResponse> importModelVersion({
  1. required String datasetName,
  2. required String sourceModelVersionArn,
  3. String? clientToken,
  4. InferenceDataImportStrategy? inferenceDataImportStrategy,
  5. LabelsInputConfiguration? labelsInputConfiguration,
  6. String? modelName,
  7. String? roleArn,
  8. String? serverSideKmsKeyId,
  9. List<Tag>? tags,
})

Imports a model that has been trained successfully.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter datasetName : The name of the dataset for the machine learning model being imported.

Parameter sourceModelVersionArn : The Amazon Resource Name (ARN) of the model version to import.

Parameter clientToken : A unique identifier for the request. If you do not set the client request token, Amazon Lookout for Equipment generates one.

Parameter inferenceDataImportStrategy : Indicates how to import the accumulated inference data when a model version is imported. The possible values are as follows:

  • NO_IMPORT – Don't import the data.
  • ADD_WHEN_EMPTY – Only import the data from the source model if there is no existing data in the target model.
  • OVERWRITE – Import the data from the source model and overwrite the existing data in the target model.

Parameter modelName : The name for the machine learning model to be created. If the model already exists, Amazon Lookout for Equipment creates a new version. If you do not specify this field, it is filled with the name of the source model.

Parameter roleArn : The Amazon Resource Name (ARN) of a role with permission to access the data source being used to create the machine learning model.

Parameter serverSideKmsKeyId : Provides the identifier of the KMS key key used to encrypt model data by Amazon Lookout for Equipment.

Parameter tags : The tags associated with the machine learning model to be created.

Implementation

Future<ImportModelVersionResponse> importModelVersion({
  required String datasetName,
  required String sourceModelVersionArn,
  String? clientToken,
  InferenceDataImportStrategy? inferenceDataImportStrategy,
  LabelsInputConfiguration? labelsInputConfiguration,
  String? modelName,
  String? roleArn,
  String? serverSideKmsKeyId,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AWSLookoutEquipmentFrontendService.ImportModelVersion'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DatasetName': datasetName,
      'SourceModelVersionArn': sourceModelVersionArn,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (inferenceDataImportStrategy != null)
        'InferenceDataImportStrategy': inferenceDataImportStrategy.value,
      if (labelsInputConfiguration != null)
        'LabelsInputConfiguration': labelsInputConfiguration,
      if (modelName != null) 'ModelName': modelName,
      if (roleArn != null) 'RoleArn': roleArn,
      if (serverSideKmsKeyId != null)
        'ServerSideKmsKeyId': serverSideKmsKeyId,
      if (tags != null) 'Tags': tags,
    },
  );

  return ImportModelVersionResponse.fromJson(jsonResponse.body);
}