public class GravitinoMetalake extends MetalakeDTO implements SupportsCatalogs, TagOperations
GravitinoMetalake
, users can list,
create, load, alter and drop a catalog with specified identifier.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.
|
boolean |
dropCatalog(java.lang.String catalogName)
Drop the catalog with specified identifier.
|
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.
|
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[] |
listCatalogs()
List all the catalogs under this metalake.
|
Catalog[] |
listCatalogsInfo()
List all the catalogs with their information under this metalake.
|
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.
|
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.
|
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.
|
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, properties
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
catalogExists
public java.lang.String[] listCatalogs() throws NoSuchMetalakeException
listCatalogs
in interface SupportsCatalogs
NoSuchMetalakeException
- If the metalake does not exist.public Catalog[] listCatalogsInfo() throws NoSuchMetalakeException
listCatalogsInfo
in interface SupportsCatalogs
Catalog
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 SupportsCatalogs
catalogName
- 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 SupportsCatalogs
catalogName
- 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 SupportsCatalogs
catalogName
- 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)
dropCatalog
in interface SupportsCatalogs
catalogName
- the name of the catalog.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 SupportsCatalogs
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.java.lang.Exception
- if the test failed.public java.lang.String[] listTags() throws NoSuchMetalakeException
TagOperations
listTags
in interface TagOperations
NoSuchMetalakeException
- If the metalake does not exist.public Tag[] listTagsInfo() throws NoSuchMetalakeException
listTagsInfo
in interface TagOperations
Tag
under the current metalake.NoSuchMetalakeException
- If the metalake does not exist.public Tag getTag(java.lang.String name) throws NoSuchTagException
getTag
in interface TagOperations
name
- 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 TagOperations
name
- 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 TagOperations
name
- 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 TagOperations
name
- 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 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 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, NoSuchMetadataObjectException
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.NoSuchMetadataObjectException
- If the securable object doesn't existjava.lang.RuntimeException
- If creating the Role encounters storage issues.public User grantRolesToUser(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.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 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.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 granting roles to a group encounters storage issues.public 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.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 revoking roles from a user encounters storage issues.public Group revokeRolesFromGroup(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.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 revoking roles from a group 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 boolean equals(java.lang.Object o)
equals
in class MetalakeDTO
public static org.apache.gravitino.client.GravitinoMetalake.Builder builder()