java.lang.Object
java.lang.Enum<PolicyEffect>
software.amazon.awscdk.services.bedrockagentcore.PolicyEffect
All Implemented Interfaces:
Serializable, Comparable<PolicyEffect>, java.lang.constant.Constable

@Generated(value="jsii-pacmak/1.139.0 (build 26a6b54)", date="2026-09-10T17:51:40.357Z") @Stability(Stable) public enum PolicyEffect extends Enum<PolicyEffect>
Effect of a policy statement, whether it permits or forbids the action.

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();
 
  • Enum Constant Details

    • PERMIT

      @Stability(Stable) public static final PolicyEffect PERMIT
      Permit the action when the statement matches and its conditions hold.

      Multiple permit statements can apply, and any matching permit grants access.

    • FORBID

      @Stability(Stable) public static final PolicyEffect FORBID
      Forbid the action when the statement matches and its conditions hold.

      A forbid always takes precedence over any permit.

  • Method Details

    • values

      public static PolicyEffect[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static PolicyEffect valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null