updatePrimaryEmailAddress method

Future<void> updatePrimaryEmailAddress({
  1. required String email,
  2. required String entityId,
  3. required String organizationId,
})

Updates the primary email for a user, group, or resource. The current email is moved into the list of aliases (or swapped between an existing alias and the current primary email), and the email provided in the input is promoted as the primary.

May throw DirectoryServiceAuthenticationFailedException. May throw DirectoryUnavailableException. May throw EmailAddressInUseException. May throw EntityNotFoundException. May throw EntityStateException. May throw InvalidParameterException. May throw MailDomainNotFoundException. May throw MailDomainStateException. May throw InvalidParameterException. May throw OrganizationNotFoundException. May throw OrganizationStateException. May throw UnsupportedOperationException.

Parameter email : The value of the email to be updated as primary.

Parameter entityId : The user, group, or resource to update.

Parameter organizationId : The organization that contains the user, group, or resource to update.

Implementation

Future<void> updatePrimaryEmailAddress({
  required String email,
  required String entityId,
  required String organizationId,
}) async {
  ArgumentError.checkNotNull(email, 'email');
  _s.validateStringLength(
    'email',
    email,
    1,
    254,
    isRequired: true,
  );
  ArgumentError.checkNotNull(entityId, 'entityId');
  _s.validateStringLength(
    'entityId',
    entityId,
    12,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(organizationId, 'organizationId');
  _s.validateStringLength(
    'organizationId',
    organizationId,
    34,
    34,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'WorkMailService.UpdatePrimaryEmailAddress'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Email': email,
      'EntityId': entityId,
      'OrganizationId': organizationId,
    },
  );
}