interface IResourcePolicyFactory
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.IAM.IResourcePolicyFactory |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsiam#IResourcePolicyFactory |
Java | software.amazon.awscdk.services.iam.IResourcePolicyFactory |
Python | aws_cdk.aws_iam.IResourcePolicyFactory |
TypeScript (source) | aws-cdk-lib » aws_iam » IResourcePolicyFactory |
Obtainable from
Default.get()
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
| Name | Description |
|---|---|
| for | Create an IResourceWithPolicyV2 from a construct. |
forResource(resource)
public forResource(resource: CfnResource): IResourceWithPolicyV2
Parameters
- resource
Cfn— the construct to be wrapped as an IResourceWithPolicyV2.Resource
Returns
Create an IResourceWithPolicyV2 from a construct.

.NET
Go
Java
Python
TypeScript (