Generate a preview of what a policy would do without creating it. Returns operations and resource diffs.
Pass rules or template_name, not both (400).
Request body application/json · PlanPreviewRequest
Plan preview request
3 fields
allexplicitpatternPolicy description for the created policy. Valid only with rules.
For a group subject, include leaf members of known nested groups when the preview is applied. Omitted or false limits a new rule to direct members.
Typed placement of the previewed Kubernetes rule. Required for a shared_by_template_v1 template preview. For an inline-rules preview it must match the namespaces referenced by the rules.
Inline rules for a direct-policy preview (accessTemplateSplit stage 2c-2). Exactly one of rules or template_name must be provided. The preview promises a creation. An existing policy for the subject/target pair is a conflict.
2 fields
Policy metadata for the created policy (e.g. future_objects, apply_default_privileges), mirroring POST /policies. Valid only with rules.
Policy name for the created policy. Valid only with rules.
Target account link the created policy binds to, mirroring POST /policies. Valid only with rules.
Template mode. Exactly one of rules or template_name must be provided.
Responses
OK
PlanPreviewResponse · 10 fields
5 fields
create, update, delete, no-op
Human-readable change description
role, grant, policy, k8s-resource
SQL statement (if applicable)
Target resource (role name, database, etc.)
Always true for plan preview
5 fields
create, update, delete, no-op
Human-readable change description
role, grant, policy, k8s-resource
SQL statement (if applicable)
Target resource (role name, database, etc.)
Legacy fields for /:id/plan endpoint (old flow)
Fields for plan-preview endpoint (new flow)
5 fields
2 fields
{"create": 5, "update": 2, "delete": 1}
Unprocessable Entity - a rule cannot be executed on the target as written (for example a privilege on an object level that does not take it). Detail and field_errors name the fix. Also when Future objects stay on while a PostgreSQL row names its objects by name or by a name mask, field_errors then names the switch Also when Principal doesn't manage the target of the rule or template (before v7.3 that answer was 403 authorization.denied).
Common errors: 400 401 403 404 409 413 429 503 504. They mean the same for every operation, see Errors.