Interface PolicyStatementProps

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
PolicyStatementProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.139.0 (build 26a6b54)", date="2026-09-10T17:51:40.363Z") @Stability(Stable) public interface PolicyStatementProps extends software.amazon.jsii.JsiiSerializable
Properties for a policy statement.

Example:

 PolicyEngine policyEngine;
 Gateway gateway;
 // Allow access unless the user is suspended
 Policy policyWithUnless = Policy.Builder.create(this, "UnlessPolicy")
         .policyEngine(policyEngine)
         .policyName("unless_suspended")
         .statement(PolicyStatement.Builder.create()
                 .effect(PolicyEffect.PERMIT)
                 .principal(PolicyPrincipal.entityType("AgentCore::OAuthUser"))
                 .action(PolicyAction.any())
                 .resource(PolicyResource.instance("AgentCore::Gateway", gateway.getGatewayArn()))
                 .unless(List.of(PolicyCondition.booleanEquals(PolicyAttribute.principal("suspended"), true)))
                 .build())
         .description("Allow all actions unless user is suspended")
         .validationMode(PolicyValidationMode.FAIL_ON_ANY_FINDINGS)
         .build();
 
  • Method Details

    • getAction

      @Stability(Stable) @NotNull PolicyAction getAction()
      The action the statement applies to.
    • getEffect

      @Stability(Stable) @NotNull PolicyEffect getEffect()
      Whether the statement permits or forbids the action.
    • getPrincipal

      @Stability(Stable) @NotNull PolicyPrincipal getPrincipal()
      The principal the statement applies to.
    • getResource

      @Stability(Stable) @NotNull PolicyResource getResource()
      The resource the statement applies to.
    • getUnless

      @Stability(Stable) @Nullable default List<PolicyCondition> getUnless()
      Conditions that must not hold for the statement to apply.

      Default: - no exclusions

    • getWhen

      @Stability(Stable) @Nullable default List<PolicyCondition> getWhen()
      Conditions that must all hold for the statement to apply.

      Use PolicyCondition.anyOf() for a member that only needs one of several conditions to hold.

      Default: - the statement applies whenever its principal, action and resource match

    • builder

      @Stability(Stable) static PolicyStatementProps.Builder builder()
      Returns:
      a PolicyStatementProps.Builder of PolicyStatementProps