org.apache.hadoop.hive.metastore.api.Role Java Examples

The following examples show how to use org.apache.hadoop.hive.metastore.api.Role. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GlueMetastoreClientDelegate.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 5 votes vote down vote up
public List<org.apache.hadoop.hive.metastore.api.Role> listRoles(
    String principalName,
    org.apache.hadoop.hive.metastore.api.PrincipalType principalType
) throws TException {
  // All users belong to public role implicitly, add that role
  // Bring logic from Hive's ObjectStore
  // https://code.amazon.com/packages/Aws157Hive/blobs/48f6e30080df475ffe54c39f70dd134268e30358/
  // --/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java#L4208
  if (principalType == PrincipalType.USER) {
    return implicitRoles;
  } else {
    throw new UnsupportedOperationException(
        "listRoles is only supported for " + PrincipalType.USER + " Principal type");
  }
}
 
Example #2
Source File: AWSCatalogMetastoreClientTest.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 5 votes vote down vote up
@Test
public void testListRoles() throws Exception {
  List<Role> results = metastoreClient.list_roles("user", PrincipalType.USER);

  assertEquals(results.size(), 1);
  assertEquals(results.get(0).getRoleName(), PUBLIC);
}
 
Example #3
Source File: ThriftHiveMetastoreClient.java    From presto with Apache License 2.0 5 votes vote down vote up
@Override
public void createRole(String roleName, String grantor)
        throws TException
{
    Role role = new Role(roleName, 0, grantor);
    client.create_role(role);
}
 
Example #4
Source File: GlueMetastoreClientDelegate.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 4 votes vote down vote up
public boolean createRole(org.apache.hadoop.hive.metastore.api.Role role) throws TException {
  throw new UnsupportedOperationException("createRole is not supported");
}
 
Example #5
Source File: TestObjects.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 4 votes vote down vote up
public static Role getTestRole() {
  Role role = new Role();
  role.setRoleName("test-role");
  role.setOwnerName("owner");
  return role;
}
 
Example #6
Source File: AWSCatalogMetastoreClientTest.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 4 votes vote down vote up
@Test(expected=UnsupportedOperationException.class)
public void testCreateRole() throws Exception {
  metastoreClient.create_role(new org.apache.hadoop.hive.metastore.api.Role(
      "role", (int) (new Date().getTime() / 1000), "owner"));
}
 
Example #7
Source File: AWSCatalogMetastoreClientTest.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 4 votes vote down vote up
@Test(expected=UnsupportedOperationException.class)
public void testCreatePublicRole() throws Exception {
  metastoreClient.create_role(new org.apache.hadoop.hive.metastore.api.Role(
      "public", (int) (new Date().getTime() / 1000), "owner"));
}
 
Example #8
Source File: FailureAwareThriftMetastoreClient.java    From presto with Apache License 2.0 4 votes vote down vote up
@Override
public List<Role> listRoles(String principalName, PrincipalType principalType)
        throws TException
{
    return runWithHandle(() -> delegate.listRoles(principalName, principalType));
}
 
Example #9
Source File: ThriftHiveMetastoreClient.java    From presto with Apache License 2.0 4 votes vote down vote up
@Override
public List<Role> listRoles(String principalName, PrincipalType principalType)
        throws TException
{
    return client.list_roles(principalName, principalType);
}
 
Example #10
Source File: ThriftMetastoreClient.java    From presto with Apache License 2.0 4 votes vote down vote up
List<Role> listRoles(String principalName, PrincipalType principalType)
throws TException;
 
Example #11
Source File: MockThriftMetastoreClient.java    From presto with Apache License 2.0 4 votes vote down vote up
@Override
public List<Role> listRoles(String principalName, PrincipalType principalType)
{
    throw new UnsupportedOperationException();
}
 
Example #12
Source File: FederatedHMSHandler.java    From waggle-dance with Apache License 2.0 4 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public boolean create_role(Role role) throws MetaException, TException {
  return getPrimaryClient().create_role(role);
}
 
Example #13
Source File: FederatedHMSHandler.java    From waggle-dance with Apache License 2.0 4 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public List<Role> list_roles(String principal_name, PrincipalType principal_type) throws MetaException, TException {
  return getPrimaryClient().list_roles(principal_name, principal_type);
}
 
Example #14
Source File: FederatedHMSHandlerTest.java    From waggle-dance with Apache License 2.0 4 votes vote down vote up
@Test
public void create_role() throws TException {
  Role role = new Role();
  handler.create_role(role);
  verify(primaryClient).create_role(role);
}
 
Example #15
Source File: CatalogThriftHiveMetastore.java    From metacat with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public boolean create_role(final Role role) throws TException {
    throw unimplemented("create_role", new Object[]{role});
}
 
Example #16
Source File: CatalogThriftHiveMetastore.java    From metacat with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public List<Role> list_roles(final String principalName, final PrincipalType principalType) throws TException {
    throw unimplemented("list_roles", new Object[]{principalName, principalType});
}