Interface GrantPolicyWithResourceOptions
- All Superinterfaces:
CommonGrantOptions,GrantWithResourceOptions,software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
GrantPolicyWithResourceOptions.Jsii$Proxy
@Generated(value="jsii-pacmak/1.116.0 (build 0eddcff)",
date="2025-10-29T11:15:41.183Z")
@Stability(Stable)
public interface GrantPolicyWithResourceOptions
extends software.amazon.jsii.JsiiSerializable, GrantWithResourceOptions
Options for a grant operation that directly adds a policy statement to a resource.
This differs from GrantWithResourceOptions in that it requires a pre-constructed PolicyStatement rather than constructing one from individual permissions. Use this when you need fine-grained control over the initial policy statement's contents.
Example:
IGrantable grantee;
String[] actions;
String[] resourceArns;
Bucket bucket;
PolicyStatement statement = PolicyStatement.Builder.create()
.effect(Effect.ALLOW)
.actions(actions)
.principals(List.of(new ServicePrincipal("lambda.amazonaws.com")))
.conditions(Map.of(
"StringEquals", Map.of(
"aws:SourceAccount", Stack.of(this).getAccount())))
.build();
Grant.addStatementToResourcePolicy(GrantPolicyWithResourceOptions.builder()
.grantee(grantee)
.actions(actions)
.resourceArns(resourceArns)
.resource(bucket)
.statement(statement)
.build());
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forGrantPolicyWithResourceOptionsstatic final classAn implementation forGrantPolicyWithResourceOptions -
Method Summary
Modifier and TypeMethodDescriptionbuilder()The policy statement to add to the resource's policy.Methods inherited from interface software.amazon.awscdk.services.iam.CommonGrantOptions
getActions, getConditions, getGrantee, getResourceArnsMethods inherited from interface software.amazon.awscdk.services.iam.GrantWithResourceOptions
getResource, getResourceSelfArnsMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getStatement
The policy statement to add to the resource's policy.This statement will be passed to the resource's addToResourcePolicy method. The actual handling of the statement depends on the specific IResourceWithPolicy implementation.
-
builder
-