Skip to content

IAM  >  Operations  >  get_policy

get_policy

Operation

get_policy async

get_policy(input: GetPolicyInput, plugins: list[Plugin] | None = None) -> GetPolicyOutput

Retrieves information about the specified managed policy, including the policy's default version and the total number of IAM users, groups, and roles to which the policy is attached. To retrieve the list of the specific users, groups, and roles that the policy is attached to, use ListEntitiesForPolicy. This operation returns metadata about the policy. To retrieve the actual policy document for a specific version of the policy, use GetPolicyVersion.

This operation retrieves information about managed policies. To retrieve information about an inline policy that is embedded with an IAM user, group, or role, use GetUserPolicy, GetGroupPolicy, or GetRolePolicy.

For more information about policies, see Managed policies and inline policies in the IAM User Guide.

Parameters:

Name Type Description Default
input GetPolicyInput

An instance of GetPolicyInput.

required
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
GetPolicyOutput

An instance of GetPolicyOutput.

Input

GetPolicyInput dataclass

Bases: _SerdeShape

Dataclass for GetPolicyInput structure.

Attributes

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

The Amazon Resource Name (ARN) of the managed policy that you want information about.

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

Output

GetPolicyOutput dataclass

Bases: _SerdeShape

Contains the response to a successful GetPolicy request.

Attributes

policy class-attribute instance-attribute
policy: Policy | None = ...

A structure containing details about the policy.

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.