Skip to content

Lambda  >  Operations  >  get_policy

get_policy

Operation

get_policy async

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

Returns the resource-based IAM policy for a function, version, or alias.

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

Dataclass for GetPolicyInput structure.

Attributes

function_name class-attribute instance-attribute
function_name: str | None = None

The name or ARN of the Lambda function, version, or alias.

Name formats

  • Function name -- my-function (name-only), my-function:v1 (with alias).

  • Function ARN -- arn:aws:lambda:us-west-2:123456789012:function:my-function.

  • Partial ARN -- 123456789012:function:my-function.

You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

qualifier class-attribute instance-attribute
qualifier: str | None = None

Specify a version or alias to get the policy for that resource.

Output

GetPolicyOutput dataclass

Dataclass for GetPolicyOutput structure.

Attributes

policy class-attribute instance-attribute
policy: str | None = None

The resource-based policy.

revision_id class-attribute instance-attribute
revision_id: str | None = None

A unique identifier for the current revision of the policy.