Package org.apache.gravitino.client
Class GravitinoClient
java.lang.Object
org.apache.gravitino.client.GravitinoClientBase
org.apache.gravitino.client.GravitinoClient
- All Implemented Interfaces:
Closeable
,AutoCloseable
,SupportsJobs
,PolicyOperations
,SupportsCatalogs
,TagOperations
public class GravitinoClient
extends GravitinoClientBase
implements SupportsCatalogs, TagOperations, SupportsJobs, PolicyOperations
Apache Gravitino Client for a user to interact with the Gravitino API, allowing the client to
list, load, create, and alter Catalog.
It uses an underlying RESTClient
to send HTTP requests and receive responses from the
API.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder class for constructing a GravitinoClient.Nested classes/interfaces inherited from class org.apache.gravitino.client.GravitinoClientBase
GravitinoClientBase.Builder<T>
-
Field Summary
Fields inherited from class org.apache.gravitino.client.GravitinoClientBase
API_METALAKES_IDENTIFIER_PATH, API_METALAKES_LIST_PATH, restClient
-
Method Summary
Modifier and TypeMethodDescriptionAdds a new Group.Adds a new User.alterCatalog
(String catalogName, CatalogChange... changes) Alter a catalog with specified catalog name and changes.alterPolicy
(String name, PolicyChange... changes) Alter a policy under a metalake.Alter a tag under a metalake.Creates a new builder for constructing a GravitinoClient.Cancel a job by its ID.createCatalog
(String catalogName, Catalog.Type type, String provider, String comment, Map<String, String> properties) Create a catalog with specified catalog name, type, provider, comment, and properties.createPolicy
(String name, String type, String comment, boolean enabled, PolicyContent content) Create a policy under a metalake.createRole
(String role, Map<String, String> properties, List<SecurableObject> securableObjects) Creates a new Role.Create a tag under a metalake.boolean
deleteJobTemplate
(String jobTemplateName) Deletes a job template by its name.boolean
deletePolicy
(String name) Delete a policy under a metalake.boolean
deleteRole
(String role) Deletes a Role.boolean
Delete a tag under a metalake.void
disableCatalog
(String catalogName) Disable a catalog.void
disablePolicy
(String name) Disable a policy under a metalake.boolean
dropCatalog
(String catalogName, boolean force) Drop a catalog with specified name.void
enableCatalog
(String catalogName) Enable a catalog.void
enablePolicy
(String name) Enable a policy under a metalake.Gets a Group.Retrieves a job by its ID.getJobTemplate
(String jobTemplateName) Retrieves a job template by its name.getOwner
(MetadataObject object) Get the owner of a metadata object.Get a policy by its name under a metalake.Gets a Role.Get a tag by its name under a metalake.Gets a User.grantPrivilegesToRole
(String role, MetadataObject object, List<Privilege> privileges) Deprecated.grantPrivilegesToRole
(String role, MetadataObject object, Set<Privilege> privileges) Grant privileges to a role.grantRolesToGroup
(List<String> roles, String group) Grant roles to a group.grantRolesToUser
(List<String> roles, String user) Grant roles to a user.String[]
List the name of all catalogs in the metalake.Catalog[]
List all catalogs with their information in the metalake.String[]
List the group names.Group[]
List the groups.listJobs()
Lists all the jobs in Gravitino.Lists all the jobs by the specified job template name.Lists all the registered job templates in Gravitino.String[]
List all the policy names under a metalake.Policy[]
List all the policies with detailed information under a metalake.String[]
Lists the role names.String[]
listTags()
List all the tag names under a metalake.Tag[]
List all the tags with detailed information under a metalake.String[]
Lists the usernames.User[]
Lists the users.loadCatalog
(String catalogName) Load a catalog by its name.void
registerJobTemplate
(JobTemplate jobTemplate) Register a job template with the specified job template to Gravitino.boolean
removeGroup
(String group) Removes a Group.boolean
removeUser
(String user) Removes a User.revokePrivilegesFromRole
(String role, MetadataObject object, List<Privilege> privileges) Deprecated.revokePrivilegesFromRole
(String role, MetadataObject object, Set<Privilege> privileges) Revoke privileges from a role.revokeRolesFromGroup
(List<String> roles, String group) Revoke roles from a group.revokeRolesFromUser
(List<String> roles, String user) Revoke roles from a user.Run a job with the template name and configuration.void
setOwner
(MetadataObject object, String ownerName, Owner.Type ownerType) Set the owner of a metadata object.void
testConnection
(String catalogName, Catalog.Type type, String provider, String comment, Map<String, String> properties) Test whether a catalog can be created successfully with the specified parameters, without actually creating it.Methods inherited from class org.apache.gravitino.client.GravitinoClientBase
checkMetalakeName, checkVersion, clientVersion, close, getVersion, loadMetalake, serverVersion
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.gravitino.SupportsCatalogs
catalogExists, createCatalog, dropCatalog
-
Method Details
-
listCatalogs
Description copied from interface:SupportsCatalogs
List the name of all catalogs in the metalake.- Specified by:
listCatalogs
in interfaceSupportsCatalogs
- Returns:
- The list of catalog's names.
- Throws:
NoSuchMetalakeException
- If the metalake does not exist.
-
listCatalogsInfo
Description copied from interface:SupportsCatalogs
List all catalogs with their information in the metalake.- Specified by:
listCatalogsInfo
in interfaceSupportsCatalogs
- Returns:
- The list of catalog's information.
- Throws:
NoSuchMetalakeException
- If the metalake with namespace does not exist.
-
loadCatalog
Description copied from interface:SupportsCatalogs
Load a catalog by its name.- Specified by:
loadCatalog
in interfaceSupportsCatalogs
- Parameters:
catalogName
- the name of the catalog.- Returns:
- The catalog.
- Throws:
NoSuchCatalogException
- If the catalog does not exist.
-
createCatalog
public Catalog createCatalog(String catalogName, Catalog.Type type, String provider, String comment, Map<String, String> properties) throws NoSuchMetalakeException, CatalogAlreadyExistsExceptionDescription copied from interface:SupportsCatalogs
Create a catalog with specified catalog name, type, provider, comment, and properties.The parameter "provider" is a short name of the catalog, used to tell Gravitino which catalog should be created. The short name:
1) should be the same as the
CatalogProvider
interface provided. 2) can be "null" if the created catalog is the managed catalog, like model, fileset catalog. For the details of the provider definition, seeCatalogProvider
.- Specified by:
createCatalog
in interfaceSupportsCatalogs
- Parameters:
catalogName
- the name of the catalog.type
- the type of the catalog.provider
- the provider of the catalog, or null if the catalog is a managed catalog.comment
- the comment of the catalog.properties
- the properties of the catalog.- Returns:
- The created catalog.
- Throws:
NoSuchMetalakeException
- If the metalake does not exist.CatalogAlreadyExistsException
- If the catalog already exists.
-
alterCatalog
public Catalog alterCatalog(String catalogName, CatalogChange... changes) throws NoSuchCatalogException, IllegalArgumentException Description copied from interface:SupportsCatalogs
Alter a catalog with specified catalog name and changes.- Specified by:
alterCatalog
in interfaceSupportsCatalogs
- Parameters:
catalogName
- the name of the catalog.changes
- the changes to apply to the catalog.- Returns:
- The altered catalog.
- Throws:
NoSuchCatalogException
- If the catalog does not exist.IllegalArgumentException
- If the changes cannot be applied to the catalog.
-
dropCatalog
public boolean dropCatalog(String catalogName, boolean force) throws NonEmptyEntityException, CatalogInUseException Description copied from interface:SupportsCatalogs
Drop a catalog with specified name. If the force flag is true, it will:- Cascade drop all sub-entities (schemas, tables, etc.) of the catalog in Gravitino store.
- Drop the catalog even if it is in use.
- External resources (e.g. database, table, etc.) associated with sub-entities will not be dropped unless it is managed (such as managed fileset).
SupportsCatalogs.dropCatalog(String)
.- Specified by:
dropCatalog
in interfaceSupportsCatalogs
- Parameters:
catalogName
- The identifier of the catalog.force
- Whether to force the drop.- Returns:
- True if the catalog was dropped, false if the catalog does not exist.
- Throws:
NonEmptyEntityException
- If the catalog is not empty and force is false.CatalogInUseException
- If the catalog is in use and force is false.
-
enableCatalog
Description copied from interface:SupportsCatalogs
Enable a catalog. If the catalog is already enabled, this method does nothing.- Specified by:
enableCatalog
in interfaceSupportsCatalogs
- Parameters:
catalogName
- The identifier of the catalog.- Throws:
NoSuchCatalogException
- If the catalog does not exist.
-
disableCatalog
Description copied from interface:SupportsCatalogs
Disable a catalog. If the catalog is already disabled, this method does nothing. Once a catalog is disabled:- It can only be listed, loaded, dropped, or disable.
- Any other operations on the catalog will throw an
CatalogNotInUseException
. - Any operation on the sub-entities (schemas, tables, etc.) will throw an
CatalogNotInUseException
.
- Specified by:
disableCatalog
in interfaceSupportsCatalogs
- Parameters:
catalogName
- The identifier of the catalog.- Throws:
NoSuchCatalogException
- If the catalog does not exist.
-
addUser
Adds a new User.- Parameters:
user
- The name of the User.- Returns:
- The added User instance.
- Throws:
UserAlreadyExistsException
- If a User with the same name already exists.NoSuchMetalakeException
- If the Metalake with the given name does not exist.RuntimeException
- If adding the User encounters storage issues.
-
removeUser
Removes a User.- Parameters:
user
- The name of the User.- Returns:
- True if the User was successfully removed, false only when there's no such user, otherwise it will throw an exception.
- Throws:
NoSuchMetalakeException
- If the Metalake with the given name does not exist.RuntimeException
- If removing the User encounters storage issues.
-
getUser
Gets a User.- Parameters:
user
- The name of the User.- Returns:
- The getting User instance.
- Throws:
NoSuchUserException
- If the User with the given name does not exist.NoSuchMetalakeException
- If the Metalake with the given name does not exist.RuntimeException
- If getting the User encounters storage issues.
-
listUsers
Lists the users.- Returns:
- The User list.
- Throws:
NoSuchMetalakeException
- If the Metalake with the given name does not exist.
-
listUserNames
Lists the usernames.- Returns:
- The username list.
- Throws:
NoSuchMetalakeException
- If the Metalake with the given name does not exist.
-
addGroup
Adds a new Group.- Parameters:
group
- The name of the Group.- Returns:
- The Added Group instance.
- Throws:
GroupAlreadyExistsException
- If a Group with the same name already exists.NoSuchMetalakeException
- If the Metalake with the given name does not exist.RuntimeException
- If adding the Group encounters storage issues.
-
removeGroup
Removes a Group.- Parameters:
group
- THe name of the Group.- Returns:
- True if the Group was successfully removed, false only when there's no such group, otherwise it will throw an exception.
- Throws:
NoSuchMetalakeException
- If the Metalake with the given name does not exist.RuntimeException
- If removing the Group encounters storage issues.
-
getGroup
Gets a Group.- Parameters:
group
- The name of the Group.- Returns:
- The getting Group instance.
- Throws:
NoSuchGroupException
- If the Group with the given name does not exist.NoSuchMetalakeException
- If the Metalake with the given name does not exist.RuntimeException
- If getting the Group encounters storage issues.
-
listGroups
List the groups.- Returns:
- The Group list
- Throws:
NoSuchMetalakeException
- If the Metalake with the given name does not exist.
-
listGroupNames
List the group names.- Returns:
- The group names list.
- Throws:
NoSuchMetalakeException
- If the Metalake with the given name does not exist.
-
getRole
Gets a Role.- Parameters:
role
- The name of the Role.- Returns:
- The getting Role instance.
- Throws:
NoSuchRoleException
- If the Role with the given name does not exist.NoSuchMetalakeException
- If the Metalake with the given name does not exist.RuntimeException
- If getting the Role encounters storage issues.
-
deleteRole
Deletes a Role.- Parameters:
role
- The name of the Role.- Returns:
- True if the Role was successfully deleted, false only when there's no such role, otherwise it will throw an exception.
- Throws:
NoSuchMetalakeException
- If the Metalake with the given name does not exist.RuntimeException
- If deleting the Role encounters storage issues.
-
createRole
public Role createRole(String role, Map<String, String> properties, List<SecurableObject> securableObjects) throws RoleAlreadyExistsException, NoSuchMetalakeException, IllegalMetadataObjectExceptionCreates a new Role.- Parameters:
role
- The name of the Role.properties
- The properties of the Role.securableObjects
- The securable objects of the Role.- Returns:
- The created Role instance.
- Throws:
RoleAlreadyExistsException
- If a Role with the same name already exists.NoSuchMetalakeException
- If the Metalake with the given name does not exist.IllegalMetadataObjectException
- If securable object is invalidRuntimeException
- If creating the Role encounters storage issues.
-
grantRolesToUser
public User grantRolesToUser(List<String> roles, String user) throws NoSuchUserException, IllegalRoleException, NoSuchMetalakeException Grant roles to a user.- Parameters:
user
- The name of the User.roles
- The names of the Role.- Returns:
- The Group after granted.
- Throws:
NoSuchUserException
- If the User with the given name does not exist.IllegalRoleException
- If the Role with the given name is invalid.NoSuchMetalakeException
- If the Metalake with the given name does not exist.RuntimeException
- If granting roles to a user encounters storage issues.
-
grantRolesToGroup
public Group grantRolesToGroup(List<String> roles, String group) throws NoSuchGroupException, IllegalRoleException, NoSuchMetalakeException Grant roles to a group.- Parameters:
group
- The name of the Group.roles
- The names of the Role.- Returns:
- The Group after granted.
- Throws:
NoSuchGroupException
- If the Group with the given name does not exist.IllegalRoleException
- If the Role with the given name is invalid.NoSuchMetalakeException
- If the Metalake with the given name does not exist.RuntimeException
- If granting roles to a group encounters storage issues.
-
revokeRolesFromUser
public User revokeRolesFromUser(List<String> roles, String user) throws NoSuchUserException, IllegalRoleException, NoSuchMetalakeException Revoke roles from a user.- Parameters:
user
- The name of the User.roles
- The names of the Role.- Returns:
- The User after revoked.
- Throws:
NoSuchUserException
- If the User with the given name does not exist.IllegalRoleException
- If the Role with the given name is invalid.NoSuchMetalakeException
- If the Metalake with the given name does not exist.RuntimeException
- If revoking roles from a user encounters storage issues.
-
revokeRolesFromGroup
public Group revokeRolesFromGroup(List<String> roles, String group) throws NoSuchGroupException, IllegalRoleException, NoSuchMetalakeException Revoke roles from a group.- Parameters:
group
- The name of the Group.roles
- The names of the Role.- Returns:
- The Group after revoked.
- Throws:
NoSuchGroupException
- If the Group with the given name does not exist.IllegalRoleException
- If the Role with the given name is invalid.NoSuchMetalakeException
- If the Metalake with the given name does not exist.RuntimeException
- If revoking roles from a group encounters storage issues.
-
getOwner
Get the owner of a metadata object.- Parameters:
object
- The metadata object- Returns:
- The owner of the metadata object. If the metadata object doesn't set the owner, it will return Optional.empty().
- Throws:
NoSuchMetadataObjectException
- If the metadata object is not found.
-
setOwner
public void setOwner(MetadataObject object, String ownerName, Owner.Type ownerType) throws NotFoundException Set the owner of a metadata object.- Parameters:
object
- The metadata object.ownerName
- The name of the ownerownerType
- The type of the owner, The owner can be a user or a group.- Throws:
NotFoundException
- If the metadata object isn't found or the owner doesn't exist.
-
listRoleNames
Lists the role names.- Returns:
- The role name list.
- Throws:
NoSuchMetalakeException
- If the Metalake with the given name does not exist.
-
grantPrivilegesToRole
@Deprecated public Role grantPrivilegesToRole(String role, MetadataObject object, List<Privilege> privileges) throws NoSuchRoleException, NoSuchMetadataObjectException, NoSuchMetalakeException, IllegalPrivilegeException Deprecated.usegrantPrivilegesToRole(String, MetadataObject, Set)
instead.Grant privileges to a role.- Parameters:
role
- The name of the role.privileges
- The privileges to grant.object
- The object is associated with privileges to grant.- Returns:
- The role after granted.
- Throws:
NoSuchRoleException
- If the role with the given name does not exist.NoSuchMetadataObjectException
- If the metadata object with the given name does not exist.NoSuchMetalakeException
- If the Metalake with the given name does not exist.IllegalPrivilegeException
- If any privilege can't be bind to the metadata object.RuntimeException
- If granting roles to a role encounters storage issues.
-
grantPrivilegesToRole
public Role grantPrivilegesToRole(String role, MetadataObject object, Set<Privilege> privileges) throws NoSuchRoleException, NoSuchMetadataObjectException, NoSuchMetalakeException, IllegalPrivilegeException Grant privileges to a role.- Parameters:
role
- The name of the role.privileges
- The privileges to grant.object
- The object is associated with privileges to grant.- Returns:
- The role after granted.
- Throws:
NoSuchRoleException
- If the role with the given name does not exist.NoSuchMetadataObjectException
- If the metadata object with the given name does not exist.NoSuchMetalakeException
- If the Metalake with the given name does not exist.IllegalPrivilegeException
- If any privilege can't be bind to the metadata object.RuntimeException
- If granting roles to a role encounters storage issues.
-
revokePrivilegesFromRole
@Deprecated public Role revokePrivilegesFromRole(String role, MetadataObject object, List<Privilege> privileges) throws NoSuchRoleException, NoSuchMetadataObjectException, NoSuchMetalakeException, IllegalPrivilegeException Deprecated.Revoke privileges from a role.- Parameters:
role
- The name of the role.privileges
- The privileges to revoke.object
- The object is associated with privileges to revoke.- Returns:
- The role after revoked.
- Throws:
NoSuchRoleException
- If the role with the given name does not exist.NoSuchMetadataObjectException
- If the metadata object with the given name does not exist.NoSuchMetalakeException
- If the Metalake with the given name does not exist.IllegalPrivilegeException
- If any privilege can't be bind to the metadata object.RuntimeException
- If revoking privileges from a role encounters storage issues.
-
revokePrivilegesFromRole
public Role revokePrivilegesFromRole(String role, MetadataObject object, Set<Privilege> privileges) throws NoSuchRoleException, NoSuchMetadataObjectException, NoSuchMetalakeException, IllegalPrivilegeException Revoke privileges from a role.- Parameters:
role
- The name of the role.privileges
- The privileges to revoke.object
- The object is associated with privileges to revoke.- Returns:
- The role after revoked.
- Throws:
NoSuchRoleException
- If the role with the given name does not exist.NoSuchMetadataObjectException
- If the metadata object with the given name does not exist.NoSuchMetalakeException
- If the Metalake with the given name does not exist.IllegalPrivilegeException
- If any privilege can't be bind to the metadata object.RuntimeException
- If revoking privileges from a role encounters storage issues.
-
builder
Creates a new builder for constructing a GravitinoClient.- Parameters:
uri
- The base URI for the Gravitino API.- Returns:
- A new instance of the Builder class for constructing a GravitinoClient.
-
testConnection
public void testConnection(String catalogName, Catalog.Type type, String provider, String comment, Map<String, String> properties) throws ExceptionTest whether a catalog can be created successfully with the specified parameters, without actually creating it.- Specified by:
testConnection
in interfaceSupportsCatalogs
- Parameters:
catalogName
- the name of the catalog.type
- the type of the catalog.provider
- the provider of the catalog.comment
- the comment of the catalog.properties
- the properties of the catalog.- Throws:
Exception
- if the test failed.
-
listTags
Description copied from interface:TagOperations
List all the tag names under a metalake.- Specified by:
listTags
in interfaceTagOperations
- Returns:
- The list of tag names.
- Throws:
NoSuchMetalakeException
- If the metalake does not exist.
-
listTagsInfo
Description copied from interface:TagOperations
List all the tags with detailed information under a metalake.- Specified by:
listTagsInfo
in interfaceTagOperations
- Returns:
- The list of tags.
- Throws:
NoSuchMetalakeException
- If the metalake does not exist.
-
getTag
Description copied from interface:TagOperations
Get a tag by its name under a metalake.- Specified by:
getTag
in interfaceTagOperations
- Parameters:
name
- The name of the tag.- Returns:
- The tag.
- Throws:
NoSuchTagException
- If the tag does not exist.
-
createTag
public Tag createTag(String name, String comment, Map<String, String> properties) throws TagAlreadyExistsExceptionDescription copied from interface:TagOperations
Create a tag under a metalake.- Specified by:
createTag
in interfaceTagOperations
- Parameters:
name
- The name of the tag.comment
- The comment of the tag.properties
- The properties of the tag.- Returns:
- The created tag.
- Throws:
TagAlreadyExistsException
- If the tag already exists.
-
alterTag
public Tag alterTag(String name, TagChange... changes) throws NoSuchTagException, IllegalArgumentException Description copied from interface:TagOperations
Alter a tag under a metalake.- Specified by:
alterTag
in interfaceTagOperations
- Parameters:
name
- The name of the tag.changes
- The changes to apply to the tag.- Returns:
- The altered tag.
- Throws:
NoSuchTagException
- If the tag does not exist.IllegalArgumentException
- If the changes cannot be applied to the tag.
-
deleteTag
Description copied from interface:TagOperations
Delete a tag under a metalake.- Specified by:
deleteTag
in interfaceTagOperations
- Parameters:
name
- The name of the tag.- Returns:
- True if the tag is deleted, false if the tag does not exist.
-
listJobTemplates
Description copied from interface:SupportsJobs
Lists all the registered job templates in Gravitino.- Specified by:
listJobTemplates
in interfaceSupportsJobs
- Returns:
- a list of job templates
-
registerJobTemplate
Description copied from interface:SupportsJobs
Register a job template with the specified job template to Gravitino. The registered job template will be maintained in Gravitino, allowing it to be executed later.- Specified by:
registerJobTemplate
in interfaceSupportsJobs
- Parameters:
jobTemplate
- the template for the job- Throws:
JobTemplateAlreadyExistsException
- if a job template with the same name already exists
-
getJobTemplate
Description copied from interface:SupportsJobs
Retrieves a job template by its name.- Specified by:
getJobTemplate
in interfaceSupportsJobs
- Parameters:
jobTemplateName
- the name of the job template to retrieve- Returns:
- the job template associated with the specified name
- Throws:
NoSuchJobTemplateException
- if no job template with the specified name exists
-
deleteJobTemplate
Description copied from interface:SupportsJobs
Deletes a job template by its name. This will remove the job template from Gravitino, and it will no longer be available for execution. Only when all the jobs associated with this job template are completed, failed, or cancelled, the job template can be deleted successfully, otherwise it will throw an exception.The deletion of a job template will also delete all the jobs associated with this template.
- Specified by:
deleteJobTemplate
in interfaceSupportsJobs
- Parameters:
jobTemplateName
- the name of the job template to delete- Returns:
- true if the job template was successfully deleted, false if the job template does not exist
- Throws:
InUseException
- if there are still queued or started jobs associated with the job template
-
listJobs
Description copied from interface:SupportsJobs
Lists all the jobs by the specified job template name. This will return a list of job handles associated with the specified job template. Each job handle represents a specific job.- Specified by:
listJobs
in interfaceSupportsJobs
- Parameters:
jobTemplateName
- the name of the job template to list jobs for- Returns:
- a list of job handles associated with the specified job template
- Throws:
NoSuchJobTemplateException
- if no job template with the specified name exists
-
listJobs
Description copied from interface:SupportsJobs
Lists all the jobs in Gravitino. This will return a list of all job handles, regardless of the job template they are associated with.- Specified by:
listJobs
in interfaceSupportsJobs
- Returns:
- a list of all job handles in Gravitino
-
runJob
public JobHandle runJob(String jobTemplateName, Map<String, String> jobConf) throws NoSuchJobTemplateExceptionDescription copied from interface:SupportsJobs
Run a job with the template name and configuration. The jobConf is a map of key-value contains the variables that will be used to replace the templated parameters in the job template.- Specified by:
runJob
in interfaceSupportsJobs
- Parameters:
jobTemplateName
- the name of the job template to runjobConf
- the configuration for the job- Returns:
- a handle to the run job
- Throws:
NoSuchJobTemplateException
- if no job template with the specified name exists
-
getJob
Description copied from interface:SupportsJobs
Retrieves a job by its ID.- Specified by:
getJob
in interfaceSupportsJobs
- Parameters:
jobId
- the ID of the job to retrieve- Returns:
- a handle to the job
- Throws:
NoSuchJobException
- if the job with the specified ID does not exist
-
cancelJob
Description copied from interface:SupportsJobs
Cancel a job by its ID. This operation will attempt to cancel the job if it is still running. This method will return immediately, user could use the job handle to check the status of the job after invoking this method.- Specified by:
cancelJob
in interfaceSupportsJobs
- Parameters:
jobId
- the ID of the job to cancel- Returns:
- a handle to the cancelled job
- Throws:
NoSuchJobException
- if the job with the specified ID does not exist
-
listPolicies
Description copied from interface:PolicyOperations
List all the policy names under a metalake.- Specified by:
listPolicies
in interfacePolicyOperations
- Returns:
- The list of policy names.
- Throws:
NoSuchMetalakeException
- If the metalake does not exist.
-
listPolicyInfos
Description copied from interface:PolicyOperations
List all the policies with detailed information under a metalake.- Specified by:
listPolicyInfos
in interfacePolicyOperations
- Returns:
- The list of policies.
- Throws:
NoSuchMetalakeException
- If the metalake does not exist.
-
getPolicy
Description copied from interface:PolicyOperations
Get a policy by its name under a metalake.- Specified by:
getPolicy
in interfacePolicyOperations
- Parameters:
name
- The name of the policy.- Returns:
- The policy.
- Throws:
NoSuchPolicyException
- If the policy does not exist.
-
createPolicy
public Policy createPolicy(String name, String type, String comment, boolean enabled, PolicyContent content) throws PolicyAlreadyExistsException Description copied from interface:PolicyOperations
Create a policy under a metalake.- Specified by:
createPolicy
in interfacePolicyOperations
- 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
Description copied from interface:PolicyOperations
Enable a policy under a metalake. If the policy is already enabled, this method does nothing.- Specified by:
enablePolicy
in interfacePolicyOperations
- Parameters:
name
- The name of the policy to enable.- Throws:
NoSuchPolicyException
- If the policy does not exist.
-
disablePolicy
Description copied from interface:PolicyOperations
Disable a policy under a metalake. If the policy is already disabled, this method does nothing.- Specified by:
disablePolicy
in interfacePolicyOperations
- Parameters:
name
- The name of the policy to disable.- Throws:
NoSuchPolicyException
- If the policy does not exist.
-
alterPolicy
public Policy alterPolicy(String name, PolicyChange... changes) throws NoSuchPolicyException, IllegalArgumentException Description copied from interface:PolicyOperations
Alter a policy under a metalake.- Specified by:
alterPolicy
in interfacePolicyOperations
- 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
Description copied from interface:PolicyOperations
Delete a policy under a metalake.- Specified by:
deletePolicy
in interfacePolicyOperations
- Parameters:
name
- The name of the policy.- Returns:
- True if the policy is deleted, false if the policy does not exist.
-
grantPrivilegesToRole(String, MetadataObject, Set)
instead.