Skip to content

IAM  >  Operations  >  detach_user_policy

detach_user_policy

Operation

detach_user_policy async

detach_user_policy(request: DetachUserPolicyInput | DetachUserPolicyInputDict, /, *, plugins: list[Plugin] | None = None) -> DetachUserPolicyOutput
detach_user_policy(*, plugins: list[Plugin] | None = None, **kwargs: Unpack[DetachUserPolicyInputDict]) -> DetachUserPolicyOutput

Removes the specified managed policy from the specified user.

A user can also have inline policies embedded with it. To delete an inline policy, use DeleteUserPolicy. For information about policies, see Managed policies and inline policies in the IAM User Guide.

Parameters:

Name Type Description Default
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
DetachUserPolicyOutput

An instance of DetachUserPolicyOutput.

Input

Pass the input fields as keyword arguments, or pass a model or dictionary as the first positional argument. Pass plugins separately as a keyword argument.

Model

DetachUserPolicyInput dataclass

Bases: _SerdeShape

Dataclass for DetachUserPolicyInput structure.

Attributes
policy_arn class-attribute instance-attribute
policy_arn: str | None = ...

The Amazon Resource Name (ARN) of the IAM policy you want to detach.

For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.

user_name class-attribute instance-attribute
user_name: str | None = ...

The name (friendly name, not ARN) of the IAM user to detach the policy from.

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: _+=,.@-

Dictionaries

DetachUserPolicyInputDict

Bases: TypedDict

Dictionary form of DetachUserPolicyInput.

Attributes
policy_arn instance-attribute
policy_arn: Required[str]

The Amazon Resource Name (ARN) of the IAM policy you want to detach.

For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.

user_name instance-attribute
user_name: Required[str]

The name (friendly name, not ARN) of the IAM user to detach the policy from.

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: _+=,.@-

Output

DetachUserPolicyOutput dataclass

Bases: _SerdeShape

Dataclass for DetachUserPolicyOutput structure.

Attributes

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.