Package org.apache.gravitino.policy
Interface PolicyOperations
- All Known Implementing Classes:
GravitinoClient,GravitinoMetalake
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 Summary
Modifier and TypeMethodDescriptionalterPolicy(String name, PolicyChange... changes) Alter a policy under a metalake.createPolicy(String name, String type, String comment, boolean enabled, PolicyContent content) Create a policy under a metalake.booleandeletePolicy(String name) Delete a policy under a metalake.voiddisablePolicy(String name) Disable a policy under a metalake.voidenablePolicy(String name) Enable a policy under a metalake.Get a policy by its name under a metalake.String[]List all the policy names under a metalake.Policy[]List all the policies with detailed information under a metalake.
-
Method Details
-
listPolicies
List all the policy names under a metalake.- Returns:
- The list of policy names.
- Throws:
NoSuchMetalakeException- If the metalake does not exist.
-
listPolicyInfos
List all the policies with detailed information under a metalake.- Returns:
- The list of policies.
- Throws:
NoSuchMetalakeException- If the metalake does not exist.
-
getPolicy
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
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
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
Policy alterPolicy(String name, PolicyChange... changes) throws NoSuchPolicyException, IllegalArgumentException 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
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.
-