HBASE-13620 Bring back the removed VisibilityClient methods and mark them as deprecated.
This commit is contained in:
parent
a7e77821d2
commit
70b5c97903
|
@ -23,10 +23,12 @@ import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.hbase.HConstants;
|
import org.apache.hadoop.hbase.HConstants;
|
||||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.classification.InterfaceStability;
|
import org.apache.hadoop.hbase.classification.InterfaceStability;
|
||||||
import org.apache.hadoop.hbase.client.Connection;
|
import org.apache.hadoop.hbase.client.Connection;
|
||||||
|
import org.apache.hadoop.hbase.client.ConnectionFactory;
|
||||||
import org.apache.hadoop.hbase.client.Table;
|
import org.apache.hadoop.hbase.client.Table;
|
||||||
import org.apache.hadoop.hbase.client.coprocessor.Batch;
|
import org.apache.hadoop.hbase.client.coprocessor.Batch;
|
||||||
import org.apache.hadoop.hbase.ipc.BlockingRpcCallback;
|
import org.apache.hadoop.hbase.ipc.BlockingRpcCallback;
|
||||||
|
@ -52,6 +54,23 @@ import com.google.protobuf.ServiceException;
|
||||||
@InterfaceStability.Evolving
|
@InterfaceStability.Evolving
|
||||||
public class VisibilityClient {
|
public class VisibilityClient {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility method for adding label to the system.
|
||||||
|
*
|
||||||
|
* @param conf
|
||||||
|
* @param label
|
||||||
|
* @return VisibilityLabelsResponse
|
||||||
|
* @throws Throwable
|
||||||
|
* @deprecated Use {@link #addLabel(Connection,String)} instead.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static VisibilityLabelsResponse addLabel(Configuration conf, final String label)
|
||||||
|
throws Throwable {
|
||||||
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
|
return addLabels(connection, new String[] { label });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method for adding label to the system.
|
* Utility method for adding label to the system.
|
||||||
*
|
*
|
||||||
|
@ -65,6 +84,23 @@ public class VisibilityClient {
|
||||||
return addLabels(connection, new String[] { label });
|
return addLabels(connection, new String[] { label });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility method for adding labels to the system.
|
||||||
|
*
|
||||||
|
* @param conf
|
||||||
|
* @param labels
|
||||||
|
* @return VisibilityLabelsResponse
|
||||||
|
* @throws Throwable
|
||||||
|
* @deprecated Use {@link #addLabels(Connection,String[])} instead.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static VisibilityLabelsResponse addLabels(Configuration conf, final String[] labels)
|
||||||
|
throws Throwable {
|
||||||
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
|
return addLabels(connection, labels);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method for adding labels to the system.
|
* Utility method for adding labels to the system.
|
||||||
*
|
*
|
||||||
|
@ -109,6 +145,23 @@ public class VisibilityClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets given labels globally authorized for the user.
|
||||||
|
* @param conf
|
||||||
|
* @param auths
|
||||||
|
* @param user
|
||||||
|
* @return VisibilityLabelsResponse
|
||||||
|
* @throws Throwable
|
||||||
|
* @deprecated Use {@link #setAuths(Connection,String[],String)} instead.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static VisibilityLabelsResponse setAuths(Configuration conf, final String[] auths,
|
||||||
|
final String user) throws Throwable {
|
||||||
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
|
return setOrClearAuths(connection, auths, user, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets given labels globally authorized for the user.
|
* Sets given labels globally authorized for the user.
|
||||||
* @param connection
|
* @param connection
|
||||||
|
@ -122,6 +175,20 @@ public class VisibilityClient {
|
||||||
return setOrClearAuths(connection, auths, user, true);
|
return setOrClearAuths(connection, auths, user, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param conf
|
||||||
|
* @param user
|
||||||
|
* @return labels, the given user is globally authorized for.
|
||||||
|
* @throws Throwable
|
||||||
|
* @deprecated Use {@link #getAuths(Connection,String)} instead.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static GetAuthsResponse getAuths(Configuration conf, final String user) throws Throwable {
|
||||||
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
|
return getAuths(connection, user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param connection the Connection instance to use.
|
* @param connection the Connection instance to use.
|
||||||
* @param user
|
* @param user
|
||||||
|
@ -156,6 +223,22 @@ public class VisibilityClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the list of visibility labels defined in the system.
|
||||||
|
* @param conf
|
||||||
|
* @param regex The regular expression to filter which labels are returned.
|
||||||
|
* @return labels The list of visibility labels defined in the system.
|
||||||
|
* @throws Throwable
|
||||||
|
* @deprecated Use {@link #listLabels(Connection,String)} instead.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static ListLabelsResponse listLabels(Configuration conf, final String regex)
|
||||||
|
throws Throwable {
|
||||||
|
try(Connection connection = ConnectionFactory.createConnection(conf)){
|
||||||
|
return listLabels(connection, regex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the list of visibility labels defined in the system.
|
* Retrieve the list of visibility labels defined in the system.
|
||||||
* @param connection The Connection instance to use.
|
* @param connection The Connection instance to use.
|
||||||
|
@ -205,6 +288,23 @@ public class VisibilityClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes given labels from user's globally authorized list of labels.
|
||||||
|
* @param conf
|
||||||
|
* @param auths
|
||||||
|
* @param user
|
||||||
|
* @return VisibilityLabelsResponse
|
||||||
|
* @throws Throwable
|
||||||
|
* @deprecated Use {@link #clearAuths(Connection,String[],String)} instead.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static VisibilityLabelsResponse clearAuths(Configuration conf, final String[] auths,
|
||||||
|
final String user) throws Throwable {
|
||||||
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
|
return setOrClearAuths(connection, auths, user, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes given labels from user's globally authorized list of labels.
|
* Removes given labels from user's globally authorized list of labels.
|
||||||
* @param connection
|
* @param connection
|
||||||
|
|
Loading…
Reference in New Issue