assumeImpersonationRole method

Future<AssumeImpersonationRoleResponse> assumeImpersonationRole({
  1. required String impersonationRoleId,
  2. required String organizationId,
})

Assumes an impersonation role for the given WorkMail organization. This method returns an authentication token you can use to make impersonated calls.

May throw InvalidParameterException. May throw OrganizationNotFoundException. May throw OrganizationStateException. May throw ResourceNotFoundException.

Parameter impersonationRoleId : The impersonation role ID to assume.

Parameter organizationId : The WorkMail organization under which the impersonation role will be assumed.

Implementation

Future<AssumeImpersonationRoleResponse> assumeImpersonationRole({
  required String impersonationRoleId,
  required String organizationId,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'WorkMailService.AssumeImpersonationRole'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ImpersonationRoleId': impersonationRoleId,
      'OrganizationId': organizationId,
    },
  );

  return AssumeImpersonationRoleResponse.fromJson(jsonResponse.body);
}