Skip to content

IAM  >  Operations  >  detach_role_policy

detach_role_policy

Operation

detach_role_policy async

detach_role_policy(request: DetachRolePolicyInput | DetachRolePolicyInputDict, /, *, plugins: list[Plugin] | None = None) -> DetachRolePolicyOutput
detach_role_policy(*, plugins: list[Plugin] | None = None, **kwargs: Unpack[DetachRolePolicyInputDict]) -> DetachRolePolicyOutput

Removes the specified managed policy from the specified role.

A role can also have inline policies embedded with it. To delete an inline policy, use DeleteRolePolicy. 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
DetachRolePolicyOutput

An instance of DetachRolePolicyOutput.

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

DetachRolePolicyInput dataclass

Bases: _SerdeShape

Dataclass for DetachRolePolicyInput 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.

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

The name (friendly name, not ARN) of the IAM role 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

DetachRolePolicyInputDict

Bases: TypedDict

Dictionary form of DetachRolePolicyInput.

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.

role_name instance-attribute
role_name: Required[str]

The name (friendly name, not ARN) of the IAM role 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

DetachRolePolicyOutput dataclass

Bases: _SerdeShape

Dataclass for DetachRolePolicyOutput 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.