plusplusjiajia opened a new pull request, #829:
URL: https://github.com/apache/paimon-rust/pull/829
## Purpose
Ports the data-policy half of the experimental REST management API added in
apache/paimon#9400 to Rust: the row filters and column masks a REST catalog
stores per principal and applies at read time. Builds on #820, reusing its
`PermissionResource`.
## What it adds
GET
/v1/{prefix}/databases/{db}/tables/{table}/policies?type&principal&column&maxResults&pageToken
POST /v1/{prefix}/databases/{db}/tables/{table}/policies
POST /v1/{prefix}/databases/{db}/tables/{table}/policies/drop
`api/management.rs` gains `PolicyType`, `RowFilter`, `ColumnMask`,
`DataPolicy` and `ListPoliciesRequest`, mirroring
`org.apache.paimon.management`, and `RESTApi` gains `list_policies`,
`create_policy` and `drop_policy`, with thin delegates on `RESTCatalog`. Wire
names, query parameters and client-side validation follow Java. No new
dependencies.
## Notes for review
- A policy attaches to a table only, so the path is the attachment identity
and the request body carries no resource, as in Java.
- **Errors are discriminated by `resource_type`**, as in
`RESTPolicyManagement`: `drop_policy(.., ignore_if_not_exists = true)` swallows
only a 404 whose type is `POLICY`, and a 409 on a duplicate policy stays
distinguishable from one on the table. The 409 is passed through rather than
wrapped — Java's `PolicyAlreadyExistException` has no Rust counterpart.
- **`DataPolicy` holds the two definitions as separate `Option` fields**, as
in `DataPolicy.java`. The "exactly one" rule is enforced by the constructors
and again when a policy becomes a create body, which is where Java's single
validating constructor enforces it. Hence `TryFrom`, not `From`.
- Constructors are `new_row_filter` / `new_column_mask`: Rust cannot give a
constructor and a getter the same name.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]