createUser method

Future<CreateUserResponse> createUser({
  1. required String identityStoreId,
  2. List<Address>? addresses,
  3. String? birthdate,
  4. String? displayName,
  5. List<Email>? emails,
  6. Map<String, Object>? extensions,
  7. String? locale,
  8. Name? name,
  9. String? nickName,
  10. List<PhoneNumber>? phoneNumbers,
  11. List<Photo>? photos,
  12. String? preferredLanguage,
  13. String? profileUrl,
  14. List<Role>? roles,
  15. String? timezone,
  16. String? title,
  17. String? userName,
  18. String? userType,
  19. String? website,
})

Creates a user within the specified identity store.

May throw ConflictException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ValidationException.

Parameter identityStoreId : The globally unique identifier for the identity store.

Parameter addresses : A list of Address objects containing addresses associated with the user.

Parameter birthdate : The user's birthdate in YYYY-MM-DD format. This field supports standard date format for storing personal information.

Parameter displayName : A string containing the name of the user. This value is typically formatted for display when the user is referenced. For example, "John Doe." When used in IAM Identity Center, this parameter is required.

Parameter emails : A list of Email objects containing email addresses associated with the user.

Parameter extensions : A map with additional attribute extensions for the user. Each map key corresponds to an extension name, while map values represent extension data in Document type (not supported by Java V1, Go V1 and older versions of the CLI). aws:identitystore:enterprise is the only supported extension name.

Parameter locale : A string containing the geographical region or location of the user.

Parameter name : An object containing the name of the user. When used in IAM Identity Center, this parameter is required.

Parameter nickName : A string containing an alternate name for the user.

Parameter phoneNumbers : A list of PhoneNumber objects containing phone numbers associated with the user.

Parameter photos : A list of photos associated with the user. You can add up to 3 photos per user. Each photo can include a value, type, display name, and primary designation.

Parameter preferredLanguage : A string containing the preferred language of the user. For example, "American English" or "en-us."

Parameter profileUrl : A string containing a URL that might be associated with the user.

Parameter roles : A list of Role objects containing roles associated with the user.

Parameter timezone : A string containing the time zone of the user.

Parameter title : A string containing the title of the user. Possible values are left unspecified. The value can vary based on your specific use case.

Parameter userName : A unique string used to identify the user. The length limit is 128 characters. This value can consist of letters, accented characters, symbols, numbers, and punctuation. This value is specified at the time the user is created and stored as an attribute of the user object in the identity store. Administrator and AWSAdministrators are reserved names and can't be used for users or groups.

Parameter userType : A string indicating the type of user. Possible values are left unspecified. The value can vary based on your specific use case.

Parameter website : The user's personal website or blog URL. This field allows users to provide a link to their personal or professional website.

Implementation

Future<CreateUserResponse> createUser({
  required String identityStoreId,
  List<Address>? addresses,
  String? birthdate,
  String? displayName,
  List<Email>? emails,
  Map<String, Object>? extensions,
  String? locale,
  Name? name,
  String? nickName,
  List<PhoneNumber>? phoneNumbers,
  List<Photo>? photos,
  String? preferredLanguage,
  String? profileUrl,
  List<Role>? roles,
  String? timezone,
  String? title,
  String? userName,
  String? userType,
  String? website,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSIdentityStore.CreateUser'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'IdentityStoreId': identityStoreId,
      if (addresses != null) 'Addresses': addresses,
      if (birthdate != null) 'Birthdate': birthdate,
      if (displayName != null) 'DisplayName': displayName,
      if (emails != null) 'Emails': emails,
      if (extensions != null) 'Extensions': extensions,
      if (locale != null) 'Locale': locale,
      if (name != null) 'Name': name,
      if (nickName != null) 'NickName': nickName,
      if (phoneNumbers != null) 'PhoneNumbers': phoneNumbers,
      if (photos != null) 'Photos': photos,
      if (preferredLanguage != null) 'PreferredLanguage': preferredLanguage,
      if (profileUrl != null) 'ProfileUrl': profileUrl,
      if (roles != null) 'Roles': roles,
      if (timezone != null) 'Timezone': timezone,
      if (title != null) 'Title': title,
      if (userName != null) 'UserName': userName,
      if (userType != null) 'UserType': userType,
      if (website != null) 'Website': website,
    },
  );

  return CreateUserResponse.fromJson(jsonResponse.body);
}