use of com.sequenceiq.periscope.model.json.Json in project cloudbreak by hortonworks.
the class AuditService method auditAutoscaleServiceEvent.
@Async
public void auditAutoscaleServiceEvent(ScalingStatus scalingStatus, String auditMessage, String clusterCrn, String accountId, Long timestamp) {
AuditEvent event = null;
try {
Map<String, Object> eventDetails = new HashMap<>();
eventDetails.put(CLUSTER_CRN, clusterCrn);
eventDetails.put(TIMESTAMP, timestamp);
eventDetails.put(AUTOSCALE_ACTION, auditMessage);
eventDetails.put(AUTOSCALE_TRIGGER_STATUS, scalingStatus);
ServiceEventData serviceEventData = ServiceEventData.builder().withEventDetails(new Json(eventDetails).getValue()).withVersion(periscopeVersion).build();
event = AuditEvent.builder().withAccountId(accountId).withEventData(serviceEventData).withEventName(AuditEventName.AUTOSCALE_DATAHUB_CLUSTER).withEventSource(Crn.Service.DATAHUB).withActor(ActorService.builder().withActorServiceName(Crn.Service.DATAHUB.getName()).build()).build();
auditClient.createAuditEvent(event);
} catch (Exception ex) {
LOGGER.warn("Service Audit event creation failed, error : '{}', event : '{}'", ex.getMessage(), event, ex);
}
}
use of com.sequenceiq.periscope.model.json.Json in project cloudbreak by hortonworks.
the class AuditService method auditRestApi.
@Async
public void auditRestApi(Map<String, Object> requestParameters, boolean mutating, String userAgent, String userCrn, String accountId, String sourceIp) {
AuditEvent event = null;
try {
ApiRequestData apiRequestData = ApiRequestData.builder().withApiVersion(periscopeVersion).withMutating(mutating).withRequestParameters(new Json(requestParameters).getValue()).withUserAgent(userAgent).build();
event = AuditEvent.builder().withAccountId(accountId).withActor(ActorCrn.builder().withActorCrn(userCrn).build()).withEventData(apiRequestData).withEventName(AuditEventName.MANAGE_AUTOSCALE_DATAHUB_CLUSTER).withEventSource(Crn.Service.DATAHUB).withSourceIp(sourceIp).build();
auditClient.createAuditEvent(event);
} catch (Exception ex) {
LOGGER.warn("API Audit event creation failed, error : '{}', event : '{}'", ex.getMessage(), event, ex);
}
}
Aggregations