createUserImportJob method

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

Creates the user import job.

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

Parameter cloudWatchLogsRoleArn : The role ARN for the Amazon CloudWatch Logging role for the user import job.

Parameter jobName : The job name for the user import job.

Parameter userPoolId : The user pool ID for the user pool that the users are being imported into.

Implementation

Future<CreateUserImportJobResponse> createUserImportJob({
  required String cloudWatchLogsRoleArn,
  required String jobName,
  required String userPoolId,
}) async {
  ArgumentError.checkNotNull(cloudWatchLogsRoleArn, 'cloudWatchLogsRoleArn');
  _s.validateStringLength(
    'cloudWatchLogsRoleArn',
    cloudWatchLogsRoleArn,
    20,
    2048,
    isRequired: true,
  );
  ArgumentError.checkNotNull(jobName, 'jobName');
  _s.validateStringLength(
    'jobName',
    jobName,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(userPoolId, 'userPoolId');
  _s.validateStringLength(
    'userPoolId',
    userPoolId,
    1,
    55,
    isRequired: true,
  );
  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,
    },
  );

  return CreateUserImportJobResponse.fromJson(jsonResponse.body);
}