SENTRY-2256: Make thrift API changes to get user privileges from Sentry (Sergio Pena, reviewed by Na Li)
Project: http://git-wip-us.apache.org/repos/asf/sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/74f130fe Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/74f130fe Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/74f130fe Branch: refs/heads/master Commit: 74f130fe579f6655b4f33be60408f7f7f359249a Parents: 60f95b3 Author: Sergio Pena <[email protected]> Authored: Mon Jun 4 10:36:00 2018 -0500 Committer: Sergio Pena <[email protected]> Committed: Mon Jun 4 13:43:14 2018 -0500 ---------------------------------------------------------------------- .../api/service/thrift/SentryPolicyService.java | 858 +++++++++++++++++++ .../TListSentryPrivilegesByAuthRequest.java | 205 ++++- .../TListSentryPrivilegesByAuthResponse.java | 233 ++++- .../thrift/TListSentryPrivilegesRequest.java | 114 ++- .../api/service/thrift/TSentryMappingData.java | 220 ++--- .../main/resources/sentry_policy_service.thrift | 24 +- .../thrift/SentryPolicyStoreProcessor.java | 6 + 7 files changed, 1488 insertions(+), 172 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sentry/blob/74f130fe/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/SentryPolicyService.java ---------------------------------------------------------------------- diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/SentryPolicyService.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/SentryPolicyService.java index cc9a682..d456d7f 100644 --- a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/SentryPolicyService.java +++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/SentryPolicyService.java @@ -61,6 +61,8 @@ public class SentryPolicyService { public TListSentryPrivilegesResponse list_sentry_privileges_by_role(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException; + public TListSentryPrivilegesResponse list_sentry_privileges_by_user(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException; + public TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request) throws org.apache.thrift.TException; public TDropPrivilegesResponse drop_sentry_privilege(TDropPrivilegesRequest request) throws org.apache.thrift.TException; @@ -105,6 +107,8 @@ public class SentryPolicyService { public void list_sentry_privileges_by_role(TListSentryPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void list_sentry_privileges_by_user(TListSentryPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void drop_sentry_privilege(TDropPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -398,6 +402,29 @@ public class SentryPolicyService { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_privileges_by_role failed: unknown result"); } + public TListSentryPrivilegesResponse list_sentry_privileges_by_user(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException + { + send_list_sentry_privileges_by_user(request); + return recv_list_sentry_privileges_by_user(); + } + + public void send_list_sentry_privileges_by_user(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException + { + list_sentry_privileges_by_user_args args = new list_sentry_privileges_by_user_args(); + args.setRequest(request); + sendBase("list_sentry_privileges_by_user", args); + } + + public TListSentryPrivilegesResponse recv_list_sentry_privileges_by_user() throws org.apache.thrift.TException + { + list_sentry_privileges_by_user_result result = new list_sentry_privileges_by_user_result(); + receiveBase(result, "list_sentry_privileges_by_user"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_privileges_by_user failed: unknown result"); + } + public TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request) throws org.apache.thrift.TException { send_list_sentry_privileges_for_provider(request); @@ -975,6 +1002,38 @@ public class SentryPolicyService { } } + public void list_sentry_privileges_by_user(TListSentryPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + list_sentry_privileges_by_user_call method_call = new list_sentry_privileges_by_user_call(request, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class list_sentry_privileges_by_user_call extends org.apache.thrift.async.TAsyncMethodCall { + private TListSentryPrivilegesRequest request; + public list_sentry_privileges_by_user_call(TListSentryPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.request = request; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("list_sentry_privileges_by_user", org.apache.thrift.protocol.TMessageType.CALL, 0)); + list_sentry_privileges_by_user_args args = new list_sentry_privileges_by_user_args(); + args.setRequest(request); + args.write(prot); + prot.writeMessageEnd(); + } + + public TListSentryPrivilegesResponse getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_list_sentry_privileges_by_user(); + } + } + public void list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); list_sentry_privileges_for_provider_call method_call = new list_sentry_privileges_for_provider_call(request, resultHandler, this, ___protocolFactory, ___transport); @@ -1287,6 +1346,7 @@ public class SentryPolicyService { processMap.put("list_sentry_roles_by_group", new list_sentry_roles_by_group()); processMap.put("list_sentry_roles_by_user", new list_sentry_roles_by_user()); processMap.put("list_sentry_privileges_by_role", new list_sentry_privileges_by_role()); + processMap.put("list_sentry_privileges_by_user", new list_sentry_privileges_by_user()); processMap.put("list_sentry_privileges_for_provider", new list_sentry_privileges_for_provider()); processMap.put("drop_sentry_privilege", new drop_sentry_privilege()); processMap.put("rename_sentry_privilege", new rename_sentry_privilege()); @@ -1519,6 +1579,26 @@ public class SentryPolicyService { } } + public static class list_sentry_privileges_by_user<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_privileges_by_user_args> { + public list_sentry_privileges_by_user() { + super("list_sentry_privileges_by_user"); + } + + public list_sentry_privileges_by_user_args getEmptyArgsInstance() { + return new list_sentry_privileges_by_user_args(); + } + + protected boolean isOneway() { + return false; + } + + public list_sentry_privileges_by_user_result getResult(I iface, list_sentry_privileges_by_user_args args) throws org.apache.thrift.TException { + list_sentry_privileges_by_user_result result = new list_sentry_privileges_by_user_result(); + result.success = iface.list_sentry_privileges_by_user(args.request); + return result; + } + } + public static class list_sentry_privileges_for_provider<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_privileges_for_provider_args> { public list_sentry_privileges_for_provider() { super("list_sentry_privileges_for_provider"); @@ -1723,6 +1803,7 @@ public class SentryPolicyService { processMap.put("list_sentry_roles_by_group", new list_sentry_roles_by_group()); processMap.put("list_sentry_roles_by_user", new list_sentry_roles_by_user()); processMap.put("list_sentry_privileges_by_role", new list_sentry_privileges_by_role()); + processMap.put("list_sentry_privileges_by_user", new list_sentry_privileges_by_user()); processMap.put("list_sentry_privileges_for_provider", new list_sentry_privileges_for_provider()); processMap.put("drop_sentry_privilege", new drop_sentry_privilege()); processMap.put("rename_sentry_privilege", new rename_sentry_privilege()); @@ -2296,6 +2377,57 @@ public class SentryPolicyService { } } + public static class list_sentry_privileges_by_user<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, list_sentry_privileges_by_user_args, TListSentryPrivilegesResponse> { + public list_sentry_privileges_by_user() { + super("list_sentry_privileges_by_user"); + } + + public list_sentry_privileges_by_user_args getEmptyArgsInstance() { + return new list_sentry_privileges_by_user_args(); + } + + public AsyncMethodCallback<TListSentryPrivilegesResponse> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<TListSentryPrivilegesResponse>() { + public void onComplete(TListSentryPrivilegesResponse o) { + list_sentry_privileges_by_user_result result = new list_sentry_privileges_by_user_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + list_sentry_privileges_by_user_result result = new list_sentry_privileges_by_user_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, list_sentry_privileges_by_user_args args, org.apache.thrift.async.AsyncMethodCallback<TListSentryPrivilegesResponse> resultHandler) throws TException { + iface.list_sentry_privileges_by_user(args.request,resultHandler); + } + } + public static class list_sentry_privileges_for_provider<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, list_sentry_privileges_for_provider_args, TListSentryPrivilegesForProviderResponse> { public list_sentry_privileges_for_provider() { super("list_sentry_privileges_for_provider"); @@ -10743,6 +10875,732 @@ public class SentryPolicyService { } + public static class list_sentry_privileges_by_user_args implements org.apache.thrift.TBase<list_sentry_privileges_by_user_args, list_sentry_privileges_by_user_args._Fields>, java.io.Serializable, Cloneable, Comparable<list_sentry_privileges_by_user_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("list_sentry_privileges_by_user_args"); + + private static final org.apache.thrift.protocol.TField REQUEST_FIELD_DESC = new org.apache.thrift.protocol.TField("request", org.apache.thrift.protocol.TType.STRUCT, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new list_sentry_privileges_by_user_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new list_sentry_privileges_by_user_argsTupleSchemeFactory()); + } + + private TListSentryPrivilegesRequest request; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + REQUEST((short)1, "request"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // REQUEST + return REQUEST; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.REQUEST, new org.apache.thrift.meta_data.FieldMetaData("request", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TListSentryPrivilegesRequest.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(list_sentry_privileges_by_user_args.class, metaDataMap); + } + + public list_sentry_privileges_by_user_args() { + } + + public list_sentry_privileges_by_user_args( + TListSentryPrivilegesRequest request) + { + this(); + this.request = request; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public list_sentry_privileges_by_user_args(list_sentry_privileges_by_user_args other) { + if (other.isSetRequest()) { + this.request = new TListSentryPrivilegesRequest(other.request); + } + } + + public list_sentry_privileges_by_user_args deepCopy() { + return new list_sentry_privileges_by_user_args(this); + } + + @Override + public void clear() { + this.request = null; + } + + public TListSentryPrivilegesRequest getRequest() { + return this.request; + } + + public void setRequest(TListSentryPrivilegesRequest request) { + this.request = request; + } + + public void unsetRequest() { + this.request = null; + } + + /** Returns true if field request is set (has been assigned a value) and false otherwise */ + public boolean isSetRequest() { + return this.request != null; + } + + public void setRequestIsSet(boolean value) { + if (!value) { + this.request = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case REQUEST: + if (value == null) { + unsetRequest(); + } else { + setRequest((TListSentryPrivilegesRequest)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case REQUEST: + return getRequest(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case REQUEST: + return isSetRequest(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof list_sentry_privileges_by_user_args) + return this.equals((list_sentry_privileges_by_user_args)that); + return false; + } + + public boolean equals(list_sentry_privileges_by_user_args that) { + if (that == null) + return false; + + boolean this_present_request = true && this.isSetRequest(); + boolean that_present_request = true && that.isSetRequest(); + if (this_present_request || that_present_request) { + if (!(this_present_request && that_present_request)) + return false; + if (!this.request.equals(that.request)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_request = true && (isSetRequest()); + list.add(present_request); + if (present_request) + list.add(request); + + return list.hashCode(); + } + + @Override + public int compareTo(list_sentry_privileges_by_user_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetRequest()).compareTo(other.isSetRequest()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetRequest()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.request, other.request); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("list_sentry_privileges_by_user_args("); + boolean first = true; + + sb.append("request:"); + if (this.request == null) { + sb.append("null"); + } else { + sb.append(this.request); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (request != null) { + request.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class list_sentry_privileges_by_user_argsStandardSchemeFactory implements SchemeFactory { + public list_sentry_privileges_by_user_argsStandardScheme getScheme() { + return new list_sentry_privileges_by_user_argsStandardScheme(); + } + } + + private static class list_sentry_privileges_by_user_argsStandardScheme extends StandardScheme<list_sentry_privileges_by_user_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, list_sentry_privileges_by_user_args struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // REQUEST + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.request = new TListSentryPrivilegesRequest(); + struct.request.read(iprot); + struct.setRequestIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, list_sentry_privileges_by_user_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.request != null) { + oprot.writeFieldBegin(REQUEST_FIELD_DESC); + struct.request.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class list_sentry_privileges_by_user_argsTupleSchemeFactory implements SchemeFactory { + public list_sentry_privileges_by_user_argsTupleScheme getScheme() { + return new list_sentry_privileges_by_user_argsTupleScheme(); + } + } + + private static class list_sentry_privileges_by_user_argsTupleScheme extends TupleScheme<list_sentry_privileges_by_user_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, list_sentry_privileges_by_user_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetRequest()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetRequest()) { + struct.request.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, list_sentry_privileges_by_user_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.request = new TListSentryPrivilegesRequest(); + struct.request.read(iprot); + struct.setRequestIsSet(true); + } + } + } + + } + + public static class list_sentry_privileges_by_user_result implements org.apache.thrift.TBase<list_sentry_privileges_by_user_result, list_sentry_privileges_by_user_result._Fields>, java.io.Serializable, Cloneable, Comparable<list_sentry_privileges_by_user_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("list_sentry_privileges_by_user_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new list_sentry_privileges_by_user_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new list_sentry_privileges_by_user_resultTupleSchemeFactory()); + } + + private TListSentryPrivilegesResponse success; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short)0, "success"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TListSentryPrivilegesResponse.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(list_sentry_privileges_by_user_result.class, metaDataMap); + } + + public list_sentry_privileges_by_user_result() { + } + + public list_sentry_privileges_by_user_result( + TListSentryPrivilegesResponse success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public list_sentry_privileges_by_user_result(list_sentry_privileges_by_user_result other) { + if (other.isSetSuccess()) { + this.success = new TListSentryPrivilegesResponse(other.success); + } + } + + public list_sentry_privileges_by_user_result deepCopy() { + return new list_sentry_privileges_by_user_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public TListSentryPrivilegesResponse getSuccess() { + return this.success; + } + + public void setSuccess(TListSentryPrivilegesResponse success) { + this.success = success; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((TListSentryPrivilegesResponse)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof list_sentry_privileges_by_user_result) + return this.equals((list_sentry_privileges_by_user_result)that); + return false; + } + + public boolean equals(list_sentry_privileges_by_user_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) + list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(list_sentry_privileges_by_user_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("list_sentry_privileges_by_user_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class list_sentry_privileges_by_user_resultStandardSchemeFactory implements SchemeFactory { + public list_sentry_privileges_by_user_resultStandardScheme getScheme() { + return new list_sentry_privileges_by_user_resultStandardScheme(); + } + } + + private static class list_sentry_privileges_by_user_resultStandardScheme extends StandardScheme<list_sentry_privileges_by_user_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, list_sentry_privileges_by_user_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new TListSentryPrivilegesResponse(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, list_sentry_privileges_by_user_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class list_sentry_privileges_by_user_resultTupleSchemeFactory implements SchemeFactory { + public list_sentry_privileges_by_user_resultTupleScheme getScheme() { + return new list_sentry_privileges_by_user_resultTupleScheme(); + } + } + + private static class list_sentry_privileges_by_user_resultTupleScheme extends TupleScheme<list_sentry_privileges_by_user_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, list_sentry_privileges_by_user_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, list_sentry_privileges_by_user_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new TListSentryPrivilegesResponse(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + } + public static class list_sentry_privileges_for_provider_args implements org.apache.thrift.TBase<list_sentry_privileges_for_provider_args, list_sentry_privileges_for_provider_args._Fields>, java.io.Serializable, Cloneable, Comparable<list_sentry_privileges_for_provider_args> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("list_sentry_privileges_for_provider_args"); http://git-wip-us.apache.org/repos/asf/sentry/blob/74f130fe/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TListSentryPrivilegesByAuthRequest.java ---------------------------------------------------------------------- diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TListSentryPrivilegesByAuthRequest.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TListSentryPrivilegesByAuthRequest.java index bcc359e..7778b40 100644 --- a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TListSentryPrivilegesByAuthRequest.java +++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TListSentryPrivilegesByAuthRequest.java @@ -43,6 +43,7 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa private static final org.apache.thrift.protocol.TField AUTHORIZABLE_SET_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizableSet", org.apache.thrift.protocol.TType.SET, (short)3); private static final org.apache.thrift.protocol.TField GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("groups", org.apache.thrift.protocol.TType.SET, (short)4); private static final org.apache.thrift.protocol.TField ROLE_SET_FIELD_DESC = new org.apache.thrift.protocol.TField("roleSet", org.apache.thrift.protocol.TType.STRUCT, (short)5); + private static final org.apache.thrift.protocol.TField USERS_FIELD_DESC = new org.apache.thrift.protocol.TField("users", org.apache.thrift.protocol.TType.SET, (short)6); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -55,6 +56,7 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa private Set<TSentryAuthorizable> authorizableSet; // required private Set<String> groups; // optional private TSentryActiveRoleSet roleSet; // optional + private Set<String> users; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -62,7 +64,8 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa REQUESTOR_USER_NAME((short)2, "requestorUserName"), AUTHORIZABLE_SET((short)3, "authorizableSet"), GROUPS((short)4, "groups"), - ROLE_SET((short)5, "roleSet"); + ROLE_SET((short)5, "roleSet"), + USERS((short)6, "users"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -87,6 +90,8 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa return GROUPS; case 5: // ROLE_SET return ROLE_SET; + case 6: // USERS + return USERS; default: return null; } @@ -129,7 +134,7 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa // isset id assignments private static final int __PROTOCOL_VERSION_ISSET_ID = 0; private byte __isset_bitfield = 0; - private static final _Fields optionals[] = {_Fields.GROUPS,_Fields.ROLE_SET}; + private static final _Fields optionals[] = {_Fields.GROUPS,_Fields.ROLE_SET,_Fields.USERS}; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); @@ -145,6 +150,9 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); tmpMap.put(_Fields.ROLE_SET, new org.apache.thrift.meta_data.FieldMetaData("roleSet", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryActiveRoleSet.class))); + tmpMap.put(_Fields.USERS, new org.apache.thrift.meta_data.FieldMetaData("users", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesByAuthRequest.class, metaDataMap); } @@ -189,6 +197,10 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa if (other.isSetRoleSet()) { this.roleSet = new TSentryActiveRoleSet(other.roleSet); } + if (other.isSetUsers()) { + Set<String> __this__users = new HashSet<String>(other.users); + this.users = __this__users; + } } public TListSentryPrivilegesByAuthRequest deepCopy() { @@ -203,6 +215,7 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa this.authorizableSet = null; this.groups = null; this.roleSet = null; + this.users = null; } public int getProtocol_version() { @@ -349,6 +362,44 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa } } + public int getUsersSize() { + return (this.users == null) ? 0 : this.users.size(); + } + + public java.util.Iterator<String> getUsersIterator() { + return (this.users == null) ? null : this.users.iterator(); + } + + public void addToUsers(String elem) { + if (this.users == null) { + this.users = new HashSet<String>(); + } + this.users.add(elem); + } + + public Set<String> getUsers() { + return this.users; + } + + public void setUsers(Set<String> users) { + this.users = users; + } + + public void unsetUsers() { + this.users = null; + } + + /** Returns true if field users is set (has been assigned a value) and false otherwise */ + public boolean isSetUsers() { + return this.users != null; + } + + public void setUsersIsSet(boolean value) { + if (!value) { + this.users = null; + } + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case PROTOCOL_VERSION: @@ -391,6 +442,14 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa } break; + case USERS: + if (value == null) { + unsetUsers(); + } else { + setUsers((Set<String>)value); + } + break; + } } @@ -411,6 +470,9 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa case ROLE_SET: return getRoleSet(); + case USERS: + return getUsers(); + } throw new IllegalStateException(); } @@ -432,6 +494,8 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa return isSetGroups(); case ROLE_SET: return isSetRoleSet(); + case USERS: + return isSetUsers(); } throw new IllegalStateException(); } @@ -494,6 +558,15 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa return false; } + boolean this_present_users = true && this.isSetUsers(); + boolean that_present_users = true && that.isSetUsers(); + if (this_present_users || that_present_users) { + if (!(this_present_users && that_present_users)) + return false; + if (!this.users.equals(that.users)) + return false; + } + return true; } @@ -526,6 +599,11 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa if (present_roleSet) list.add(roleSet); + boolean present_users = true && (isSetUsers()); + list.add(present_users); + if (present_users) + list.add(users); + return list.hashCode(); } @@ -587,6 +665,16 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa return lastComparison; } } + lastComparison = Boolean.valueOf(isSetUsers()).compareTo(other.isSetUsers()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUsers()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.users, other.users); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -646,6 +734,16 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa } first = false; } + if (isSetUsers()) { + if (!first) sb.append(", "); + sb.append("users:"); + if (this.users == null) { + sb.append("null"); + } else { + sb.append(this.users); + } + first = false; + } sb.append(")"); return sb.toString(); } @@ -768,6 +866,24 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 6: // USERS + if (schemeField.type == org.apache.thrift.protocol.TType.SET) { + { + org.apache.thrift.protocol.TSet _set136 = iprot.readSetBegin(); + struct.users = new HashSet<String>(2*_set136.size); + String _elem137; + for (int _i138 = 0; _i138 < _set136.size; ++_i138) + { + _elem137 = iprot.readString(); + struct.users.add(_elem137); + } + iprot.readSetEnd(); + } + struct.setUsersIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -793,9 +909,9 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa oprot.writeFieldBegin(AUTHORIZABLE_SET_FIELD_DESC); { oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.authorizableSet.size())); - for (TSentryAuthorizable _iter136 : struct.authorizableSet) + for (TSentryAuthorizable _iter139 : struct.authorizableSet) { - _iter136.write(oprot); + _iter139.write(oprot); } oprot.writeSetEnd(); } @@ -806,9 +922,9 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa oprot.writeFieldBegin(GROUPS_FIELD_DESC); { oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.groups.size())); - for (String _iter137 : struct.groups) + for (String _iter140 : struct.groups) { - oprot.writeString(_iter137); + oprot.writeString(_iter140); } oprot.writeSetEnd(); } @@ -822,6 +938,20 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa oprot.writeFieldEnd(); } } + if (struct.users != null) { + if (struct.isSetUsers()) { + oprot.writeFieldBegin(USERS_FIELD_DESC); + { + oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.users.size())); + for (String _iter141 : struct.users) + { + oprot.writeString(_iter141); + } + oprot.writeSetEnd(); + } + oprot.writeFieldEnd(); + } + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -843,9 +973,9 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa oprot.writeString(struct.requestorUserName); { oprot.writeI32(struct.authorizableSet.size()); - for (TSentryAuthorizable _iter138 : struct.authorizableSet) + for (TSentryAuthorizable _iter142 : struct.authorizableSet) { - _iter138.write(oprot); + _iter142.write(oprot); } } BitSet optionals = new BitSet(); @@ -855,19 +985,31 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa if (struct.isSetRoleSet()) { optionals.set(1); } - oprot.writeBitSet(optionals, 2); + if (struct.isSetUsers()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); if (struct.isSetGroups()) { { oprot.writeI32(struct.groups.size()); - for (String _iter139 : struct.groups) + for (String _iter143 : struct.groups) { - oprot.writeString(_iter139); + oprot.writeString(_iter143); } } } if (struct.isSetRoleSet()) { struct.roleSet.write(oprot); } + if (struct.isSetUsers()) { + { + oprot.writeI32(struct.users.size()); + for (String _iter144 : struct.users) + { + oprot.writeString(_iter144); + } + } + } } @Override @@ -878,27 +1020,27 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa struct.requestorUserName = iprot.readString(); struct.setRequestorUserNameIsSet(true); { - org.apache.thrift.protocol.TSet _set140 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.authorizableSet = new HashSet<TSentryAuthorizable>(2*_set140.size); - TSentryAuthorizable _elem141; - for (int _i142 = 0; _i142 < _set140.size; ++_i142) + org.apache.thrift.protocol.TSet _set145 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.authorizableSet = new HashSet<TSentryAuthorizable>(2*_set145.size); + TSentryAuthorizable _elem146; + for (int _i147 = 0; _i147 < _set145.size; ++_i147) { - _elem141 = new TSentryAuthorizable(); - _elem141.read(iprot); - struct.authorizableSet.add(_elem141); + _elem146 = new TSentryAuthorizable(); + _elem146.read(iprot); + struct.authorizableSet.add(_elem146); } } struct.setAuthorizableSetIsSet(true); - BitSet incoming = iprot.readBitSet(2); + BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { { - org.apache.thrift.protocol.TSet _set143 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.groups = new HashSet<String>(2*_set143.size); - String _elem144; - for (int _i145 = 0; _i145 < _set143.size; ++_i145) + org.apache.thrift.protocol.TSet _set148 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.groups = new HashSet<String>(2*_set148.size); + String _elem149; + for (int _i150 = 0; _i150 < _set148.size; ++_i150) { - _elem144 = iprot.readString(); - struct.groups.add(_elem144); + _elem149 = iprot.readString(); + struct.groups.add(_elem149); } } struct.setGroupsIsSet(true); @@ -908,6 +1050,19 @@ public class TListSentryPrivilegesByAuthRequest implements org.apache.thrift.TBa struct.roleSet.read(iprot); struct.setRoleSetIsSet(true); } + if (incoming.get(2)) { + { + org.apache.thrift.protocol.TSet _set151 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.users = new HashSet<String>(2*_set151.size); + String _elem152; + for (int _i153 = 0; _i153 < _set151.size; ++_i153) + { + _elem152 = iprot.readString(); + struct.users.add(_elem152); + } + } + struct.setUsersIsSet(true); + } } } http://git-wip-us.apache.org/repos/asf/sentry/blob/74f130fe/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TListSentryPrivilegesByAuthResponse.java ---------------------------------------------------------------------- diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TListSentryPrivilegesByAuthResponse.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TListSentryPrivilegesByAuthResponse.java index c0a7f18..77591c2 100644 --- a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TListSentryPrivilegesByAuthResponse.java +++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TListSentryPrivilegesByAuthResponse.java @@ -40,6 +40,7 @@ public class TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TB private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1); private static final org.apache.thrift.protocol.TField PRIVILEGES_MAP_BY_AUTH_FIELD_DESC = new org.apache.thrift.protocol.TField("privilegesMapByAuth", org.apache.thrift.protocol.TType.MAP, (short)2); + private static final org.apache.thrift.protocol.TField PRIVILEGES_MAP_BY_AUTH_FOR_USERS_FIELD_DESC = new org.apache.thrift.protocol.TField("privilegesMapByAuthForUsers", org.apache.thrift.protocol.TType.MAP, (short)3); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -49,11 +50,13 @@ public class TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TB private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required private Map<TSentryAuthorizable,TSentryPrivilegeMap> privilegesMapByAuth; // optional + private Map<TSentryAuthorizable,TSentryPrivilegeMap> privilegesMapByAuthForUsers; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { STATUS((short)1, "status"), - PRIVILEGES_MAP_BY_AUTH((short)2, "privilegesMapByAuth"); + PRIVILEGES_MAP_BY_AUTH((short)2, "privilegesMapByAuth"), + PRIVILEGES_MAP_BY_AUTH_FOR_USERS((short)3, "privilegesMapByAuthForUsers"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -72,6 +75,8 @@ public class TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TB return STATUS; case 2: // PRIVILEGES_MAP_BY_AUTH return PRIVILEGES_MAP_BY_AUTH; + case 3: // PRIVILEGES_MAP_BY_AUTH_FOR_USERS + return PRIVILEGES_MAP_BY_AUTH_FOR_USERS; default: return null; } @@ -112,7 +117,7 @@ public class TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TB } // isset id assignments - private static final _Fields optionals[] = {_Fields.PRIVILEGES_MAP_BY_AUTH}; + private static final _Fields optionals[] = {_Fields.PRIVILEGES_MAP_BY_AUTH,_Fields.PRIVILEGES_MAP_BY_AUTH_FOR_USERS}; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); @@ -122,6 +127,10 @@ public class TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TB new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryAuthorizable.class), new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilegeMap.class)))); + tmpMap.put(_Fields.PRIVILEGES_MAP_BY_AUTH_FOR_USERS, new org.apache.thrift.meta_data.FieldMetaData("privilegesMapByAuthForUsers", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryAuthorizable.class), + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilegeMap.class)))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesByAuthResponse.class, metaDataMap); } @@ -158,6 +167,21 @@ public class TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TB } this.privilegesMapByAuth = __this__privilegesMapByAuth; } + if (other.isSetPrivilegesMapByAuthForUsers()) { + Map<TSentryAuthorizable,TSentryPrivilegeMap> __this__privilegesMapByAuthForUsers = new HashMap<TSentryAuthorizable,TSentryPrivilegeMap>(other.privilegesMapByAuthForUsers.size()); + for (Map.Entry<TSentryAuthorizable, TSentryPrivilegeMap> other_element : other.privilegesMapByAuthForUsers.entrySet()) { + + TSentryAuthorizable other_element_key = other_element.getKey(); + TSentryPrivilegeMap other_element_value = other_element.getValue(); + + TSentryAuthorizable __this__privilegesMapByAuthForUsers_copy_key = new TSentryAuthorizable(other_element_key); + + TSentryPrivilegeMap __this__privilegesMapByAuthForUsers_copy_value = new TSentryPrivilegeMap(other_element_value); + + __this__privilegesMapByAuthForUsers.put(__this__privilegesMapByAuthForUsers_copy_key, __this__privilegesMapByAuthForUsers_copy_value); + } + this.privilegesMapByAuthForUsers = __this__privilegesMapByAuthForUsers; + } } public TListSentryPrivilegesByAuthResponse deepCopy() { @@ -168,6 +192,7 @@ public class TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TB public void clear() { this.status = null; this.privilegesMapByAuth = null; + this.privilegesMapByAuthForUsers = null; } public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() { @@ -227,6 +252,40 @@ public class TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TB } } + public int getPrivilegesMapByAuthForUsersSize() { + return (this.privilegesMapByAuthForUsers == null) ? 0 : this.privilegesMapByAuthForUsers.size(); + } + + public void putToPrivilegesMapByAuthForUsers(TSentryAuthorizable key, TSentryPrivilegeMap val) { + if (this.privilegesMapByAuthForUsers == null) { + this.privilegesMapByAuthForUsers = new HashMap<TSentryAuthorizable,TSentryPrivilegeMap>(); + } + this.privilegesMapByAuthForUsers.put(key, val); + } + + public Map<TSentryAuthorizable,TSentryPrivilegeMap> getPrivilegesMapByAuthForUsers() { + return this.privilegesMapByAuthForUsers; + } + + public void setPrivilegesMapByAuthForUsers(Map<TSentryAuthorizable,TSentryPrivilegeMap> privilegesMapByAuthForUsers) { + this.privilegesMapByAuthForUsers = privilegesMapByAuthForUsers; + } + + public void unsetPrivilegesMapByAuthForUsers() { + this.privilegesMapByAuthForUsers = null; + } + + /** Returns true if field privilegesMapByAuthForUsers is set (has been assigned a value) and false otherwise */ + public boolean isSetPrivilegesMapByAuthForUsers() { + return this.privilegesMapByAuthForUsers != null; + } + + public void setPrivilegesMapByAuthForUsersIsSet(boolean value) { + if (!value) { + this.privilegesMapByAuthForUsers = null; + } + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case STATUS: @@ -245,6 +304,14 @@ public class TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TB } break; + case PRIVILEGES_MAP_BY_AUTH_FOR_USERS: + if (value == null) { + unsetPrivilegesMapByAuthForUsers(); + } else { + setPrivilegesMapByAuthForUsers((Map<TSentryAuthorizable,TSentryPrivilegeMap>)value); + } + break; + } } @@ -256,6 +323,9 @@ public class TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TB case PRIVILEGES_MAP_BY_AUTH: return getPrivilegesMapByAuth(); + case PRIVILEGES_MAP_BY_AUTH_FOR_USERS: + return getPrivilegesMapByAuthForUsers(); + } throw new IllegalStateException(); } @@ -271,6 +341,8 @@ public class TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TB return isSetStatus(); case PRIVILEGES_MAP_BY_AUTH: return isSetPrivilegesMapByAuth(); + case PRIVILEGES_MAP_BY_AUTH_FOR_USERS: + return isSetPrivilegesMapByAuthForUsers(); } throw new IllegalStateException(); } @@ -306,6 +378,15 @@ public class TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TB return false; } + boolean this_present_privilegesMapByAuthForUsers = true && this.isSetPrivilegesMapByAuthForUsers(); + boolean that_present_privilegesMapByAuthForUsers = true && that.isSetPrivilegesMapByAuthForUsers(); + if (this_present_privilegesMapByAuthForUsers || that_present_privilegesMapByAuthForUsers) { + if (!(this_present_privilegesMapByAuthForUsers && that_present_privilegesMapByAuthForUsers)) + return false; + if (!this.privilegesMapByAuthForUsers.equals(that.privilegesMapByAuthForUsers)) + return false; + } + return true; } @@ -323,6 +404,11 @@ public class TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TB if (present_privilegesMapByAuth) list.add(privilegesMapByAuth); + boolean present_privilegesMapByAuthForUsers = true && (isSetPrivilegesMapByAuthForUsers()); + list.add(present_privilegesMapByAuthForUsers); + if (present_privilegesMapByAuthForUsers) + list.add(privilegesMapByAuthForUsers); + return list.hashCode(); } @@ -354,6 +440,16 @@ public class TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TB return lastComparison; } } + lastComparison = Boolean.valueOf(isSetPrivilegesMapByAuthForUsers()).compareTo(other.isSetPrivilegesMapByAuthForUsers()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetPrivilegesMapByAuthForUsers()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilegesMapByAuthForUsers, other.privilegesMapByAuthForUsers); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -391,6 +487,16 @@ public class TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TB } first = false; } + if (isSetPrivilegesMapByAuthForUsers()) { + if (!first) sb.append(", "); + sb.append("privilegesMapByAuthForUsers:"); + if (this.privilegesMapByAuthForUsers == null) { + sb.append("null"); + } else { + sb.append(this.privilegesMapByAuthForUsers); + } + first = false; + } sb.append(")"); return sb.toString(); } @@ -453,17 +559,17 @@ public class TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TB case 2: // PRIVILEGES_MAP_BY_AUTH if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map146 = iprot.readMapBegin(); - struct.privilegesMapByAuth = new HashMap<TSentryAuthorizable,TSentryPrivilegeMap>(2*_map146.size); - TSentryAuthorizable _key147; - TSentryPrivilegeMap _val148; - for (int _i149 = 0; _i149 < _map146.size; ++_i149) + org.apache.thrift.protocol.TMap _map154 = iprot.readMapBegin(); + struct.privilegesMapByAuth = new HashMap<TSentryAuthorizable,TSentryPrivilegeMap>(2*_map154.size); + TSentryAuthorizable _key155; + TSentryPrivilegeMap _val156; + for (int _i157 = 0; _i157 < _map154.size; ++_i157) { - _key147 = new TSentryAuthorizable(); - _key147.read(iprot); - _val148 = new TSentryPrivilegeMap(); - _val148.read(iprot); - struct.privilegesMapByAuth.put(_key147, _val148); + _key155 = new TSentryAuthorizable(); + _key155.read(iprot); + _val156 = new TSentryPrivilegeMap(); + _val156.read(iprot); + struct.privilegesMapByAuth.put(_key155, _val156); } iprot.readMapEnd(); } @@ -472,6 +578,28 @@ public class TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TB org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 3: // PRIVILEGES_MAP_BY_AUTH_FOR_USERS + if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { + { + org.apache.thrift.protocol.TMap _map158 = iprot.readMapBegin(); + struct.privilegesMapByAuthForUsers = new HashMap<TSentryAuthorizable,TSentryPrivilegeMap>(2*_map158.size); + TSentryAuthorizable _key159; + TSentryPrivilegeMap _val160; + for (int _i161 = 0; _i161 < _map158.size; ++_i161) + { + _key159 = new TSentryAuthorizable(); + _key159.read(iprot); + _val160 = new TSentryPrivilegeMap(); + _val160.read(iprot); + struct.privilegesMapByAuthForUsers.put(_key159, _val160); + } + iprot.readMapEnd(); + } + struct.setPrivilegesMapByAuthForUsersIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -495,10 +623,25 @@ public class TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TB oprot.writeFieldBegin(PRIVILEGES_MAP_BY_AUTH_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRUCT, org.apache.thrift.protocol.TType.STRUCT, struct.privilegesMapByAuth.size())); - for (Map.Entry<TSentryAuthorizable, TSentryPrivilegeMap> _iter150 : struct.privilegesMapByAuth.entrySet()) + for (Map.Entry<TSentryAuthorizable, TSentryPrivilegeMap> _iter162 : struct.privilegesMapByAuth.entrySet()) + { + _iter162.getKey().write(oprot); + _iter162.getValue().write(oprot); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + } + if (struct.privilegesMapByAuthForUsers != null) { + if (struct.isSetPrivilegesMapByAuthForUsers()) { + oprot.writeFieldBegin(PRIVILEGES_MAP_BY_AUTH_FOR_USERS_FIELD_DESC); + { + oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRUCT, org.apache.thrift.protocol.TType.STRUCT, struct.privilegesMapByAuthForUsers.size())); + for (Map.Entry<TSentryAuthorizable, TSentryPrivilegeMap> _iter163 : struct.privilegesMapByAuthForUsers.entrySet()) { - _iter150.getKey().write(oprot); - _iter150.getValue().write(oprot); + _iter163.getKey().write(oprot); + _iter163.getValue().write(oprot); } oprot.writeMapEnd(); } @@ -527,14 +670,27 @@ public class TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TB if (struct.isSetPrivilegesMapByAuth()) { optionals.set(0); } - oprot.writeBitSet(optionals, 1); + if (struct.isSetPrivilegesMapByAuthForUsers()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); if (struct.isSetPrivilegesMapByAuth()) { { oprot.writeI32(struct.privilegesMapByAuth.size()); - for (Map.Entry<TSentryAuthorizable, TSentryPrivilegeMap> _iter151 : struct.privilegesMapByAuth.entrySet()) + for (Map.Entry<TSentryAuthorizable, TSentryPrivilegeMap> _iter164 : struct.privilegesMapByAuth.entrySet()) { - _iter151.getKey().write(oprot); - _iter151.getValue().write(oprot); + _iter164.getKey().write(oprot); + _iter164.getValue().write(oprot); + } + } + } + if (struct.isSetPrivilegesMapByAuthForUsers()) { + { + oprot.writeI32(struct.privilegesMapByAuthForUsers.size()); + for (Map.Entry<TSentryAuthorizable, TSentryPrivilegeMap> _iter165 : struct.privilegesMapByAuthForUsers.entrySet()) + { + _iter165.getKey().write(oprot); + _iter165.getValue().write(oprot); } } } @@ -546,24 +702,41 @@ public class TListSentryPrivilegesByAuthResponse implements org.apache.thrift.TB struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(); struct.status.read(iprot); struct.setStatusIsSet(true); - BitSet incoming = iprot.readBitSet(1); + BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TMap _map152 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRUCT, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.privilegesMapByAuth = new HashMap<TSentryAuthorizable,TSentryPrivilegeMap>(2*_map152.size); - TSentryAuthorizable _key153; - TSentryPrivilegeMap _val154; - for (int _i155 = 0; _i155 < _map152.size; ++_i155) + org.apache.thrift.protocol.TMap _map166 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRUCT, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.privilegesMapByAuth = new HashMap<TSentryAuthorizable,TSentryPrivilegeMap>(2*_map166.size); + TSentryAuthorizable _key167; + TSentryPrivilegeMap _val168; + for (int _i169 = 0; _i169 < _map166.size; ++_i169) { - _key153 = new TSentryAuthorizable(); - _key153.read(iprot); - _val154 = new TSentryPrivilegeMap(); - _val154.read(iprot); - struct.privilegesMapByAuth.put(_key153, _val154); + _key167 = new TSentryAuthorizable(); + _key167.read(iprot); + _val168 = new TSentryPrivilegeMap(); + _val168.read(iprot); + struct.privilegesMapByAuth.put(_key167, _val168); } } struct.setPrivilegesMapByAuthIsSet(true); } + if (incoming.get(1)) { + { + org.apache.thrift.protocol.TMap _map170 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRUCT, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.privilegesMapByAuthForUsers = new HashMap<TSentryAuthorizable,TSentryPrivilegeMap>(2*_map170.size); + TSentryAuthorizable _key171; + TSentryPrivilegeMap _val172; + for (int _i173 = 0; _i173 < _map170.size; ++_i173) + { + _key171 = new TSentryAuthorizable(); + _key171.read(iprot); + _val172 = new TSentryPrivilegeMap(); + _val172.read(iprot); + struct.privilegesMapByAuthForUsers.put(_key171, _val172); + } + } + struct.setPrivilegesMapByAuthForUsersIsSet(true); + } } } http://git-wip-us.apache.org/repos/asf/sentry/blob/74f130fe/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TListSentryPrivilegesRequest.java ---------------------------------------------------------------------- diff --git a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TListSentryPrivilegesRequest.java b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TListSentryPrivilegesRequest.java index 4da1840..01e5230 100644 --- a/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TListSentryPrivilegesRequest.java +++ b/sentry-service/sentry-service-api/src/gen/thrift/gen-javabean/org/apache/sentry/api/service/thrift/TListSentryPrivilegesRequest.java @@ -42,6 +42,7 @@ public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TLi private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2); private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)4); private static final org.apache.thrift.protocol.TField AUTHORIZABLE_HIERARCHY_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizableHierarchy", org.apache.thrift.protocol.TType.STRUCT, (short)5); + private static final org.apache.thrift.protocol.TField ENTITY_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("entityName", org.apache.thrift.protocol.TType.STRING, (short)6); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -53,13 +54,15 @@ public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TLi private String requestorUserName; // required private String roleName; // required private TSentryAuthorizable authorizableHierarchy; // optional + private String entityName; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { PROTOCOL_VERSION((short)1, "protocol_version"), REQUESTOR_USER_NAME((short)2, "requestorUserName"), ROLE_NAME((short)4, "roleName"), - AUTHORIZABLE_HIERARCHY((short)5, "authorizableHierarchy"); + AUTHORIZABLE_HIERARCHY((short)5, "authorizableHierarchy"), + ENTITY_NAME((short)6, "entityName"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -82,6 +85,8 @@ public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TLi return ROLE_NAME; case 5: // AUTHORIZABLE_HIERARCHY return AUTHORIZABLE_HIERARCHY; + case 6: // ENTITY_NAME + return ENTITY_NAME; default: return null; } @@ -124,7 +129,7 @@ public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TLi // isset id assignments private static final int __PROTOCOL_VERSION_ISSET_ID = 0; private byte __isset_bitfield = 0; - private static final _Fields optionals[] = {_Fields.AUTHORIZABLE_HIERARCHY}; + private static final _Fields optionals[] = {_Fields.AUTHORIZABLE_HIERARCHY,_Fields.ENTITY_NAME}; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); @@ -136,6 +141,8 @@ public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TLi new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.AUTHORIZABLE_HIERARCHY, new org.apache.thrift.meta_data.FieldMetaData("authorizableHierarchy", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryAuthorizable.class))); + tmpMap.put(_Fields.ENTITY_NAME, new org.apache.thrift.meta_data.FieldMetaData("entityName", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesRequest.class, metaDataMap); } @@ -172,6 +179,9 @@ public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TLi if (other.isSetAuthorizableHierarchy()) { this.authorizableHierarchy = new TSentryAuthorizable(other.authorizableHierarchy); } + if (other.isSetEntityName()) { + this.entityName = other.entityName; + } } public TListSentryPrivilegesRequest deepCopy() { @@ -185,6 +195,7 @@ public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TLi this.requestorUserName = null; this.roleName = null; this.authorizableHierarchy = null; + this.entityName = null; } public int getProtocol_version() { @@ -278,6 +289,29 @@ public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TLi } } + public String getEntityName() { + return this.entityName; + } + + public void setEntityName(String entityName) { + this.entityName = entityName; + } + + public void unsetEntityName() { + this.entityName = null; + } + + /** Returns true if field entityName is set (has been assigned a value) and false otherwise */ + public boolean isSetEntityName() { + return this.entityName != null; + } + + public void setEntityNameIsSet(boolean value) { + if (!value) { + this.entityName = null; + } + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case PROTOCOL_VERSION: @@ -312,6 +346,14 @@ public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TLi } break; + case ENTITY_NAME: + if (value == null) { + unsetEntityName(); + } else { + setEntityName((String)value); + } + break; + } } @@ -329,6 +371,9 @@ public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TLi case AUTHORIZABLE_HIERARCHY: return getAuthorizableHierarchy(); + case ENTITY_NAME: + return getEntityName(); + } throw new IllegalStateException(); } @@ -348,6 +393,8 @@ public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TLi return isSetRoleName(); case AUTHORIZABLE_HIERARCHY: return isSetAuthorizableHierarchy(); + case ENTITY_NAME: + return isSetEntityName(); } throw new IllegalStateException(); } @@ -401,6 +448,15 @@ public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TLi return false; } + boolean this_present_entityName = true && this.isSetEntityName(); + boolean that_present_entityName = true && that.isSetEntityName(); + if (this_present_entityName || that_present_entityName) { + if (!(this_present_entityName && that_present_entityName)) + return false; + if (!this.entityName.equals(that.entityName)) + return false; + } + return true; } @@ -428,6 +484,11 @@ public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TLi if (present_authorizableHierarchy) list.add(authorizableHierarchy); + boolean present_entityName = true && (isSetEntityName()); + list.add(present_entityName); + if (present_entityName) + list.add(entityName); + return list.hashCode(); } @@ -479,6 +540,16 @@ public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TLi return lastComparison; } } + lastComparison = Boolean.valueOf(isSetEntityName()).compareTo(other.isSetEntityName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetEntityName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.entityName, other.entityName); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -528,6 +599,16 @@ public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TLi } first = false; } + if (isSetEntityName()) { + if (!first) sb.append(", "); + sb.append("entityName:"); + if (this.entityName == null) { + sb.append("null"); + } else { + sb.append(this.entityName); + } + first = false; + } sb.append(")"); return sb.toString(); } @@ -621,6 +702,14 @@ public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TLi org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 6: // ENTITY_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.entityName = iprot.readString(); + struct.setEntityNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -654,6 +743,13 @@ public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TLi oprot.writeFieldEnd(); } } + if (struct.entityName != null) { + if (struct.isSetEntityName()) { + oprot.writeFieldBegin(ENTITY_NAME_FIELD_DESC); + oprot.writeString(struct.entityName); + oprot.writeFieldEnd(); + } + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -678,10 +774,16 @@ public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TLi if (struct.isSetAuthorizableHierarchy()) { optionals.set(0); } - oprot.writeBitSet(optionals, 1); + if (struct.isSetEntityName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); if (struct.isSetAuthorizableHierarchy()) { struct.authorizableHierarchy.write(oprot); } + if (struct.isSetEntityName()) { + oprot.writeString(struct.entityName); + } } @Override @@ -693,12 +795,16 @@ public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TLi struct.setRequestorUserNameIsSet(true); struct.roleName = iprot.readString(); struct.setRoleNameIsSet(true); - BitSet incoming = iprot.readBitSet(1); + BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { struct.authorizableHierarchy = new TSentryAuthorizable(); struct.authorizableHierarchy.read(iprot); struct.setAuthorizableHierarchyIsSet(true); } + if (incoming.get(1)) { + struct.entityName = iprot.readString(); + struct.setEntityNameIsSet(true); + } } }
