createDataDeletionJob method
Creates a batch job that deletes all references to specific users from an Amazon Personalize dataset group in batches. You specify the users to delete in a CSV file of userIds in an Amazon S3 bucket. After a job completes, Amazon Personalize no longer trains on the users’ data and no longer considers the users when generating user segments. For more information about creating a data deletion job, see Deleting users.
- Your input file must be a CSV file with a single USER_ID column that lists the users IDs. For more information about preparing the CSV file, see Preparing your data deletion file and uploading it to Amazon S3.
-
To give Amazon Personalize permission to access your input CSV file of
userIds, you must specify an IAM service role that has permission to read
from the data source. This role needs
GetObjectandListBucketpermissions for the bucket and its content. These permissions are the same as importing data. For information on granting access to your Amazon S3 bucket, see Giving Amazon Personalize Access to Amazon S3 Resources.
Status
A data deletion job can have one of the following statuses:
- PENDING > IN_PROGRESS > COMPLETED -or- FAILED
failureReason
key, which describes why the job failed.
Related APIs
May throw InvalidInputException.
May throw LimitExceededException.
May throw ResourceAlreadyExistsException.
May throw ResourceInUseException.
May throw ResourceNotFoundException.
May throw TooManyTagsException.
Parameter dataSource :
The Amazon S3 bucket that contains the list of userIds of the users to
delete.
Parameter datasetGroupArn :
The Amazon Resource Name (ARN) of the dataset group that has the datasets
you want to delete records from.
Parameter jobName :
The name for the data deletion job.
Parameter roleArn :
The Amazon Resource Name (ARN) of the IAM role that has permissions to
read from the Amazon S3 data source.
Parameter tags :
A list of tags
to apply to the data deletion job.
Implementation
Future<CreateDataDeletionJobResponse> createDataDeletionJob({
required DataSource dataSource,
required String datasetGroupArn,
required String jobName,
required String roleArn,
List<Tag>? tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AmazonPersonalize.CreateDataDeletionJob'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'dataSource': dataSource,
'datasetGroupArn': datasetGroupArn,
'jobName': jobName,
'roleArn': roleArn,
if (tags != null) 'tags': tags,
},
);
return CreateDataDeletionJobResponse.fromJson(jsonResponse.body);
}