inviteMembers method

Future<InviteMembersResponse> inviteMembers({
  1. required List<String> accountIds,
  2. required String detectorId,
  3. bool? disableEmailNotification,
  4. String? message,
})

Invites other AWS accounts (created as members of the current AWS account by CreateMembers) to enable GuardDuty, and allow the current AWS account to view and manage these accounts' findings on their behalf as the GuardDuty administrator account.

May throw BadRequestException. May throw InternalServerErrorException.

Parameter accountIds : A list of account IDs of the accounts that you want to invite to GuardDuty as members.

Parameter detectorId : The unique ID of the detector of the GuardDuty account that you want to invite members with.

Parameter disableEmailNotification : A Boolean value that specifies whether you want to disable email notification to the accounts that you are inviting to GuardDuty as members.

Parameter message : The invitation message that you want to send to the accounts that you're inviting to GuardDuty as members.

Implementation

Future<InviteMembersResponse> inviteMembers({
  required List<String> accountIds,
  required String detectorId,
  bool? disableEmailNotification,
  String? message,
}) async {
  ArgumentError.checkNotNull(accountIds, 'accountIds');
  ArgumentError.checkNotNull(detectorId, 'detectorId');
  _s.validateStringLength(
    'detectorId',
    detectorId,
    1,
    300,
    isRequired: true,
  );
  final $payload = <String, dynamic>{
    'accountIds': accountIds,
    if (disableEmailNotification != null)
      'disableEmailNotification': disableEmailNotification,
    if (message != null) 'message': message,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/detector/${Uri.encodeComponent(detectorId)}/member/invite',
    exceptionFnMap: _exceptionFns,
  );
  return InviteMembersResponse.fromJson(response);
}