createDatasetImportJob method
- required DataSource dataSource,
- required String datasetArn,
- required String jobName,
- required String roleArn,
Creates a job that imports training data from your data source (an Amazon S3 bucket) to an Amazon Personalize dataset. To allow Amazon Personalize to import the training data, you must specify an AWS Identity and Access Management (IAM) role that has permission to read from the data source, as Amazon Personalize makes a copy of your data and processes it in an internal AWS system. Status
A dataset import job can be in one of the following states:
- CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
failureReason
key, which describes why the job failed.
Related APIs
May throw InvalidInputException. May throw ResourceNotFoundException. May throw ResourceAlreadyExistsException. May throw LimitExceededException. May throw ResourceInUseException.
Parameter dataSource
:
The Amazon S3 bucket that contains the training data to import.
Parameter datasetArn
:
The ARN of the dataset that receives the imported data.
Parameter jobName
:
The name for the dataset import job.
Parameter roleArn
:
The ARN of the IAM role that has permissions to read from the Amazon S3
data source.
Implementation
Future<CreateDatasetImportJobResponse> createDatasetImportJob({
required DataSource dataSource,
required String datasetArn,
required String jobName,
required String roleArn,
}) async {
ArgumentError.checkNotNull(dataSource, 'dataSource');
ArgumentError.checkNotNull(datasetArn, 'datasetArn');
_s.validateStringLength(
'datasetArn',
datasetArn,
0,
256,
isRequired: true,
);
ArgumentError.checkNotNull(jobName, 'jobName');
_s.validateStringLength(
'jobName',
jobName,
1,
63,
isRequired: true,
);
ArgumentError.checkNotNull(roleArn, 'roleArn');
_s.validateStringLength(
'roleArn',
roleArn,
0,
256,
isRequired: true,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AmazonPersonalize.CreateDatasetImportJob'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'dataSource': dataSource,
'datasetArn': datasetArn,
'jobName': jobName,
'roleArn': roleArn,
},
);
return CreateDatasetImportJobResponse.fromJson(jsonResponse.body);
}