deleteUserPolicy method

Future<void> deleteUserPolicy({
  1. required String policyName,
  2. required String userName,
})

Deletes the specified inline policy that is embedded in the specified IAM user.

A user can also have managed policies attached to it. To detach a managed policy from a user, use DetachUserPolicy. For more information about policies, refer to Managed policies and inline policies in the IAM User Guide.

May throw LimitExceededException. May throw NoSuchEntityException. May throw ServiceFailureException.

Parameter policyName : The name identifying the policy document 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: _+=,.@-

Parameter userName : The name (friendly name, not ARN) identifying the user that the policy is embedded in.

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> deleteUserPolicy({
  required String policyName,
  required String userName,
}) async {
  final $request = <String, String>{
    'PolicyName': policyName,
    'UserName': userName,
  };
  await _protocol.send(
    $request,
    action: 'DeleteUserPolicy',
    version: '2010-05-08',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
  );
}