createUserImportJob method

Future<CreateUserImportJobResponse> createUserImportJob({
  1. required String cloudWatchLogsRoleArn,
  2. required String jobName,
  3. required String userPoolId,
  4. PasswordHashingAlgorithmType? passwordHashingAlgorithm,
})

Creates a user import job. You can import users into user pools from a comma-separated values (CSV) file without adding Amazon Cognito MAU costs to your Amazon Web Services bill.

Learn more

May throw InternalErrorException. May throw InvalidParameterException. May throw LimitExceededException. May throw NotAuthorizedException. May throw OperationNotEnabledException. May throw PreconditionNotMetException. May throw ResourceNotFoundException. May throw TooManyRequestsException.

Parameter cloudWatchLogsRoleArn : You must specify an IAM role that has permission to log import-job results to Amazon CloudWatch Logs. This parameter is the ARN of that role.

Parameter jobName : A friendly name for the user import job.

Parameter userPoolId : The ID of the user pool that you want to import users into.

Parameter passwordHashingAlgorithm : The password hashing algorithm used to generate the hashes in the CSV file for this import job.

Valid values: BCRYPT | SCRYPT | ARGON2ID | PBKDF2_SHA256

Implementation

Future<CreateUserImportJobResponse> createUserImportJob({
  required String cloudWatchLogsRoleArn,
  required String jobName,
  required String userPoolId,
  PasswordHashingAlgorithmType? passwordHashingAlgorithm,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSCognitoIdentityProviderService.CreateUserImportJob'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'CloudWatchLogsRoleArn': cloudWatchLogsRoleArn,
      'JobName': jobName,
      'UserPoolId': userPoolId,
      if (passwordHashingAlgorithm != null)
        'PasswordHashingAlgorithm': passwordHashingAlgorithm.value,
    },
  );

  return CreateUserImportJobResponse.fromJson(jsonResponse.body);
}