Skip to content
v2.273.0

IResourcePolicyFactory Interface ​

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 ​

forResource(resource: CfnResource): IResourceWithPolicyV2def for_resource(self, resource: CfnResource) -> IResourceWithPolicyV2public IResourceWithPolicyV2 forResource(CfnResource resource)public IResourceWithPolicyV2 ForResource(CfnResource resource)func ForResource(Resource CfnResource) IResourceWithPolicyV2#
Create an IResourceWithPolicyV2 from a construct.
1 parameter

Parameters

  • resourceresourceresourceresourceResource — the construct to be wrapped as an IResourceWithPolicyV2.