use of com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPStructuredNotificationEvent in project cloudbreak by hortonworks.
the class CDPStructuredEventV1Controller method getAuditEventsZipResponse.
private Response getAuditEventsZipResponse(Collection<CDPStructuredNotificationEvent> events, String resourceCrn) {
StreamingOutput streamingOutput = output -> {
try (ZipOutputStream zipOutputStream = new ZipOutputStream(output)) {
zipOutputStream.putNextEntry(new ZipEntry("struct-events.json"));
zipOutputStream.write(JsonUtil.writeValueAsString(events).getBytes());
zipOutputStream.closeEntry();
}
};
String resourceType = Crn.safeFromString(resourceCrn).getResourceType().getName();
String fileName = String.format("audit-%s.zip", resourceType);
return Response.ok(streamingOutput).header("content-disposition", String.format("attachment; filename = %s", fileName)).build();
}
use of com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPStructuredNotificationEvent in project cloudbreak by hortonworks.
the class CDPStructuredEventV1ControllerTest method createCDPStructuredNotificationEvent.
private CDPStructuredNotificationEvent createCDPStructuredNotificationEvent() {
CDPStructuredNotificationEvent event = new CDPStructuredNotificationEvent();
event.setOperation(createTestCDPStructuredEvent().getOperation());
return event;
}
use of com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPStructuredNotificationEvent in project cloudbreak by hortonworks.
the class EventSenderService method sendEventAndNotificationForMissingEnv.
public void sendEventAndNotificationForMissingEnv(BaseNamedFlowEvent payload, ResourceEvent resourceEvent, String userCrn) {
CDPStructuredNotificationEvent cdpStructuredEvent = createStructureEventForMissingEnvironment(payload, resourceEvent, userCrn);
cdpDefaultStructuredEventClient.sendStructuredEvent(cdpStructuredEvent);
notificationService.send(resourceEvent, payload, userCrn);
}
use of com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPStructuredNotificationEvent in project cloudbreak by hortonworks.
the class SdxEventsServiceTests method createCDPStructuredNotificationEvent.
private CDPStructuredEvent createCDPStructuredNotificationEvent(Long timestamp) {
CDPOperationDetails operationDetails = new CDPOperationDetails();
operationDetails.setResourceCrn("someCrn");
operationDetails.setResourceType("datalake");
operationDetails.setTimestamp(timestamp);
operationDetails.setEventType(StructuredEventType.NOTIFICATION);
CDPStructuredNotificationEvent cdpStructuredEvent = new CDPStructuredNotificationEvent() {
@Override
public String getStatus() {
return SENT;
}
@Override
public Long getDuration() {
return 1L;
}
};
cdpStructuredEvent.setOperation(operationDetails);
return cdpStructuredEvent;
}
use of com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPStructuredNotificationEvent in project cloudbreak by hortonworks.
the class EventSenderService method sendEventAndNotificationWithPayload.
public void sendEventAndNotificationWithPayload(AccountAwareResource resource, String userCrn, ResourceEvent resourceEvent, Object payload, Collection<?> messageArgs) {
CDPStructuredNotificationEvent cdpStructuredEvent = getStructuredEvent(resource, resourceEvent, payload, messageArgs);
cdpDefaultStructuredEventClient.sendStructuredEvent(cdpStructuredEvent);
}
Aggregations