associateTeamMember method

Future<AssociateTeamMemberResult> associateTeamMember({
  1. required String projectId,
  2. required String projectRole,
  3. required String userArn,
  4. String? clientRequestToken,
  5. bool? remoteAccessAllowed,
})

Adds an IAM user to the team for an AWS CodeStar project.

May throw LimitExceededException. May throw ProjectNotFoundException. May throw TeamMemberAlreadyAssociatedException. May throw ValidationException. May throw InvalidServiceRoleException. May throw ProjectConfigurationException. May throw ConcurrentModificationException.

Parameter projectId : The ID of the project to which you will add the IAM user.

Parameter projectRole : The AWS CodeStar project role that will apply to this user. This role determines what actions a user can take in an AWS CodeStar project.

Parameter userArn : The Amazon Resource Name (ARN) for the IAM user you want to add to the AWS CodeStar project.

Parameter clientRequestToken : A user- or system-generated token that identifies the entity that requested the team member association to the project. This token can be used to repeat the request.

Parameter remoteAccessAllowed : Whether the team member is allowed to use an SSH public/private key pair to remotely access project resources, for example Amazon EC2 instances.

Implementation

Future<AssociateTeamMemberResult> associateTeamMember({
  required String projectId,
  required String projectRole,
  required String userArn,
  String? clientRequestToken,
  bool? remoteAccessAllowed,
}) async {
  ArgumentError.checkNotNull(projectId, 'projectId');
  _s.validateStringLength(
    'projectId',
    projectId,
    2,
    15,
    isRequired: true,
  );
  ArgumentError.checkNotNull(projectRole, 'projectRole');
  ArgumentError.checkNotNull(userArn, 'userArn');
  _s.validateStringLength(
    'userArn',
    userArn,
    32,
    95,
    isRequired: true,
  );
  _s.validateStringLength(
    'clientRequestToken',
    clientRequestToken,
    1,
    256,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CodeStar_20170419.AssociateTeamMember'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'projectId': projectId,
      'projectRole': projectRole,
      'userArn': userArn,
      if (clientRequestToken != null)
        'clientRequestToken': clientRequestToken,
      if (remoteAccessAllowed != null)
        'remoteAccessAllowed': remoteAccessAllowed,
    },
  );

  return AssociateTeamMemberResult.fromJson(jsonResponse.body);
}