public TCreateSentryRoleResponse deepCopy() { return new TCreateSentryRoleResponse(this); }
public Object getFieldValue(_Fields field) { switch (field) { case STATUS: return getStatus(); } throw new IllegalStateException(); }
public void setFieldValue(_Fields field, Object value) { switch (field) { case STATUS: if (value == null) { unsetStatus(); } else { setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value); } break; } }
public void validate() throws org.apache.thrift.TException { // check for required fields if (!isSetStatus()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString()); } // check for sub-struct validity }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, create_sentry_role_result struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { struct.success = new TCreateSentryRoleResponse(); struct.success.read(iprot); struct.setSuccessIsSet(true); } } }
@Test public void testCreateRole() { TCreateSentryRoleRequest request = new TCreateSentryRoleRequest(); TCreateSentryRoleResponse response = new TCreateSentryRoleResponse(); request.setRequestorUserName(TEST_USER_NAME); request.setRoleName(TEST_ROLE_NAME); response.setStatus(Status.OK()); GMAuditMetadataLogEntity amle = (GMAuditMetadataLogEntity) JsonLogEntityFactory.getInstance() .createJsonLogEntity(request, response, conf); assertCommon(amle, Constants.TRUE, Constants.OPERATION_CREATE_ROLE, "CREATE ROLE testRole", Constants.OBJECT_TYPE_ROLE, new HashMap<String, String>()); response.setStatus(Status.InvalidInput("", null)); amle = (GMAuditMetadataLogEntity) JsonLogEntityFactory.getInstance().createJsonLogEntity( request, response, conf); assertCommon(amle, Constants.FALSE, Constants.OPERATION_CREATE_ROLE, "CREATE ROLE testRole", Constants.OBJECT_TYPE_ROLE, new HashMap<String, String>()); }
public void read(org.apache.thrift.protocol.TProtocol iprot, TCreateSentryRoleResponse 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: // STATUS if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(); struct.status.read(iprot); struct.setStatusIsSet(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(); }
/** * Performs a deep copy on <i>other</i>. */ public TCreateSentryRoleResponse(TCreateSentryRoleResponse other) { if (other.isSetStatus()) { this.status = other.status; } }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof TCreateSentryRoleResponse) return this.equals((TCreateSentryRoleResponse)that); return false; }
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); } }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleResponse struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(); struct.status.read(iprot); struct.setStatusIsSet(true); } }
public void read(org.apache.thrift.protocol.TProtocol iprot, create_sentry_role_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 TCreateSentryRoleResponse(); 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(); }
/** 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 STATUS: return isSetStatus(); } throw new IllegalStateException(); }
public boolean equals(create_sentry_role_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; }
public JsonLogEntity createJsonLogEntity( org.apache.sentry.api.generic.thrift.TCreateSentryRoleRequest request, org.apache.sentry.api.generic.thrift.TCreateSentryRoleResponse response, Configuration conf) { GMAuditMetadataLogEntity gmamle = createCommonGMAMLE(conf, response.getStatus(), request.getRequestorUserName(), request.getClass().getName(), request.getComponent()); gmamle.setOperationText(CommandUtil.createCmdForCreateOrDropRole(request.getRoleName(), true)); return gmamle; }
/** * Performs a deep copy on <i>other</i>. */ public create_sentry_role_result(create_sentry_role_result other) { if (other.isSetSuccess()) { this.success = new TCreateSentryRoleResponse(other.success); } }
public boolean equals(TCreateSentryRoleResponse that) { if (that == null) return false; boolean this_present_status = true && this.isSetStatus(); boolean that_present_status = true && that.isSetStatus(); if (this_present_status || that_present_status) { if (!(this_present_status && that_present_status)) return false; if (!this.status.equals(that.status)) return false; } return true; }
@Override public void createRoleIfNotExist(String requestorUserName, String roleName, String component) throws SentryUserException { TCreateSentryRoleRequest request = new TCreateSentryRoleRequest(); request.setProtocol_version(sentry_common_serviceConstants.TSENTRY_SERVICE_V2); request.setRequestorUserName(requestorUserName); request.setRoleName(roleName); request.setComponent(component); try { TCreateSentryRoleResponse response = client.create_sentry_role(request); Status status = Status.fromCode(response.getStatus().getValue()); if (status == Status.ALREADY_EXISTS) { return; } Status.throwIfNotOk(response.getStatus()); } catch (TException e) { throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e); } }
@Override public void create_sentry_role(TCreateSentryRoleRequest request, TCreateSentryRoleResponse response) { for (NotificationHandler handler : handlers) { try { LOGGER.debug("Calling " + handler); handler.create_sentry_role(new TCreateSentryRoleRequest(request), new TCreateSentryRoleResponse(response)); } catch (Exception ex) { LOGGER.error("Unexpected error in " + handler + ". Request: " + request + ", Response: " + response, ex); } } }
@Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_status = true && (isSetStatus()); list.add(present_status); if (present_status) list.add(status); return list.hashCode(); }