Class PolarisCatalogPolicyApi

java.lang.Object
org.apache.polaris.service.catalog.api.PolarisCatalogPolicyApi

@Path("/api/catalog/polaris/v1/{prefix}") @Generated(value="org.openapitools.codegen.languages.JavaResteasyServerCodegen", date="2025-10-06T09:01:55.320737337Z[UTC]", comments="Generator version: 7.12.0") public class PolarisCatalogPolicyApi extends Object
The PolicyApi API interface This file is automatically generated by the OpenAPI Code Generator based on configuration in the build.gradle file.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    jakarta.ws.rs.core.Response
    attachPolicy(String prefix, String namespace, @Pattern(regexp="^[A-Za-z0-9\\-_]+$") String policyName, @Valid AttachPolicyRequest attachPolicyRequest, org.apache.polaris.core.context.RealmContext realmContext, jakarta.ws.rs.core.SecurityContext securityContext)
    Create a mapping between a policy and a resource entity Policy can be attached to different levels: 1.
    jakarta.ws.rs.core.Response
    createPolicy(String prefix, String namespace, @Valid CreatePolicyRequest createPolicyRequest, org.apache.polaris.core.context.RealmContext realmContext, jakarta.ws.rs.core.SecurityContext securityContext)
    Creates a policy within the specified namespace.
    jakarta.ws.rs.core.Response
    detachPolicy(String prefix, String namespace, @Pattern(regexp="^[A-Za-z0-9\\-_]+$") String policyName, @Valid DetachPolicyRequest detachPolicyRequest, org.apache.polaris.core.context.RealmContext realmContext, jakarta.ws.rs.core.SecurityContext securityContext)
    Remove a mapping between a policy and a target entity A target entity can be a catalog, namespace, table or view.
    jakarta.ws.rs.core.Response
    dropPolicy(String prefix, String namespace, @Pattern(regexp="^[A-Za-z0-9\\-_]+$") String policyName, Boolean detachAll, org.apache.polaris.core.context.RealmContext realmContext, jakarta.ws.rs.core.SecurityContext securityContext)
    Remove a policy from the catalog.
    jakarta.ws.rs.core.Response
    getApplicablePolicies(String prefix, String pageToken, @Min(1L) Integer pageSize, String namespace, String targetName, String policyType, org.apache.polaris.core.context.RealmContext realmContext, jakarta.ws.rs.core.SecurityContext securityContext)
    Retrieves all applicable policies for a specified entity, including inherited policies from parent entities.
    jakarta.ws.rs.core.Response
    listPolicies(String prefix, String namespace, String pageToken, @Min(1L) Integer pageSize, String policyType, org.apache.polaris.core.context.RealmContext realmContext, jakarta.ws.rs.core.SecurityContext securityContext)
    Return all policy identifiers under this namespace.
    jakarta.ws.rs.core.Response
    loadPolicy(String prefix, String namespace, @Pattern(regexp="^[A-Za-z0-9\\-_]+$") String policyName, org.apache.polaris.core.context.RealmContext realmContext, jakarta.ws.rs.core.SecurityContext securityContext)
    Load a policy from the catalog The response contains the policy's metadata and content.
    jakarta.ws.rs.core.Response
    updatePolicy(String prefix, String namespace, @Pattern(regexp="^[A-Za-z0-9\\-_]+$") String policyName, @Valid UpdatePolicyRequest updatePolicyRequest, org.apache.polaris.core.context.RealmContext realmContext, jakarta.ws.rs.core.SecurityContext securityContext)
    Update a policy A policy's description and content can be updated.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • attachPolicy

      @PUT @Path("/namespaces/{namespace}/policies/{policy-name}/mappings") @Consumes("application/json") @Produces("application/json") @RolesAllowed("**") @Timeout public jakarta.ws.rs.core.Response attachPolicy(@PathParam("prefix") String prefix, @PathParam("namespace") String namespace, @Pattern(regexp="^[A-Za-z0-9\\-_]+$") @PathParam("policy-name") @Pattern(regexp="^[A-Za-z0-9\\-_]+$") String policyName, @Nonnull @Valid @Valid AttachPolicyRequest attachPolicyRequest, @Context org.apache.polaris.core.context.RealmContext realmContext, @Context jakarta.ws.rs.core.SecurityContext securityContext)
      Create a mapping between a policy and a resource entity Policy can be attached to different levels: 1. **Table-like level:** Policies specific to individual tables or views. 2. **Namespace level:** Policies applies to a namespace. 3. **Catalog level:** Policies that applies to a catalog The ability to attach a policy to a specific entity type is governed by the PolicyValidator. A policy can only be attached if the resource entity is a valid target for the specified policy type. In addition to the validation rules enforced by the PolicyValidator, there are additional constraints on policy attachment: 1. For inheritable policies, only one policy of the same type can be attached to a given resource entity. 2. For non-inheritable policies, multiple policies of the same type can be attached to the same resource entity without restriction. For inheritable policies, the inheritance override rule is: 1. Table-like level policies override namespace and catalog policies. 2. Namespace-level policies override upper level namespace or catalog policies. Additional parameters can be provided in `parameters` when creating a mapping to define specific behavior or constraints. If the policy is already attached to the target entity, the existing mapping record will be updated with the new set of parameters, replacing the previous ones. Response type: Void.
      Parameters:
      prefix - Required - An optional prefix in the path
      namespace - Required - A namespace identifier as a single string. Multipart namespace parts should be separated by the unit separator (`0x1F`) byte.
      policyName - Required -
      attachPolicyRequest - Required -
      Returns:
      204 - Success, no content
    • createPolicy

      @POST @Path("/namespaces/{namespace}/policies") @Consumes("application/json") @Produces("application/json") @RolesAllowed("**") @Timeout public jakarta.ws.rs.core.Response createPolicy(@PathParam("prefix") String prefix, @PathParam("namespace") String namespace, @Nonnull @Valid @Valid CreatePolicyRequest createPolicyRequest, @Context org.apache.polaris.core.context.RealmContext realmContext, @Context jakarta.ws.rs.core.SecurityContext securityContext)
      Creates a policy within the specified namespace. A policy defines a set of rules governing actions on specified resources under predefined conditions. In Apache Polaris, policies are created, stored, and later referenced by external engines to enforce access controls on associated resources. User provides the following inputs when creating a policy - `name` (REQUIRED): The name of the policy. - `type` (REQUIRED): The type of the policy. - **Predefined Policies:** policies have a `system.*` prefix in their type, such as `system.data_compaction` - `description` (OPTIONAL): Provides details about the policy's purpose and functionality - `content` (OPTIONAL): Defines the rules that control actions and access conditions on resources. The format can be JSON, SQL, or any other format. The content field in the request body is validated using the policy's corresponding validator. The policy is created only if the content passes validation. Upon successful creation, the new policy's version will be 0. Response type: LoadPolicyResponse.
      Parameters:
      prefix - Required - An optional prefix in the path
      namespace - Required - A namespace identifier as a single string. Multipart namespace parts should be separated by the unit separator (`0x1F`) byte.
      createPolicyRequest - Required -
      Returns:
      200 - Policy object result after creating a policy
    • detachPolicy

      @POST @Path("/namespaces/{namespace}/policies/{policy-name}/mappings") @Consumes("application/json") @Produces("application/json") @RolesAllowed("**") @Timeout public jakarta.ws.rs.core.Response detachPolicy(@PathParam("prefix") String prefix, @PathParam("namespace") String namespace, @Pattern(regexp="^[A-Za-z0-9\\-_]+$") @PathParam("policy-name") @Pattern(regexp="^[A-Za-z0-9\\-_]+$") String policyName, @Nonnull @Valid @Valid DetachPolicyRequest detachPolicyRequest, @Context org.apache.polaris.core.context.RealmContext realmContext, @Context jakarta.ws.rs.core.SecurityContext securityContext)
      Remove a mapping between a policy and a target entity A target entity can be a catalog, namespace, table or view. Response type: Void.
      Parameters:
      prefix - Required - An optional prefix in the path
      namespace - Required - A namespace identifier as a single string. Multipart namespace parts should be separated by the unit separator (`0x1F`) byte.
      policyName - Required -
      detachPolicyRequest - Required -
      Returns:
      204 - Success, no content
    • dropPolicy

      @DELETE @Path("/namespaces/{namespace}/policies/{policy-name}") @Produces("application/json") @RolesAllowed("**") @Timeout public jakarta.ws.rs.core.Response dropPolicy(@PathParam("prefix") String prefix, @PathParam("namespace") String namespace, @Pattern(regexp="^[A-Za-z0-9\\-_]+$") @PathParam("policy-name") @Pattern(regexp="^[A-Za-z0-9\\-_]+$") String policyName, @QueryParam("detach-all") Boolean detachAll, @Context org.apache.polaris.core.context.RealmContext realmContext, @Context jakarta.ws.rs.core.SecurityContext securityContext)
      Remove a policy from the catalog. A policy can only be dropped if it is not attached to any resource entity. To remove the policy along with all its attachments, set detach-all to true. Response type: Void.
      Parameters:
      prefix - Required - An optional prefix in the path
      namespace - Required - A namespace identifier as a single string. Multipart namespace parts should be separated by the unit separator (`0x1F`) byte.
      policyName - Required -
      detachAll - When set to true, the dropPolicy operation will also delete all mappings between the policy and its attached target entities.
      Returns:
      204 - Success, no content
    • getApplicablePolicies

      @GET @Path("/applicable-policies") @Produces("application/json") @RolesAllowed("**") @Timeout public jakarta.ws.rs.core.Response getApplicablePolicies(@PathParam("prefix") String prefix, @QueryParam("pageToken") String pageToken, @QueryParam("pageSize") @Min(1L) @Min(1L) Integer pageSize, @QueryParam("namespace") String namespace, @QueryParam("target-name") String targetName, @QueryParam("policyType") String policyType, @Context org.apache.polaris.core.context.RealmContext realmContext, @Context jakarta.ws.rs.core.SecurityContext securityContext)
      Retrieves all applicable policies for a specified entity, including inherited policies from parent entities. An entity can be a table/view, namespace, or catalog. The required parameters depend on the entity type: - Table/View: - The `namespace` parameter is required to specify the entity's namespace. - The `target-name` parameter is required to specify the entity name. - Namespace: - The `namespace` parameter is required to specify the identifier. - The `target-name` parameter should not be set. - Catalog: - Neither `namespace` nor `target-name` should be set. An optional policyType parameter filters results to return only policies of the specified type. This API evaluates the entity's hierarchy and applies inheritable policies from parent entities. The inheritance follows the following override rule: 1. Table-like level policies override namespace and catalog policies. 2. Namespace-level policies override upper level namespace or catalog policies. Response type: GetApplicablePoliciesResponse.
      Parameters:
      prefix - Required - An optional prefix in the path
      pageToken -
      pageSize - For servers that support pagination, this signals an upper bound of the number of results that a client will receive. For servers that do not support pagination, clients may receive results larger than the indicated `pageSize`.
      namespace - A namespace identifier as a single string. Multipart namespace parts should be separated by the unit separator (`0x1F`) byte.
      targetName - Name of the target table/view
      policyType -
      Returns:
      200 - A list of policies applicable to the table
    • listPolicies

      @GET @Path("/namespaces/{namespace}/policies") @Produces("application/json") @RolesAllowed("**") @Timeout public jakarta.ws.rs.core.Response listPolicies(@PathParam("prefix") String prefix, @PathParam("namespace") String namespace, @QueryParam("pageToken") String pageToken, @QueryParam("pageSize") @Min(1L) @Min(1L) Integer pageSize, @QueryParam("policyType") String policyType, @Context org.apache.polaris.core.context.RealmContext realmContext, @Context jakarta.ws.rs.core.SecurityContext securityContext)
      Return all policy identifiers under this namespace. Users can optionally filter the result by policy type Response type: ListPoliciesResponse.
      Parameters:
      prefix - Required - An optional prefix in the path
      namespace - Required - A namespace identifier as a single string. Multipart namespace parts should be separated by the unit separator (`0x1F`) byte.
      pageToken -
      pageSize - For servers that support pagination, this signals an upper bound of the number of results that a client will receive. For servers that do not support pagination, clients may receive results larger than the indicated `pageSize`.
      policyType -
      Returns:
      200 - a list of policy identifiers
    • loadPolicy

      @GET @Path("/namespaces/{namespace}/policies/{policy-name}") @Produces("application/json") @RolesAllowed("**") @Timeout public jakarta.ws.rs.core.Response loadPolicy(@PathParam("prefix") String prefix, @PathParam("namespace") String namespace, @Pattern(regexp="^[A-Za-z0-9\\-_]+$") @PathParam("policy-name") @Pattern(regexp="^[A-Za-z0-9\\-_]+$") String policyName, @Context org.apache.polaris.core.context.RealmContext realmContext, @Context jakarta.ws.rs.core.SecurityContext securityContext)
      Load a policy from the catalog The response contains the policy's metadata and content. For more details, refer to the definition of the `Policy` model. Response type: LoadPolicyResponse.
      Parameters:
      prefix - Required - An optional prefix in the path
      namespace - Required - A namespace identifier as a single string. Multipart namespace parts should be separated by the unit separator (`0x1F`) byte.
      policyName - Required -
      Returns:
      200 - Policy object result when getting a policy
    • updatePolicy

      @PUT @Path("/namespaces/{namespace}/policies/{policy-name}") @Consumes("application/json") @Produces("application/json") @RolesAllowed("**") @Timeout public jakarta.ws.rs.core.Response updatePolicy(@PathParam("prefix") String prefix, @PathParam("namespace") String namespace, @Pattern(regexp="^[A-Za-z0-9\\-_]+$") @PathParam("policy-name") @Pattern(regexp="^[A-Za-z0-9\\-_]+$") String policyName, @Nonnull @Valid @Valid UpdatePolicyRequest updatePolicyRequest, @Context org.apache.polaris.core.context.RealmContext realmContext, @Context jakarta.ws.rs.core.SecurityContext securityContext)
      Update a policy A policy's description and content can be updated. The new content is validated against the policy's corresponding validator. Upon a successful update, the policy's version is incremented by 1. The update will only succeed if the current version matches the one in the catalog. Response type: LoadPolicyResponse.
      Parameters:
      prefix - Required - An optional prefix in the path
      namespace - Required - A namespace identifier as a single string. Multipart namespace parts should be separated by the unit separator (`0x1F`) byte.
      policyName - Required -
      updatePolicyRequest - Required -
      Returns:
      200 - Response used when a policy is successfully updated The updated policy JSON is returned in the policy field