use of com.sequenceiq.cloudbreak.structuredevent.event.OperationDetails in project cloudbreak by hortonworks.
the class StructuredFlowEventFactory method createStructuredNotificationEvent.
public StructuredNotificationEvent createStructuredNotificationEvent(Long stackId, String notificationType, String message, String instanceGroupName) {
Stack stack = stackService.getById(stackId);
UserProfile userProfile = userProfileService.get(stack.getAccount(), stack.getOwner());
OperationDetails operationDetails = new OperationDetails("NOTIFICATION", "STACK", stackId, stack.getAccount(), stack.getOwner(), userProfile.getUserName(), cloudbreakNodeConfig.getInstanceUUID(), cbVersion);
NotificationDetails notificationDetails = new NotificationDetails();
notificationDetails.setNotificationType(notificationType);
notificationDetails.setNotification(message);
notificationDetails.setCloud(stack.cloudPlatform());
notificationDetails.setRegion(stack.getRegion());
notificationDetails.setAvailabiltyZone(stack.getAvailabilityZone());
notificationDetails.setStackId(stackId);
notificationDetails.setStackName(stack.getDisplayName());
notificationDetails.setStackStatus(stack.getStatus().name());
notificationDetails.setNodeCount(stack.getRunningInstanceMetaData().size());
notificationDetails.setInstanceGroup(instanceGroupName);
Cluster cluster = stack.getCluster();
if (cluster != null) {
notificationDetails.setClusterId(cluster.getId());
notificationDetails.setClusterName(cluster.getName());
notificationDetails.setClusterStatus(cluster.getStatus().name());
Blueprint blueprint = cluster.getBlueprint();
if (blueprint != null) {
notificationDetails.setBlueprintId(blueprint.getId());
notificationDetails.setBlueprintName(blueprint.getAmbariName());
}
}
return new StructuredNotificationEvent(operationDetails, notificationDetails);
}
use of com.sequenceiq.cloudbreak.structuredevent.event.OperationDetails in project cloudbreak by hortonworks.
the class StructuredEventFilter method createOperationDetails.
private OperationDetails createOperationDetails(Map<String, String> restParams, Long requestTime) {
IdentityUser user = authenticatedUserService.getCbUser();
String resoureceId = restParams.get(RESOURCE_ID);
return new OperationDetails(requestTime, "REST", restParams.get(RESOURCE_TYPE), resoureceId != null ? Long.valueOf(resoureceId) : null, user != null ? user.getAccount() : "", user != null ? user.getUserId() : "", user != null ? user.getUsername() : "", cloudbreakNodeConfig.getId(), cbVersion);
}
Aggregations