createUserProfile method

Future<CreateUserProfileResult> createUserProfile({
  1. required String displayName,
  2. required String emailAddress,
  3. required String userArn,
  4. String? sshPublicKey,
})

Creates a profile for a user that includes user preferences, such as the display name and email address assocciated with the user, in AWS CodeStar. The user profile is not project-specific. Information in the user profile is displayed wherever the user's information appears to other users in AWS CodeStar.

May throw UserProfileAlreadyExistsException. May throw ValidationException.

Parameter displayName : The name that will be displayed as the friendly name for the user in AWS CodeStar.

Parameter emailAddress : The email address that will be displayed as part of the user's profile in AWS CodeStar.

Parameter userArn : The Amazon Resource Name (ARN) of the user in IAM.

Parameter sshPublicKey : The SSH public key associated with the user in AWS CodeStar. If a project owner allows the user remote access to project resources, this public key will be used along with the user's private key for SSH access.

Implementation

Future<CreateUserProfileResult> createUserProfile({
  required String displayName,
  required String emailAddress,
  required String userArn,
  String? sshPublicKey,
}) async {
  ArgumentError.checkNotNull(displayName, 'displayName');
  _s.validateStringLength(
    'displayName',
    displayName,
    1,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(emailAddress, 'emailAddress');
  _s.validateStringLength(
    'emailAddress',
    emailAddress,
    3,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(userArn, 'userArn');
  _s.validateStringLength(
    'userArn',
    userArn,
    32,
    95,
    isRequired: true,
  );
  _s.validateStringLength(
    'sshPublicKey',
    sshPublicKey,
    0,
    16384,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CodeStar_20170419.CreateUserProfile'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'displayName': displayName,
      'emailAddress': emailAddress,
      'userArn': userArn,
      if (sshPublicKey != null) 'sshPublicKey': sshPublicKey,
    },
  );

  return CreateUserProfileResult.fromJson(jsonResponse.body);
}