Class PolicyStatement

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.bedrockagentcore.PolicyStatement
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.139.0 (build 26a6b54)", date="2026-09-10T17:51:40.362Z") @Stability(Stable) public class PolicyStatement extends software.amazon.jsii.JsiiObject
A Cedar authorization policy statement.

A statement names the principal, action and resource it applies to, and optionally conditions that narrow it further. All three parts are required, so a statement is complete as soon as it is constructed.

Example:

 import software.amazon.awscdk.services.bedrockagentcore.Policy;
 import software.amazon.awscdk.services.bedrockagentcore.PolicyEngine;
 import software.amazon.awscdk.services.bedrockagentcore.PolicyStatement;
 PolicyEngine engine;
 // Example 4: raw Cedar, for features the API does not model
 // Example 4: raw Cedar, for features the API does not model
 Policy.Builder.create(this, "CustomPolicy")
         .policyEngine(engine)
         .statement(PolicyStatement.fromCedar("permit(principal, action, resource) when { context.custom > 10 };"))
         .build();
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    A fluent builder for PolicyStatement.

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
     
    protected
    PolicyStatement(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    PolicyStatement(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    fromCedar(String cedarStatement)
    Create a statement from raw Cedar source.
    Generate the Cedar policy statement string.

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • PolicyStatement

      protected PolicyStatement(software.amazon.jsii.JsiiObjectRef objRef)
    • PolicyStatement

      protected PolicyStatement(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • PolicyStatement

      @Stability(Stable) public PolicyStatement(@NotNull PolicyStatementProps props)
      Parameters:
      props - This parameter is required.
  • Method Details

    • fromCedar

      @Stability(Stable) @NotNull public static PolicyStatement fromCedar(@NotNull String cedarStatement)
      Create a statement from raw Cedar source.

      Use this for Cedar features this API does not model, or to migrate an existing policy.

      The source is used exactly as given. This method does not escape, quote, or validate it, so it is treated as trusted input and you own its correctness and its safety. Do not build the string by joining values that come from outside your application: a value containing a double quote can close a string literal early and add policy statements you did not write. Pass such values through PolicyCondition and the principal, action and resource factories instead, which reject that case at synthesis time. Service-side validation does not help, because an injected policy is still valid Cedar.

      Parameters:
      cedarStatement -
      • Complete Cedar policy statement.
      This parameter is required.
    • toCedar

      @Stability(Stable) @NotNull public String toCedar()
      Generate the Cedar policy statement string.

      This is called internally by the Policy construct.

      Returns:
      Valid Cedar policy statement