# PolicyValidationMode

Validation mode for Cedar policy definitions.

Obtainable from: PolicyValidationMode.FAIL_ON_ANY_FINDINGS, PolicyValidationMode.IGNORE_ALL_FINDINGS, PolicyValidationMode.of

- Source: [`aws-bedrockagentcore/lib/policy/policy-types.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-bedrockagentcore/lib/policy/policy-types.ts#L7)
- Type last changed: v2.269.0 · 10 Sep 2026

## Example

TypeScript:

```ts
declare const policyEngine: agentcore.PolicyEngine;
declare const gateway: agentcore.Gateway;

// Allow access unless the user is suspended
const policyWithUnless = new agentcore.Policy(this, "UnlessPolicy", {
  policyEngine: policyEngine,
  policyName: "unless_suspended",
  statement: new agentcore.PolicyStatement({
    effect: agentcore.PolicyEffect.PERMIT,
    principal: agentcore.PolicyPrincipal.entityType('AgentCore::OAuthUser'),
    action: agentcore.PolicyAction.any(),
    resource: agentcore.PolicyResource.instance('AgentCore::Gateway', gateway.gatewayArn),
    unless: [
      agentcore.PolicyCondition.booleanEquals(
        agentcore.PolicyAttribute.principal('suspended'), true),
    ],
  }),
  description: "Allow all actions unless user is suspended",
  validationMode: agentcore.PolicyValidationMode.FAIL_ON_ANY_FINDINGS,
});

// Generated Cedar:
// permit(
//   principal is AgentCore::OAuthUser,
//   action,
//   resource == AgentCore::Gateway::"arn:..."
// )
// unless {
//   principal.suspended == true
// };
```

Python:

```python
# policy_engine: agentcore.PolicyEngine
# gateway: agentcore.Gateway

# Allow access unless the user is suspended
policy_with_unless = agentcore.Policy(self, "UnlessPolicy",
    policy_engine=policy_engine,
    policy_name="unless_suspended",
    statement=agentcore.PolicyStatement(
        effect=agentcore.PolicyEffect.PERMIT,
        principal=agentcore.PolicyPrincipal.entity_type("AgentCore::OAuthUser"),
        action=agentcore.PolicyAction.any(),
        resource=agentcore.PolicyResource.instance("AgentCore::Gateway", gateway.gateway_arn),
        unless=[
            agentcore.PolicyCondition.boolean_equals(
                agentcore.PolicyAttribute.principal("suspended"), True)
        ]
    ),
    description="Allow all actions unless user is suspended",
    validation_mode=agentcore.PolicyValidationMode.FAIL_ON_ANY_FINDINGS
)
```

Java:

```java
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();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
PolicyEngine policyEngine;
Gateway gateway;

// Allow access unless the user is suspended
var policyWithUnless = new Policy(this, "UnlessPolicy", new PolicyProps {
    PolicyEngine = policyEngine,
    PolicyName = "unless_suspended",
    Statement = new PolicyStatement(new PolicyStatementProps {
        Effect = PolicyEffect.PERMIT,
        Principal = PolicyPrincipal.EntityType("AgentCore::OAuthUser"),
        Action = PolicyAction.Any(),
        Resource = PolicyResource.Instance("AgentCore::Gateway", gateway.GatewayArn),
        Unless = new [] { PolicyCondition.BooleanEquals(PolicyAttribute.Principal("suspended"), true) }
    }),
    Description = "Allow all actions unless user is suspended",
    ValidationMode = PolicyValidationMode.FAIL_ON_ANY_FINDINGS
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var policyEngine PolicyEngine
var gateway Gateway

// Allow access unless the user is suspended
policyWithUnless := agentcore.NewPolicy(this, jsii.String("UnlessPolicy"), &PolicyProps{
	PolicyEngine: policyEngine,
	PolicyName: jsii.String("unless_suspended"),
	Statement: agentcore.NewPolicyStatement(&PolicyStatementProps{
		Effect: agentcore.PolicyEffect_PERMIT,
		Principal: agentcore.PolicyPrincipal_EntityType(jsii.String("AgentCore::OAuthUser")),
		Action: agentcore.PolicyAction_Any(),
		Resource: agentcore.PolicyResource_Instance(jsii.String("AgentCore::Gateway"), gateway.GatewayArn),
		Unless: []PolicyCondition{
			agentcore.PolicyCondition_BooleanEquals(agentcore.PolicyAttribute_Principal(jsii.String("suspended")), jsii.Boolean(true)),
		},
	}),
	Description: jsii.String("Allow all actions unless user is suspended"),
	ValidationMode: agentcore.PolicyValidationMode_FAIL_ON_ANY_FINDINGS(),
})
```

## Properties

- `FAIL_ON_ANY_FINDINGS`: [PolicyValidationMode](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore.PolicyValidationMode.html) (static) — Fail policy creation if any validation findings are detected.

  This is the safer default - catches policy errors early.

- `IGNORE_ALL_FINDINGS`: [PolicyValidationMode](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore.PolicyValidationMode.html) (static) — Ignore all validation findings and create the policy anyway.

  Use with caution - may result in runtime authorization errors.

- `value`: string — The string value of the validation mode.

## Methods

- `of(value: string): PolicyValidationMode // chainable` (static) — A validation mode that this version of the CDK does not model.

  Prefer the static members above. Use this when the service has added a mode
  that the CDK has no member for yet: the CloudFormation registry schemas that
  validate the synthesized template ship with `aws-cdk-lib` and refresh on
  release, while the members above are added by hand, so a released CDK can
  accept a mode before it models one.

  **Parameters**

  - `value` — the raw validation mode value to pass to CloudFormation.
