Search in sources :

Example 1 with CDPStructuredNotificationDetails

use of com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPStructuredNotificationDetails in project cloudbreak by hortonworks.

the class EventSenderService method getStructuredEvent.

private CDPStructuredNotificationEvent getStructuredEvent(AccountAwareResource resource, ResourceEvent resourceEvent, Object payload, Collection<?> messageArgs) {
    String resourceType = resource.getClass().getSimpleName().toLowerCase();
    String resourceCrn = resource.getResourceCrn();
    CDPOperationDetails operationDetails = new CDPOperationDetails(System.currentTimeMillis(), NOTIFICATION, resourceType, resource.getId(), resource.getName(), nodeConfig.getId(), serviceVersion, resource.getAccountId(), resourceCrn, ThreadBasedUserCrnProvider.getUserCrn(), resourceCrn, resourceEvent.name());
    CDPStructuredNotificationDetails notificationDetails = getNotificationDetails(resourceEvent, resourceCrn, resourceType, payload);
    String message = cloudbreakMessagesService.getMessage(resourceEvent.getMessage(), messageArgs);
    return new CDPStructuredNotificationEvent(operationDetails, notificationDetails, resourceEvent.name(), message);
}
Also used : CDPStructuredNotificationDetails(com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPStructuredNotificationDetails) CDPOperationDetails(com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPOperationDetails) CDPStructuredNotificationEvent(com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPStructuredNotificationEvent)

Example 2 with CDPStructuredNotificationDetails

use of com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPStructuredNotificationDetails in project cloudbreak by hortonworks.

the class EventSenderService method getStructuredEvent.

private CDPStructuredNotificationEvent getStructuredEvent(AccountAwareResource resource, ResourceEvent resourceEvent, Object payload, Collection<?> messageArgs) {
    String resourceType = resource.getClass().getSimpleName().toLowerCase();
    String resourceCrn = resource.getResourceCrn();
    CDPOperationDetails operationDetails = new CDPOperationDetails(System.currentTimeMillis(), NOTIFICATION, resourceType, resource.getId(), resource.getName(), nodeConfig.getId(), serviceVersion, resource.getAccountId(), resourceCrn, ThreadBasedUserCrnProvider.getUserCrn(), resourceCrn, resourceEvent.name());
    CDPStructuredNotificationDetails notificationDetails = getNotificationDetails(resourceEvent, resourceCrn, resourceType, payload);
    String message = cloudbreakMessagesService.getMessage(resourceEvent.getMessage(), messageArgs);
    return new CDPStructuredNotificationEvent(operationDetails, notificationDetails, resourceEvent.name(), message);
}
Also used : CDPStructuredNotificationDetails(com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPStructuredNotificationDetails) CDPOperationDetails(com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPOperationDetails) CDPStructuredNotificationEvent(com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPStructuredNotificationEvent)

Example 3 with CDPStructuredNotificationDetails

use of com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPStructuredNotificationDetails in project cloudbreak by hortonworks.

the class EventSenderService method createStructureEventForMissingEnvironment.

private CDPStructuredNotificationEvent createStructureEventForMissingEnvironment(BaseNamedFlowEvent payload, ResourceEvent resourceEvent, String userCrn) {
    String resourceType = payload.getClass().getSimpleName().toLowerCase();
    String resourceCrn = payload.getResourceCrn();
    CDPOperationDetails operationDetails = new CDPOperationDetails(System.currentTimeMillis(), NOTIFICATION, resourceType, payload.getResourceId(), payload.getResourceName(), nodeConfig.getId(), serviceVersion, null, resourceCrn, userCrn, resourceCrn, resourceEvent.name());
    CDPStructuredNotificationDetails notificationDetails = getNotificationDetails(resourceEvent, resourceCrn, resourceType, payload);
    String message = cloudbreakMessagesService.getMessage(resourceEvent.getMessage());
    return new CDPStructuredNotificationEvent(operationDetails, notificationDetails, resourceEvent.name(), message);
}
Also used : CDPStructuredNotificationDetails(com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPStructuredNotificationDetails) CDPOperationDetails(com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPOperationDetails) CDPStructuredNotificationEvent(com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPStructuredNotificationEvent)

Aggregations

CDPOperationDetails (com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPOperationDetails)3 CDPStructuredNotificationDetails (com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPStructuredNotificationDetails)3 CDPStructuredNotificationEvent (com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPStructuredNotificationEvent)3