createMembers method

Future<CreateMembersResponse> createMembers({
  1. required List<AccountDetail> accountDetails,
  2. required String detectorId,
})

Creates member accounts of the current AWS account by specifying a list of AWS account IDs. This step is a prerequisite for managing the associated member accounts either by invitation or through an organization.

When using Create Members as an organizations delegated administrator this action will enable GuardDuty in the added member accounts, with the exception of the organization delegated administrator account, which must enable GuardDuty prior to being added as a member.

If you are adding accounts by invitation use this action after GuardDuty has been enabled in potential member accounts and before using Invite Members .

May throw BadRequestException. May throw InternalServerErrorException.

Parameter accountDetails : A list of account ID and email address pairs of the accounts that you want to associate with the GuardDuty administrator account.

Parameter detectorId : The unique ID of the detector of the GuardDuty account that you want to associate member accounts with.

Implementation

Future<CreateMembersResponse> createMembers({
  required List<AccountDetail> accountDetails,
  required String detectorId,
}) async {
  ArgumentError.checkNotNull(accountDetails, 'accountDetails');
  ArgumentError.checkNotNull(detectorId, 'detectorId');
  _s.validateStringLength(
    'detectorId',
    detectorId,
    1,
    300,
    isRequired: true,
  );
  final $payload = <String, dynamic>{
    'accountDetails': accountDetails,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/detector/${Uri.encodeComponent(detectorId)}/member',
    exceptionFnMap: _exceptionFns,
  );
  return CreateMembersResponse.fromJson(response);
}