public Object getFieldValue(_Fields field) { switch (field) { case PROTOCOL_VERSION: return Integer.valueOf(getProtocol_version()); case REQUESTOR_USER_NAME: return getRequestorUserName(); case OLD_AUTHORIZABLE: return getOldAuthorizable(); case NEW_AUTHORIZABLE: return getNewAuthorizable(); } throw new IllegalStateException(); }
public TRenamePrivilegesRequest deepCopy() { return new TRenamePrivilegesRequest(this); }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof TRenamePrivilegesRequest) return this.equals((TRenamePrivilegesRequest)that); return false; }
/** 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 PROTOCOL_VERSION: return isSetProtocol_version(); case REQUESTOR_USER_NAME: return isSetRequestorUserName(); case OLD_AUTHORIZABLE: return isSetOldAuthorizable(); case NEW_AUTHORIZABLE: return isSetNewAuthorizable(); } throw new IllegalStateException(); }
/** * Performs a deep copy on <i>other</i>. */ public TRenamePrivilegesRequest(TRenamePrivilegesRequest other) { __isset_bitfield = other.__isset_bitfield; this.protocol_version = other.protocol_version; if (other.isSetRequestorUserName()) { this.requestorUserName = other.requestorUserName; } if (other.isSetOldAuthorizable()) { this.oldAuthorizable = new TSentryAuthorizable(other.oldAuthorizable); } if (other.isSetNewAuthorizable()) { this.newAuthorizable = new TSentryAuthorizable(other.newAuthorizable); } }
@Override public void onRenameSentryPrivilege(TRenamePrivilegesRequest request) throws SentryPluginException { String oldAuthz = getAuthzObj(request.getOldAuthorizable()); String newAuthz = getAuthzObj(request.getNewAuthorizable()); PermissionsUpdate update = new PermissionsUpdate(permSeqNum.incrementAndGet(), false); TPrivilegeChanges privUpdate = update.addPrivilegeUpdate(PermissionsUpdate.RENAME_PRIVS); privUpdate.putToAddPrivileges(newAuthz, newAuthz); privUpdate.putToDelPrivileges(oldAuthz, oldAuthz); permsUpdater.handleUpdateNotification(update); LOGGER.debug("Authz Perm preUpdate [" + update.getSeqNum() + ", " + newAuthz + ", " + oldAuthz + "].."); }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, rename_sentry_privilege_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { struct.request = new TRenamePrivilegesRequest(); struct.request.read(iprot); struct.setRequestIsSet(true); } } }
public void validate() throws org.apache.thrift.TException { // check for required fields if (!isSetProtocol_version()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString()); } if (!isSetRequestorUserName()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString()); } if (!isSetOldAuthorizable()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'oldAuthorizable' is unset! Struct:" + toString()); } if (!isSetNewAuthorizable()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'newAuthorizable' is unset! Struct:" + toString()); } // check for sub-struct validity if (oldAuthorizable != null) { oldAuthorizable.validate(); } if (newAuthorizable != null) { newAuthorizable.validate(); } }
boolean this_present_requestorUserName = true && this.isSetRequestorUserName(); boolean that_present_requestorUserName = true && that.isSetRequestorUserName(); if (this_present_requestorUserName || that_present_requestorUserName) { if (!(this_present_requestorUserName && that_present_requestorUserName)) boolean this_present_oldAuthorizable = true && this.isSetOldAuthorizable(); boolean that_present_oldAuthorizable = true && that.isSetOldAuthorizable(); if (this_present_oldAuthorizable || that_present_oldAuthorizable) { if (!(this_present_oldAuthorizable && that_present_oldAuthorizable)) boolean this_present_newAuthorizable = true && this.isSetNewAuthorizable(); boolean that_present_newAuthorizable = true && that.isSetNewAuthorizable(); if (this_present_newAuthorizable || that_present_newAuthorizable) { if (!(this_present_newAuthorizable && that_present_newAuthorizable))
public void read(org.apache.thrift.protocol.TProtocol iprot, rename_sentry_privilege_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 TRenamePrivilegesRequest(); 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(); }
lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version()); if (lastComparison != 0) { return lastComparison; if (isSetProtocol_version()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version); if (lastComparison != 0) { lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName()); if (lastComparison != 0) { return lastComparison; if (isSetRequestorUserName()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName); if (lastComparison != 0) { lastComparison = Boolean.valueOf(isSetOldAuthorizable()).compareTo(typedOther.isSetOldAuthorizable()); if (lastComparison != 0) { return lastComparison; if (isSetOldAuthorizable()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.oldAuthorizable, typedOther.oldAuthorizable); if (lastComparison != 0) { lastComparison = Boolean.valueOf(isSetNewAuthorizable()).compareTo(typedOther.isSetNewAuthorizable()); if (lastComparison != 0) { return lastComparison; if (isSetNewAuthorizable()) {
@Override public TRenamePrivilegesResponse rename_sentry_privilege( TRenamePrivilegesRequest request) throws TException { final Timer.Context timerContext = sentryMetrics.renamePrivilegeTimer.time(); TRenamePrivilegesResponse response = new TRenamePrivilegesResponse(); try { validateClientVersion(request.getProtocol_version()); authorize(request.getRequestorUserName(), adminGroups); sentryStore.renamePrivilege(request.getOldAuthorizable(), request.getNewAuthorizable()); for (SentryPolicyStorePlugin plugin : sentryPlugins) { plugin.onRenameSentryPrivilege(request); } response.setStatus(Status.OK()); } catch (SentryAccessDeniedException e) { LOGGER.error(e.getMessage(), e); response.setStatus(Status.AccessDenied(e.getMessage(), e)); } catch (SentryThriftAPIMismatchException e) { LOGGER.error(e.getMessage(), e); response.setStatus(Status.THRIFT_VERSION_MISMATCH(e.getMessage(), e)); } catch (Exception e) { String msg = "Unknown error for request: " + request + ", message: " + e.getMessage(); LOGGER.error(msg, e); response.setStatus(Status.RuntimeError(msg, e)); } finally { timerContext.close(); } return response; }
@Override public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(); boolean present_protocol_version = true; builder.append(present_protocol_version); if (present_protocol_version) builder.append(protocol_version); boolean present_requestorUserName = true && (isSetRequestorUserName()); builder.append(present_requestorUserName); if (present_requestorUserName) builder.append(requestorUserName); boolean present_oldAuthorizable = true && (isSetOldAuthorizable()); builder.append(present_oldAuthorizable); if (present_oldAuthorizable) builder.append(oldAuthorizable); boolean present_newAuthorizable = true && (isSetNewAuthorizable()); builder.append(present_newAuthorizable); if (present_newAuthorizable) builder.append(newAuthorizable); return builder.toHashCode(); }
/** * Performs a deep copy on <i>other</i>. */ public rename_sentry_privilege_args(rename_sentry_privilege_args other) { if (other.isSetRequest()) { this.request = new TRenamePrivilegesRequest(other.request); } }
public boolean equals(rename_sentry_privilege_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; }
public synchronized void renamePrivileges(String requestorUserName, List<? extends Authorizable> oldAuthorizables, List<? extends Authorizable> newAuthorizables) throws SentryUserException { TSentryAuthorizable tOldSentryAuthorizable = setupSentryAuthorizable(oldAuthorizables); TSentryAuthorizable tNewSentryAuthorizable = setupSentryAuthorizable(newAuthorizables); TRenamePrivilegesRequest request = new TRenamePrivilegesRequest( ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT, requestorUserName, tOldSentryAuthorizable, tNewSentryAuthorizable); try { TRenamePrivilegesResponse response = client .rename_sentry_privilege(request); Status.throwIfNotOk(response.getStatus()); } catch (TException e) { throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e); } }