congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
JsonLogEntityFactory
Code IndexAdd Tabnine to your IDE (free)

How to use
JsonLogEntityFactory
in
org.apache.sentry.provider.db.log.entity

Best Java code snippets using org.apache.sentry.provider.db.log.entity.JsonLogEntityFactory (Showing top 20 results out of 315)

origin: apache/sentry

/**
 * Creates an audit log for the drop role event.
 *
 * @param request The drop role request received by the Sentry server.
 * @param response The drop role response generated by the Sentry server.
 */
public void onDropRole(TDropSentryRoleRequest request, TDropSentryRoleResponse response) {
 try {
  info(JSON_LOG_ENTITY.createJsonLogEntity(request, response, conf));
 } catch (Exception e) {
  String msg = "Cannot generate an audit log for creating a role: " + e.getMessage();
  ERROR_LOGGER.error(msg, e);
 }
}
origin: apache/incubator-sentry

public JsonLogEntity createJsonLogEntity(
  org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleAddGroupsRequest request,
  org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleAddGroupsResponse response,
  Configuration conf) {
 GMAuditMetadataLogEntity gmamle = createCommonGMAMLE(conf, response.getStatus(),
   request.getRequestorUserName(), request.getClass().getName(), request.getComponent());
 Joiner joiner = Joiner.on(",");
 String groups = joiner.join(request.getGroupsIterator());
 gmamle.setOperationText(CommandUtil.createCmdForRoleAddGroup(request.getRoleName(), groups));
 return gmamle;
}
origin: apache/sentry

public JsonLogEntity createJsonLogEntity(
  TAlterSentryRoleAddGroupsRequest request,
  TAlterSentryRoleAddGroupsResponse response, Configuration conf) {
 DBAuditMetadataLogEntity hamle = createCommonHAMLE(conf, response.getStatus(),
   request.getRequestorUserName(), request.getClass().getName());
 String groups = getGroupsStr(request.getGroupsIterator());
 hamle.setOperationText(CommandUtil.createCmdForRoleAddGroup(request.getRoleName(), groups));
 return hamle;
}
origin: apache/sentry

private DBAuditMetadataLogEntity createCommonHAMLE(Configuration conf,
  TSentryResponseStatus responseStatus, String userName, String requestClassName) {
 DBAuditMetadataLogEntity hamle = new DBAuditMetadataLogEntity();
 setCommAttrForAMLE(hamle, conf, responseStatus, userName, toOperationType(requestClassName),
  toObjectType(requestClassName));
 return hamle;
}
origin: apache/sentry

public JsonLogEntity createJsonLogEntity(TAlterSentryRoleAddUsersRequest request,
  TAlterSentryRoleAddUsersResponse response, Configuration conf) {
 AuditMetadataLogEntity amle = createCommonHAMLE(conf, response.getStatus(),
   request.getRequestorUserName(), request.getClass().getName());
 String users = getUsersStr(request.getUsersIterator());
 amle.setOperationText(CommandUtil.createCmdForRoleAddUser(request.getRoleName(), users));
 return amle;
}
origin: apache/incubator-sentry

@Override
public TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege(
  final TAlterSentryRoleGrantPrivilegeRequest request) throws TException {
 Response<Void> respose = requestHandle(new RequestHandler<Void>() {
  @Override
  public Response<Void> handle() throws Exception {
   validateClientVersion(request.getProtocol_version());
   CommitContext context = store.alterRoleGrantPrivilege(request.getComponent(), request.getRoleName(), toPrivilegeObject(request.getPrivilege()), request.getRequestorUserName());
   return new Response<Void>(Status.OK(), context);
  }
 });
 TAlterSentryRoleGrantPrivilegeResponse tResponse = new TAlterSentryRoleGrantPrivilegeResponse(respose.status);
 if (Status.OK.getCode() == respose.status.getValue()) {
  handerInvoker.alter_sentry_role_grant_privilege(respose.context, request, tResponse);
 }
 try {
  AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
   .createJsonLogEntity(request, tResponse, conf).toJsonFormatLog());
 } catch (Exception e) {
  // if any exception, log the exception.
  String msg = "Error creating audit log for grant privilege to role: " + e.getMessage();
  LOGGER.error(msg, e);
 }
 return tResponse;
}
origin: apache/incubator-sentry

Set<JsonLogEntity> jsonLogEntitys = JsonLogEntityFactory.getInstance().createJsonLogEntitys(
  request, response, conf);
for (JsonLogEntity jsonLogEntity : jsonLogEntitys) {
origin: apache/sentry

DBAuditMetadataLogEntity amle = new DBAuditMetadataLogEntity();
Set<JsonLogEntity> amles =  JsonLogEntityFactory
  .getInstance().createJsonLogEntities(request, response, conf);
assertEquals(amles.size(),1);
amle = (DBAuditMetadataLogEntity) amles.iterator().next();
request.setPrivileges(privileges);
response.setStatus(Status.InvalidInput("", null));
amles =  JsonLogEntityFactory.getInstance()
  .createJsonLogEntities(request, response, conf);
assertEquals(amles.size(),1);
amle = (DBAuditMetadataLogEntity) amles.iterator().next();
origin: apache/sentry

public JsonLogEntity createJsonLogEntity(TDropSentryRoleRequest request,
  TDropSentryRoleResponse response, Configuration conf) {
 DBAuditMetadataLogEntity hamle = createCommonHAMLE(conf, response.getStatus(),
   request.getRequestorUserName(), request.getClass().getName());
 hamle.setOperationText(CommandUtil.createCmdForCreateOrDropRole(
   request.getRoleName(), false));
 return hamle;
}
origin: apache/incubator-sentry

private DBAuditMetadataLogEntity createCommonHAMLE(Configuration conf,
  TSentryResponseStatus responseStatus, String userName, String requestClassName) {
 DBAuditMetadataLogEntity hamle = new DBAuditMetadataLogEntity();
 setCommAttrForAMLE(hamle, conf, responseStatus, userName, requestClassName);
 return hamle;
}
origin: apache/incubator-sentry

 private void setCommAttrForAMLE(AuditMetadataLogEntity amle, Configuration conf,
   TSentryResponseStatus responseStatus, String userName, String requestClassName) {
  amle.setUserName(userName);
  amle.setServiceName(conf.get(ServerConfig.SENTRY_SERVICE_NAME,
    ServerConfig.SENTRY_SERVICE_NAME_DEFAULT).trim());
  amle.setImpersonator(ThriftUtil.getImpersonator());
  amle.setIpAddress(ThriftUtil.getIpAddress());
  amle.setOperation(Constants.requestTypeToOperationMap.get(requestClassName));
  amle.setEventTime(Long.toString(System.currentTimeMillis()));
  amle.setAllowed(isAllowed(responseStatus));
  amle.setObjectType(Constants.requestTypeToObjectTypeMap
    .get(requestClassName));
 }
}
origin: apache/sentry

/**
 * Creates an audit log for the grant role privilege event.
 *
 * @param request The grant role privilege request received by the Sentry server.
 * @param response The grant role privilege response generated by the Sentry server.
 */
public void onGrantRolePrivilege(TAlterSentryRoleGrantPrivilegeRequest request, TAlterSentryRoleGrantPrivilegeResponse response) {
 try {
  info(JSON_LOG_ENTITY.createJsonLogEntities(request, response, conf));
 } catch (Exception e) {
  String msg = "Cannot generate an audit log for grant role privilege: " + e.getMessage();
  ERROR_LOGGER.error(msg, e);
 }
}
origin: apache/incubator-sentry

@Override
public TCreateSentryRoleResponse create_sentry_role(
  final TCreateSentryRoleRequest request) throws TException {
 Response<Void> respose = requestHandle(new RequestHandler<Void>() {
  @Override
  public Response<Void> handle() throws Exception {
   validateClientVersion(request.getProtocol_version());
   authorize(request.getRequestorUserName(),
     getRequestorGroups(conf, request.getRequestorUserName()));
   CommitContext context = store.createRole(request.getComponent(), request.getRoleName(), request.getRequestorUserName());
   return new Response<Void>(Status.OK(), context);
  }
 });
 TCreateSentryRoleResponse tResponse = new TCreateSentryRoleResponse(respose.status);
 if (Status.OK.getCode() == respose.status.getValue()) {
  handerInvoker.create_sentry_role(respose.context, request, tResponse);
 }
 try {
  AUDIT_LOGGER.info(JsonLogEntityFactory.getInstance()
   .createJsonLogEntity(request, tResponse, conf).toJsonFormatLog());
 } catch (Exception e) {
  // if any exception, log the exception.
  String msg = "Error creating audit log for create role: " + e.getMessage();
  LOGGER.error(msg, e);
 }
 return tResponse;
}
origin: apache/incubator-sentry

Set<JsonLogEntity> jsonLogEntitys = JsonLogEntityFactory.getInstance().createJsonLogEntitys(
  request, response, conf);
for (JsonLogEntity jsonLogEntity : jsonLogEntitys) {
origin: apache/sentry

DBAuditMetadataLogEntity amle = new DBAuditMetadataLogEntity();
Set<JsonLogEntity> amles =  JsonLogEntityFactory
  .getInstance().createJsonLogEntities(request, response, conf);
assertEquals(amles.size(),1);
amle = (DBAuditMetadataLogEntity) amles.iterator().next();
request.setPrivileges(privileges);
response.setStatus(Status.InvalidInput("", null));
amles =  JsonLogEntityFactory.getInstance()
  .createJsonLogEntities(request, response, conf);
assertEquals(amles.size(),1);
amle = (DBAuditMetadataLogEntity) amles.iterator().next();
origin: apache/incubator-sentry

public JsonLogEntity createJsonLogEntity(TDropSentryRoleRequest request,
  TDropSentryRoleResponse response, Configuration conf) {
 DBAuditMetadataLogEntity hamle = createCommonHAMLE(conf, response.getStatus(),
   request.getRequestorUserName(), request.getClass().getName());
 hamle.setOperationText(CommandUtil.createCmdForCreateOrDropRole(
   request.getRoleName(), false));
 return hamle;
}
origin: apache/sentry

private GMAuditMetadataLogEntity createCommonGMAMLE(Configuration conf,
  TSentryResponseStatus responseStatus, String userName, String requestClassName,
  String component) {
 GMAuditMetadataLogEntity gmamle = new GMAuditMetadataLogEntity();
 setCommAttrForAMLE(gmamle, conf, responseStatus, userName, toOperationType(requestClassName),
  toObjectType(requestClassName));
 gmamle.setComponent(component);
 return gmamle;
}
origin: apache/sentry

public JsonLogEntity createJsonLogEntity(TAlterSentryRoleDeleteUsersRequest request,
  TAlterSentryRoleDeleteUsersResponse response, Configuration conf) {
 AuditMetadataLogEntity amle = createCommonHAMLE(conf, response.getStatus(),
   request.getRequestorUserName(), request.getClass().getName());
 String users = getUsersStr(request.getUsersIterator());
 amle.setOperationText(CommandUtil.createCmdForRoleDeleteUser(request.getRoleName(), users));
 return amle;
}
origin: apache/sentry

private DBAuditMetadataLogEntity createCommonHAMLE(Configuration conf,
 TSentryResponseStatus responseStatus, String userName, String operationType, String objectType) {
 DBAuditMetadataLogEntity hamle = new DBAuditMetadataLogEntity();
 setCommAttrForAMLE(hamle, conf, responseStatus, userName, operationType, objectType);
 return hamle;
}
origin: apache/sentry

private void setCommAttrForAMLE(AuditMetadataLogEntity amle, Configuration conf,
  TSentryResponseStatus responseStatus, String userName, String operationType, String objectType) {
 amle.setUserName(userName);
 amle.setServiceName(conf.get(ServerConfig.SENTRY_SERVICE_NAME,
   ServerConfig.SENTRY_SERVICE_NAME_DEFAULT).trim());
 amle.setImpersonator(ThriftUtil.getImpersonator());
 amle.setIpAddress(ThriftUtil.getIpAddress());
 amle.setOperation(operationType);
 amle.setEventTime(Long.toString(System.currentTimeMillis()));
 amle.setAllowed(isAllowed(responseStatus));
 amle.setObjectType(objectType);
}
org.apache.sentry.provider.db.log.entityJsonLogEntityFactory

Most used methods

  • createJsonLogEntity
  • getInstance
  • createCommonGMAMLE
  • createCommonHAMLE
  • createJsonLogEntities
  • createJsonLogEntitys
  • getGroupsStr
  • isAllowed
  • setCommAttrForAMLE
  • getUsersStr
  • toObjectType
  • toOperationType
  • toObjectType,
  • toOperationType

Popular in Java

  • Updating database using SQL prepared statement
  • setContentView (Activity)
  • getResourceAsStream (ClassLoader)
  • getContentResolver (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Join (org.hibernate.mapping)
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now