Module: AWSCDK::IAM::IResourcePolicyFactory

Defined in:
iam/i_resource_policy_factory.rb

Overview

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.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.jsii_overridable_methodsObject



26
27
28
29
30
# File 'iam/i_resource_policy_factory.rb', line 26

def self.jsii_overridable_methods
  {
    :for_resource => { kind: :method, name: "forResource", is_optional: false },
  }
end

Instance Method Details

#for_resource(resource) ⇒ AWSCDK::IAM::IResourceWithPolicyV2

Create an IResourceWithPolicyV2 from a construct.

Parameters:

Returns:



21
22
23
24
# File 'iam/i_resource_policy_factory.rb', line 21

def for_resource(resource)
  Jsii::Type.check_type(resource, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5DZm5SZXNvdXJjZSJ9")), "resource")
  jsii_call_method("forResource", [resource])
end