createSolutionVersion method

Future<CreateSolutionVersionResponse> createSolutionVersion({
  1. required String solutionArn,
  2. TrainingMode? trainingMode,
})

Trains or retrains an active solution. A solution is created using the CreateSolution operation and must be in the ACTIVE state before calling CreateSolutionVersion. A new version of the solution is created every time you call this operation.

Status

A solution version can be in one of the following states:

  • CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
To get the status of the version, call DescribeSolutionVersion. Wait until the status shows as ACTIVE before calling CreateCampaign.

If the status shows as CREATE FAILED, the response includes a failureReason key, which describes why the job failed.

Related APIs

May throw InvalidInputException. May throw ResourceNotFoundException. May throw LimitExceededException. May throw ResourceInUseException.

Parameter solutionArn : The Amazon Resource Name (ARN) of the solution containing the training configuration information.

Parameter trainingMode : The scope of training to be performed when creating the solution version. The FULL option trains the solution version based on the entirety of the input solution's training data, while the UPDATE option processes only the data that has changed in comparison to the input solution. Choose UPDATE when you want to incrementally update your solution version instead of creating an entirely new one.

Implementation

Future<CreateSolutionVersionResponse> createSolutionVersion({
  required String solutionArn,
  TrainingMode? trainingMode,
}) async {
  ArgumentError.checkNotNull(solutionArn, 'solutionArn');
  _s.validateStringLength(
    'solutionArn',
    solutionArn,
    0,
    256,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonPersonalize.CreateSolutionVersion'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'solutionArn': solutionArn,
      if (trainingMode != null) 'trainingMode': trainingMode.toValue(),
    },
  );

  return CreateSolutionVersionResponse.fromJson(jsonResponse.body);
}