deleteRole method
Deletes the specified role. Unlike the Amazon Web Services Management Console, when you delete a role programmatically, you must delete the items attached to the role manually, or the deletion fails. For more information, see Deleting an IAM role. Before attempting to delete a role, remove the following attached items:
- Inline policies (DeleteRolePolicy)
- Attached managed policies (DetachRolePolicy)
- Instance profile (RemoveRoleFromInstanceProfile)
- Optional – Delete instance profile after detaching from role for resource clean up (DeleteInstanceProfile)
May throw ConcurrentModificationException.
May throw DeleteConflictException.
May throw LimitExceededException.
May throw NoSuchEntityException.
May throw ServiceFailureException.
May throw UnmodifiableEntityException.
Parameter roleName :
The name of the role to delete.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Implementation
Future<void> deleteRole({
required String roleName,
}) async {
final $request = <String, String>{
'RoleName': roleName,
};
await _protocol.send(
$request,
action: 'DeleteRole',
version: '2010-05-08',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
);
}