public class GravitinoMetalake extends MetalakeDTO implements SupportsCatalogs, TagOperations, SupportsRoles
GravitinoMetalake, users can list,
create, load, alter and drop a catalog with specified identifier.PROPERTY_IN_USE| Modifier and Type | Method and Description |
|---|---|
Group |
addGroup(java.lang.String group)
Adds a new Group.
|
User |
addUser(java.lang.String user)
Adds a new User.
|
Catalog |
alterCatalog(java.lang.String catalogName,
CatalogChange... changes)
Alter the catalog with specified identifier by applying the changes.
|
Tag |
alterTag(java.lang.String name,
TagChange... changes)
Alter a tag under the current metalake.
|
static org.apache.gravitino.client.GravitinoMetalake.Builder |
builder() |
Catalog |
createCatalog(java.lang.String catalogName,
Catalog.Type type,
java.lang.String provider,
java.lang.String comment,
java.util.Map<java.lang.String,java.lang.String> properties)
Create a new catalog with specified identifier, type, comment and properties.
|
Role |
createRole(java.lang.String role,
java.util.Map<java.lang.String,java.lang.String> properties,
java.util.List<SecurableObject> securableObjects)
Creates a new Role.
|
Tag |
createTag(java.lang.String name,
java.lang.String comment,
java.util.Map<java.lang.String,java.lang.String> properties)
Create a tag under the current metalake.
|
boolean |
deleteRole(java.lang.String role)
Deletes a Role.
|
boolean |
deleteTag(java.lang.String name)
Delete a tag under the current metalake.
|
void |
disableCatalog(java.lang.String catalogName)
Disable a catalog.
|
boolean |
dropCatalog(java.lang.String catalogName,
boolean force)
Drop a catalog with specified name.
|
void |
enableCatalog(java.lang.String catalogName)
Enable a catalog.
|
boolean |
equals(java.lang.Object o) |
Group |
getGroup(java.lang.String group)
Gets a Group.
|
java.util.Optional<Owner> |
getOwner(MetadataObject object)
Get the owner of a metadata object.
|
Role |
getRole(java.lang.String role)
Gets a Role.
|
Tag |
getTag(java.lang.String name)
Get a tag by its name under the current metalake.
|
User |
getUser(java.lang.String user)
Gets a User.
|
Role |
grantPrivilegesToRole(java.lang.String role,
MetadataObject object,
java.util.List<Privilege> privileges)
Grant privileges to a role.
|
Role |
grantPrivilegesToRole(java.lang.String role,
MetadataObject object,
java.util.Set<Privilege> privileges)
Grant privileges to a role.
|
Group |
grantRolesToGroup(java.util.List<java.lang.String> roles,
java.lang.String group)
Grant roles to a group.
|
User |
grantRolesToUser(java.util.List<java.lang.String> roles,
java.lang.String user)
Grant roles to a user.
|
java.lang.String[] |
listBindingRoleNames()
List all the role names associated with this metadata object.
|
java.lang.String[] |
listCatalogs()
List all the catalogs under this metalake.
|
Catalog[] |
listCatalogsInfo()
List all the catalogs with their information under this metalake.
|
java.lang.String[] |
listGroupNames()
Lists the group names
|
Group[] |
listGroups()
Lists the groups
|
java.lang.String[] |
listRoleNames()
Lists the role names.
|
java.lang.String[] |
listTags()
List all the tag names under a metalake.
|
Tag[] |
listTagsInfo()
List all the tags with detailed information under the current metalake.
|
java.lang.String[] |
listUserNames()
Lists the usernames.
|
User[] |
listUsers()
Lists the users.
|
Catalog |
loadCatalog(java.lang.String catalogName)
Load the catalog with specified identifier.
|
boolean |
removeGroup(java.lang.String group)
Removes a Group.
|
boolean |
removeUser(java.lang.String user)
Removes a User.
|
Role |
revokePrivilegesFromRole(java.lang.String role,
MetadataObject object,
java.util.List<Privilege> privileges)
Deprecated.
|
Role |
revokePrivilegesFromRole(java.lang.String role,
MetadataObject object,
java.util.Set<Privilege> privileges)
Revoke privileges from a role.
|
Group |
revokeRolesFromGroup(java.util.List<java.lang.String> roles,
java.lang.String group)
Revoke roles from a group.
|
User |
revokeRolesFromUser(java.util.List<java.lang.String> roles,
java.lang.String user)
Revoke roles from a user.
|
void |
setOwner(MetadataObject object,
java.lang.String ownerName,
Owner.Type ownerType)
Set the owner of a metadata object.
|
SupportsRoles |
supportsRoles() |
void |
testConnection(java.lang.String catalogName,
Catalog.Type type,
java.lang.String provider,
java.lang.String comment,
java.util.Map<java.lang.String,java.lang.String> properties)
Test whether a catalog can be created successfully with the specified parameters, without
actually creating it.
|
auditInfo, comment, hashCode, name, propertiesclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitcatalogExists, createCatalog, dropCatalogpublic java.lang.String[] listCatalogs()
throws NoSuchMetalakeException
listCatalogs in interface SupportsCatalogsNoSuchMetalakeException - If the metalake does not exist.public Catalog[] listCatalogsInfo() throws NoSuchMetalakeException
listCatalogsInfo in interface SupportsCatalogsCatalog under the specified namespace.NoSuchMetalakeException - if the metalake with specified namespace does not exist.public Catalog loadCatalog(java.lang.String catalogName) throws NoSuchCatalogException
loadCatalog in interface SupportsCatalogscatalogName - The identifier of the catalog to load.Catalog with specified identifier.NoSuchCatalogException - if the catalog with specified identifier does not exist.public Catalog createCatalog(java.lang.String catalogName, Catalog.Type type, java.lang.String provider, java.lang.String comment, java.util.Map<java.lang.String,java.lang.String> properties) throws NoSuchMetalakeException, CatalogAlreadyExistsException
createCatalog in interface SupportsCatalogscatalogName - The identifier 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.Catalog.NoSuchMetalakeException - if the metalake with specified namespace does not exist.CatalogAlreadyExistsException - if the catalog with specified identifier already exists.public Catalog alterCatalog(java.lang.String catalogName, CatalogChange... changes) throws NoSuchCatalogException, java.lang.IllegalArgumentException
alterCatalog in interface SupportsCatalogscatalogName - the identifier of the catalog.changes - the changes to apply to the catalog.Catalog.NoSuchCatalogException - if the catalog with specified identifier does not exist.java.lang.IllegalArgumentException - if the changes are invalid.public boolean dropCatalog(java.lang.String catalogName,
boolean force)
throws NonEmptyEntityException,
CatalogInUseException
dropCatalog in interface SupportsCatalogscatalogName - The identifier of the catalog.force - Whether to force the drop.NonEmptyEntityException - If the catalog is not empty and force is false.CatalogInUseException - If the catalog is in use and force is false.public void enableCatalog(java.lang.String catalogName)
throws NoSuchCatalogException
SupportsCatalogsenableCatalog in interface SupportsCatalogscatalogName - The identifier of the catalog.NoSuchCatalogException - If the catalog does not exist.public void disableCatalog(java.lang.String catalogName)
throws NoSuchCatalogException
SupportsCatalogsCatalogNotInUseException.
CatalogNotInUseException.
disableCatalog in interface SupportsCatalogscatalogName - The identifier of the catalog.NoSuchCatalogException - If the catalog does not exist.public void testConnection(java.lang.String catalogName,
Catalog.Type type,
java.lang.String provider,
java.lang.String comment,
java.util.Map<java.lang.String,java.lang.String> properties)
throws java.lang.Exception
testConnection in interface SupportsCatalogscatalogName - 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.java.lang.Exception - if the test failed.public SupportsRoles supportsRoles()
supportsRoles in interface MetalakeSupportsRoles if the metalake supports role operations.public java.lang.String[] listTags()
throws NoSuchMetalakeException
listTags in interface TagOperationsNoSuchMetalakeException - If the metalake does not exist.public Tag[] listTagsInfo() throws NoSuchMetalakeException
listTagsInfo in interface TagOperationsTag under the current metalake.NoSuchMetalakeException - If the metalake does not exist.public Tag getTag(java.lang.String name) throws NoSuchTagException
getTag in interface TagOperationsname - The name of the tag.NoSuchTagException - If the tag does not exist.public Tag createTag(java.lang.String name, java.lang.String comment, java.util.Map<java.lang.String,java.lang.String> properties) throws TagAlreadyExistsException
createTag in interface TagOperationsname - The name of the tag.comment - The comment of the tag.properties - The properties of the tag.TagAlreadyExistsException - If the tag already exists.public Tag alterTag(java.lang.String name, TagChange... changes) throws NoSuchTagException, java.lang.IllegalArgumentException
alterTag in interface TagOperationsname - The name of the tag.changes - The changes to apply to the tag.NoSuchTagException - If the tag does not exist.java.lang.IllegalArgumentException - If the changes cannot be applied to the tag.public boolean deleteTag(java.lang.String name)
deleteTag in interface TagOperationsname - The name of the tag.public User addUser(java.lang.String user) throws UserAlreadyExistsException, NoSuchMetalakeException
user - The name of the User.UserAlreadyExistsException - If a User with the same name already exists.NoSuchMetalakeException - If the Metalake with the given name does not exist.java.lang.RuntimeException - If adding the User encounters storage issues.public boolean removeUser(java.lang.String user)
throws NoSuchMetalakeException
user - The name of the User.NoSuchMetalakeException - If the Metalake with the given name does not exist.java.lang.RuntimeException - If removing the User encounters storage issues.public User getUser(java.lang.String user) throws NoSuchUserException, NoSuchMetalakeException
user - The name of the User.NoSuchUserException - If the User with the given name does not exist.NoSuchMetalakeException - If the Metalake with the given name does not exist.java.lang.RuntimeException - If getting the User encounters storage issues.public User[] listUsers() throws NoSuchMetalakeException
NoSuchMetalakeException - If the Metalake with the given name does not exist.public java.lang.String[] listUserNames()
throws NoSuchMetalakeException
NoSuchMetalakeException - If the Metalake with the given name does not exist.public Group addGroup(java.lang.String group) throws GroupAlreadyExistsException, NoSuchMetalakeException
group - The name of the Group.GroupAlreadyExistsException - If a Group with the same name already exists.NoSuchMetalakeException - If the Metalake with the given name does not exist.java.lang.RuntimeException - If adding the Group encounters storage issues.public boolean removeGroup(java.lang.String group)
throws NoSuchMetalakeException
group - THe name of the Group.NoSuchMetalakeException - If the Metalake with the given name does not exist.java.lang.RuntimeException - If removing the Group encounters storage issues.public Group getGroup(java.lang.String group) throws NoSuchGroupException, NoSuchMetalakeException
group - The name of the Group.NoSuchGroupException - If the Group with the given name does not exist.NoSuchMetalakeException - If the Metalake with the given name does not exist.java.lang.RuntimeException - If getting the Group encounters storage issues.public Group[] listGroups() throws NoSuchMetalakeException
NoSuchMetalakeException - If the Metalake with the given name does not exist.public java.lang.String[] listGroupNames()
throws NoSuchMetalakeException
NoSuchMetalakeException - If the Metalake with the given name does not exist.public Role getRole(java.lang.String role) throws NoSuchRoleException, NoSuchMetalakeException
role - The name of the Role.NoSuchRoleException - If the Role with the given name does not exist.NoSuchMetalakeException - If the Metalake with the given name does not exist.java.lang.RuntimeException - If getting the Role encounters storage issues.public boolean deleteRole(java.lang.String role)
throws NoSuchMetalakeException
role - The name of the Role.NoSuchMetalakeException - If the Metalake with the given name does not exist.java.lang.RuntimeException - If deleting the Role encounters storage issues.public Role createRole(java.lang.String role, java.util.Map<java.lang.String,java.lang.String> properties, java.util.List<SecurableObject> securableObjects) throws RoleAlreadyExistsException, NoSuchMetalakeException, IllegalMetadataObjectException
role - The name of the Role.properties - The properties of the Role.securableObjects - The securable objects of the Role.RoleAlreadyExistsException - If a Role with the same name already exists.NoSuchMetalakeException - If the Metalake with the given name does not exist.IllegalMetadataObjectException - If the securable object is invalidjava.lang.RuntimeException - If creating the Role encounters storage issues.public java.lang.String[] listRoleNames()
NoSuchMetalakeException - If the Metalake with the given name does not exist.public User grantRolesToUser(java.util.List<java.lang.String> roles, java.lang.String user) throws NoSuchUserException, IllegalRoleException, NoSuchMetalakeException
user - The name of the User.roles - The names of the Role.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.java.lang.RuntimeException - If granting roles to a user encounters storage issues.public Group grantRolesToGroup(java.util.List<java.lang.String> roles, java.lang.String group) throws NoSuchGroupException, NoSuchRoleException, NoSuchMetalakeException
group - The name of the Group.roles - The names of the Role.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.java.lang.RuntimeException - If granting roles to a group encounters storage issues.NoSuchRoleExceptionpublic User revokeRolesFromUser(java.util.List<java.lang.String> roles, java.lang.String user) throws NoSuchUserException, NoSuchRoleException, NoSuchMetalakeException
user - The name of the User.roles - The names of the Role.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.java.lang.RuntimeException - If revoking roles from a user encounters storage issues.NoSuchRoleExceptionpublic Group revokeRolesFromGroup(java.util.List<java.lang.String> roles, java.lang.String group) throws NoSuchGroupException, IllegalRoleException, NoSuchMetalakeException
group - The name of the Group.roles - The names of the Role.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.java.lang.RuntimeException - If revoking roles from a group encounters storage issues.public Role grantPrivilegesToRole(java.lang.String role, MetadataObject object, java.util.List<Privilege> privileges) throws NoSuchRoleException, NoSuchMetadataObjectException, NoSuchMetalakeException, IllegalPrivilegeException
role - The name of the role.privileges - The privileges to grant.object - The object is associated with privileges to grant.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.java.lang.RuntimeException - If granting privileges to a role encounters storage issues.public Role grantPrivilegesToRole(java.lang.String role, MetadataObject object, java.util.Set<Privilege> privileges) throws NoSuchRoleException, NoSuchMetadataObjectException, NoSuchMetalakeException, IllegalPrivilegeException
role - The name of the role.privileges - The privileges to grant.object - The object is associated with privileges to grant.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.java.lang.RuntimeException - If granting privileges to a role encounters storage issues.@Deprecated public Role revokePrivilegesFromRole(java.lang.String role, MetadataObject object, java.util.List<Privilege> privileges) throws NoSuchRoleException, NoSuchMetadataObjectException, NoSuchMetalakeException, IllegalPrivilegeException
role - The name of the role.privileges - The privileges to revoke.object - The object is associated with privileges to revoke.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.java.lang.RuntimeException - If revoking privileges from a role encounters storage issues.public Role revokePrivilegesFromRole(java.lang.String role, MetadataObject object, java.util.Set<Privilege> privileges) throws NoSuchRoleException, NoSuchMetadataObjectException, NoSuchMetalakeException, IllegalPrivilegeException
role - The name of the role.privileges - The privileges to revoke.object - The object is associated with privileges to revoke.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.java.lang.RuntimeException - If revoking privileges from a role encounters storage issues.public java.util.Optional<Owner> getOwner(MetadataObject object) throws NoSuchMetadataObjectException
object - The metadata objectNoSuchMetadataObjectException - If the metadata object is not found.public void setOwner(MetadataObject object, java.lang.String ownerName, Owner.Type ownerType) throws NotFoundException
object - The metadata object.ownerName - The name of the ownerownerType - The type of the owner, The owner can be a user or a group.NotFoundException - If the metadata object isn't found or the owner doesn't exist.public java.lang.String[] listBindingRoleNames()
SupportsRoleslistBindingRoleNames in interface SupportsRolespublic boolean equals(java.lang.Object o)
equals in class MetalakeDTOpublic static org.apache.gravitino.client.GravitinoMetalake.Builder builder()