Interface PolicyOperations

All Known Implementing Classes:
GravitinoClient, GravitinoMetalake

@Evolving public interface PolicyOperations
The interface of the policy operations. The policy operations are used to manage policies under a metalake. This interface will be mixed with GravitinoMetalake or GravitinoClient to provide policy operations.
  • Method Details

    • listPolicies

      String[] listPolicies() throws NoSuchMetalakeException
      List all the policy names under a metalake.
      Returns:
      The list of policy names.
      Throws:
      NoSuchMetalakeException - If the metalake does not exist.
    • listPolicyInfos

      Policy[] listPolicyInfos() throws NoSuchMetalakeException
      List all the policies with detailed information under a metalake.
      Returns:
      The list of policies.
      Throws:
      NoSuchMetalakeException - If the metalake does not exist.
    • getPolicy

      Policy getPolicy(String name) throws NoSuchPolicyException
      Get a policy by its name under a metalake.
      Parameters:
      name - The name of the policy.
      Returns:
      The policy.
      Throws:
      NoSuchPolicyException - If the policy does not exist.
    • createPolicy

      Policy createPolicy(String name, String type, String comment, boolean enabled, PolicyContent content) throws PolicyAlreadyExistsException
      Create a policy under a metalake.
      Parameters:
      name - The name of the policy.
      type - The type of the policy.
      comment - The comment of the policy.
      enabled - Whether the policy is enabled or not.
      content - The content of the policy.
      Returns:
      The created policy.
      Throws:
      PolicyAlreadyExistsException - If the policy already exists.
    • enablePolicy

      void enablePolicy(String name) throws NoSuchPolicyException
      Enable a policy under a metalake. If the policy is already enabled, this method does nothing.
      Parameters:
      name - The name of the policy to enable.
      Throws:
      NoSuchPolicyException - If the policy does not exist.
    • disablePolicy

      void disablePolicy(String name) throws NoSuchPolicyException
      Disable a policy under a metalake. If the policy is already disabled, this method does nothing.
      Parameters:
      name - The name of the policy to disable.
      Throws:
      NoSuchPolicyException - If the policy does not exist.
    • alterPolicy

      Alter a policy under a metalake.
      Parameters:
      name - The name of the policy.
      changes - The changes to apply to the policy.
      Returns:
      The altered policy.
      Throws:
      NoSuchPolicyException - If the policy does not exist.
      IllegalArgumentException - If the changes cannot be associated with the policy.
    • deletePolicy

      boolean deletePolicy(String name)
      Delete a policy under a metalake.
      Parameters:
      name - The name of the policy.
      Returns:
      True if the policy is deleted, false if the policy does not exist.