Skip to content

[api] Add REST policy management - #9400

Merged
JingsongLi merged 4 commits into
apache:masterfrom
JingsongLi:codex/rest-policy-management-api
Aug 26, 2026
Merged

[api] Add REST policy management#9400
JingsongLi merged 4 commits into
apache:masterfrom
JingsongLi:codex/rest-policy-management-api

Conversation

@JingsongLi

@JingsongLi JingsongLi commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Purpose

Add experimental Java and REST client contracts for managing table row-filter and column-masking policies. This is the second change in the split series following #9393.

Changes

  • add DataPolicy, RowFilter, ColumnMask, PolicyType, and policy list filters
  • expose list, strict create, and drop operations through RESTCatalog.policyManagement()
  • map duplicate policy creation to the checked PolicyAlreadyExistException while preserving non-policy REST conflicts
  • add nested table policy resource paths, including POST .../policies/drop, and preserve pagination tokens as opaque values
  • add shaded/external Jackson compatibility, validation, request-path, and HTTP behavior tests

Scope

This PR intentionally contains only the PolicyManagement Java contract and REST client integration. The management OpenAPI/documentation and Spark SQL integration will follow in separate PRs.

Tests

  • mvn -pl paimon-api -DskipITs test
  • mvn -pl paimon-api -Pflink1,spark3 -DskipITs -DwildcardSuites=none -Dtest=PolicyManagementJsonTest,RESTPolicyManagementTest clean test
  • mvn -pl paimon-core -am -DskipITs -DwildcardSuites=none -Dtest=ResourcePathsTest -DfailIfNoTests=false test

@JingsongLi
JingsongLi marked this pull request as ready for review August 26, 2026 06:20
boolean ignoreIfNotExists) {
checkNotNull(resource, "resource cannot be null").validatePolicyAttachment();
try {
client.delete(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The six existing client.delete call sites pass a path that identifies the object; here the path is the collection (.../tables/{t}/policies) and the body picks one policy. A body that doesn't survive the hop leaves a well-formed, wider request rather than a malformed one — RFC 9110 §9.3.5: DELETE content "cannot alter the meaning or target of the request". (Fail-closed under DLF auth, which signs the body; not under bearer.)

#9393 hit this for revoke and used POST /permissions/revoke — would POST .../policies/drop work here too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2694ee84a7. Policy removal now uses POST .../policies/drop with DropPolicyRequest in the body; the collection endpoint is no longer targeted by a body-bearing DELETE. I also updated the HTTP behavior and resource-path regression tests while preserving the existing 404/ignoreIfNotExists handling.

@plusplusjiajia

Copy link
Copy Markdown
Member

LGTM +1

@JingsongLi
JingsongLi merged commit 28a2c01 into apache:master Aug 26, 2026
14 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants