IResourcePolicyFactory

class aws_cdk.aws_iam.IResourcePolicyFactory(*args, **kwargs)

Bases: Protocol

Factory interface for creating IResourceWithPolicyV2 instances from constructs.

Implementations of this interface are registered in the DefaultPolicyFactories registry and enable automatic resource policy support for CloudFormation resources. When a grant operation is performed, the factory converts L1 constructs into resources that support resource-based policies.

Factories are typically registered during static initialization and associated with specific CloudFormation resource types (e.g., ‘AWS::DynamoDB::Table’). The CDK’s grant system uses these factories to determine whether a resource supports resource policies and to create the appropriate wrapper when needed.

Methods

for_resource(resource)

Create an IResourceWithPolicyV2 from a construct.

Parameters:

resource (CfnResource) – the construct to be wrapped as an IResourceWithPolicyV2.

Return type:

IResourceWithPolicyV2