createBatchSegmentJob method

Future<CreateBatchSegmentJobResponse> createBatchSegmentJob({
  1. required BatchSegmentJobInput jobInput,
  2. required String jobName,
  3. required BatchSegmentJobOutput jobOutput,
  4. required String roleArn,
  5. required String solutionVersionArn,
  6. String? filterArn,
  7. int? numResults,
  8. List<Tag>? tags,
})

Creates a batch segment job. The operation can handle up to 50 million records and the input file must be in JSON format. For more information, see Getting batch recommendations and user segments.

May throw InvalidInputException. May throw LimitExceededException. May throw ResourceAlreadyExistsException. May throw ResourceInUseException. May throw ResourceNotFoundException. May throw TooManyTagsException.

Parameter jobInput : The Amazon S3 path for the input data used to generate the batch segment job.

Parameter jobName : The name of the batch segment job to create.

Parameter jobOutput : The Amazon S3 path for the bucket where the job's output will be stored.

Parameter roleArn : The ARN of the Amazon Identity and Access Management role that has permissions to read and write to your input and output Amazon S3 buckets respectively.

Parameter solutionVersionArn : The Amazon Resource Name (ARN) of the solution version you want the batch segment job to use to generate batch segments.

Parameter filterArn : The ARN of the filter to apply to the batch segment job. For more information on using filters, see Filtering batch recommendations.

Parameter numResults : The number of predicted users generated by the batch segment job for each line of input data. The maximum number of users per segment is 5 million.

Parameter tags : A list of tags to apply to the batch segment job.

Implementation

Future<CreateBatchSegmentJobResponse> createBatchSegmentJob({
  required BatchSegmentJobInput jobInput,
  required String jobName,
  required BatchSegmentJobOutput jobOutput,
  required String roleArn,
  required String solutionVersionArn,
  String? filterArn,
  int? numResults,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonPersonalize.CreateBatchSegmentJob'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'jobInput': jobInput,
      'jobName': jobName,
      'jobOutput': jobOutput,
      'roleArn': roleArn,
      'solutionVersionArn': solutionVersionArn,
      if (filterArn != null) 'filterArn': filterArn,
      if (numResults != null) 'numResults': numResults,
      if (tags != null) 'tags': tags,
    },
  );

  return CreateBatchSegmentJobResponse.fromJson(jsonResponse.body);
}