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 NoSuchEntityException. May throw LimitExceededException. 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 {
  ArgumentError.checkNotNull(policyName, 'policyName');
  _s.validateStringLength(
    'policyName',
    policyName,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(userName, 'userName');
  _s.validateStringLength(
    'userName',
    userName,
    1,
    128,
    isRequired: true,
  );
  final $request = <String, dynamic>{};
  $request['PolicyName'] = policyName;
  $request['UserName'] = userName;
  await _protocol.send(
    $request,
    action: 'DeleteUserPolicy',
    version: '2010-05-08',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['DeleteUserPolicyRequest'],
    shapes: shapes,
  );
}