createUser method

Future<CreateUserResponse> createUser({
  1. required String emailAddress,
  2. required UserType type,
  3. ApiAccess? apiAccess,
  4. String? apiAccessPrincipalArn,
  5. String? clientToken,
  6. String? firstName,
  7. String? lastName,
})

Creates a new user in FinSpace.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw LimitExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter emailAddress : The email address of the user that you want to register. The email address serves as a uniquer identifier for each user and cannot be changed after it's created.

Parameter type : The option to indicate the type of user. Use one of the following options to specify this parameter:

  • SUPER_USER – A user with permission to all the functionality and data in FinSpace.
  • APP_USER – A user with specific permissions in FinSpace. The users are assigned permissions by adding them to a permission group.

Parameter apiAccess : The option to indicate whether the user can use the GetProgrammaticAccessCredentials API to obtain credentials that can then be used to access other FinSpace Data API operations.

  • ENABLED – The user has permissions to use the APIs.
  • DISABLED – The user does not have permissions to use any APIs.

Parameter apiAccessPrincipalArn : The ARN identifier of an AWS user or role that is allowed to call the GetProgrammaticAccessCredentials API to obtain a credentials token for a specific FinSpace user. This must be an IAM role within your FinSpace account.

Parameter clientToken : A token that ensures idempotency. This token expires in 10 minutes.

Parameter firstName : The first name of the user that you want to register.

Parameter lastName : The last name of the user that you want to register.

Implementation

Future<CreateUserResponse> createUser({
  required String emailAddress,
  required UserType type,
  ApiAccess? apiAccess,
  String? apiAccessPrincipalArn,
  String? clientToken,
  String? firstName,
  String? lastName,
}) async {
  final $payload = <String, dynamic>{
    'emailAddress': emailAddress,
    'type': type.value,
    if (apiAccess != null) 'apiAccess': apiAccess.value,
    if (apiAccessPrincipalArn != null)
      'apiAccessPrincipalArn': apiAccessPrincipalArn,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (firstName != null) 'firstName': firstName,
    if (lastName != null) 'lastName': lastName,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/user',
    exceptionFnMap: _exceptionFns,
  );
  return CreateUserResponse.fromJson(response);
}