Interface AddPolicyOptions

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

@Generated(value="jsii-pacmak/1.139.0 (build 26a6b54)", date="2026-09-10T17:51:39.886Z") @Stability(Stable) public interface AddPolicyOptions extends software.amazon.jsii.JsiiSerializable
Options for adding a policy via PolicyEngine.addPolicy().

Example:

 PolicyEngine policyEngine;
 Gateway gateway;
 // Allow specific tool actions on specific gateway
 // Action names follow pattern: "ToolName__operation"
 policyEngine.addPolicy("SpecificToolPolicy", AddPolicyOptions.builder()
         .statement(PolicyStatement.Builder.create()
                 .effect(PolicyEffect.PERMIT)
                 .principal(PolicyPrincipal.entityType("AgentCore::OAuthUser"))
                 .action(PolicyAction.anyOf(List.of("AgentCore::Action::WeatherTool__get_forecast", "AgentCore::Action::WeatherTool__get_current")))
                 .resource(PolicyResource.instance("AgentCore::Gateway", gateway.getGatewayArn()))
                 .build())
         .description("Allow specific weather tool operations")
         .validationMode(PolicyValidationMode.FAIL_ON_ANY_FINDINGS)
         .build());
 
  • Method Details

    • getStatement

      @Stability(Stable) @NotNull PolicyStatement getStatement()
      The Cedar policy statement for this policy.

      Build a type-safe statement with the PolicyStatement factories, or use PolicyStatement.fromCedar('...') for raw Cedar. Raw Cedar is treated as trusted input: the module does not escape, quote, or validate it.

    • getDescription

      @Stability(Stable) @Nullable default String getDescription()
      Optional description for the policy (max 4,096 characters).

      Default: - No description

    • getPolicyName

      @Stability(Stable) @Nullable default String getPolicyName()
      The name of the policy.

      Valid characters: a-z, A-Z, 0-9, _ (underscore) Must start with a letter, 1-48 characters

      Default: - Auto-generated unique name

    • getValidationMode

      @Stability(Stable) @Nullable default PolicyValidationMode getValidationMode()
      Validation mode for the policy.

      Default: PolicyValidationMode.FAIL_ON_ANY_FINDINGS

    • builder

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