createDatasetExportJob method

Future<CreateDatasetExportJobResponse> createDatasetExportJob({
  1. required String datasetArn,
  2. required String jobName,
  3. required DatasetExportJobOutput jobOutput,
  4. required String roleArn,
  5. IngestionMode? ingestionMode,
  6. List<Tag>? tags,
})

Creates a job that exports data from your dataset to an Amazon S3 bucket. To allow Amazon Personalize to export the training data, you must specify an service-linked IAM role that gives Amazon Personalize PutObject permissions for your Amazon S3 bucket. For information, see Exporting a dataset in the Amazon Personalize developer guide.

Status

A dataset export job can be in one of the following states:

  • CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
To get the status of the export job, call DescribeDatasetExportJob, and specify the Amazon Resource Name (ARN) of the dataset export job. The dataset export is complete when the status shows as ACTIVE. If the status shows as CREATE FAILED, the response includes a failureReason key, which describes why the job failed.

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

Parameter datasetArn : The Amazon Resource Name (ARN) of the dataset that contains the data to export.

Parameter jobName : The name for the dataset export job.

Parameter jobOutput : The path to the Amazon S3 bucket where the job's output is stored.

Parameter roleArn : The Amazon Resource Name (ARN) of the IAM service role that has permissions to add data to your output Amazon S3 bucket.

Parameter ingestionMode : The data to export, based on how you imported the data. You can choose to export only BULK data that you imported using a dataset import job, only PUT data that you imported incrementally (using the console, PutEvents, PutUsers and PutItems operations), or ALL for both types. The default value is PUT.

Parameter tags : A list of tags to apply to the dataset export job.

Implementation

Future<CreateDatasetExportJobResponse> createDatasetExportJob({
  required String datasetArn,
  required String jobName,
  required DatasetExportJobOutput jobOutput,
  required String roleArn,
  IngestionMode? ingestionMode,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonPersonalize.CreateDatasetExportJob'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'datasetArn': datasetArn,
      'jobName': jobName,
      'jobOutput': jobOutput,
      'roleArn': roleArn,
      if (ingestionMode != null) 'ingestionMode': ingestionMode.value,
      if (tags != null) 'tags': tags,
    },
  );

  return CreateDatasetExportJobResponse.fromJson(jsonResponse.body);
}