Java Code Examples for org.apache.hadoop.hive.metastore.api.GrantRevokeRoleRequest#setPrincipalName()

The following examples show how to use org.apache.hadoop.hive.metastore.api.GrantRevokeRoleRequest#setPrincipalName() . 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: ThriftHiveMetastoreClient.java    From presto with Apache License 2.0 6 votes vote down vote up
private void createGrant(String role, String granteeName, PrincipalType granteeType, String grantorName, PrincipalType grantorType, boolean grantOption)
        throws TException
{
    GrantRevokeRoleRequest request = new GrantRevokeRoleRequest();
    request.setRequestType(GrantRevokeType.GRANT);
    request.setRoleName(role);
    request.setPrincipalName(granteeName);
    request.setPrincipalType(granteeType);
    request.setGrantor(grantorName);
    request.setGrantorType(grantorType);
    request.setGrantOption(grantOption);
    GrantRevokeRoleResponse response = client.grant_revoke_role(request);
    if (!response.isSetSuccess()) {
        throw new MetaException("GrantRevokeResponse missing success field");
    }
}
 
Example 2
Source File: ThriftHiveMetastoreClient.java    From presto with Apache License 2.0 5 votes vote down vote up
private void removeGrant(String role, String granteeName, PrincipalType granteeType, boolean grantOption)
        throws TException
{
    GrantRevokeRoleRequest request = new GrantRevokeRoleRequest();
    request.setRequestType(GrantRevokeType.REVOKE);
    request.setRoleName(role);
    request.setPrincipalName(granteeName);
    request.setPrincipalType(granteeType);
    request.setGrantOption(grantOption);
    GrantRevokeRoleResponse response = client.grant_revoke_role(request);
    if (!response.isSetSuccess()) {
        throw new MetaException("GrantRevokeResponse missing success field");
    }
}