use of com.sequenceiq.cloudbreak.api.model.CloudbreakEventsJson in project cloudbreak by hortonworks.
the class UptimeNotifier method createUptimeNotification.
private Notification<CloudbreakEventsJson> createUptimeNotification(Stack stack, Long uptime) {
CloudbreakEventsJson notification = new CloudbreakEventsJson();
notification.setOwner(stack.getOwner());
notification.setAccount(stack.getAccount());
notification.setStackId(stack.getId());
notification.setEventType(UPTIME_NOTIFICATION);
notification.setEventMessage(String.valueOf(uptime));
if (stack.getCredential() == null) {
notification.setCloud("null");
} else {
notification.setCloud(stack.getCredential().cloudPlatform());
}
if (stack.getCluster() == null || stack.getCluster().getBlueprint() == null) {
notification.setBlueprintId(null);
notification.setBlueprintName("null");
} else {
notification.setBlueprintId(stack.getCluster().getBlueprint().getId());
notification.setBlueprintName(stack.getCluster().getBlueprint().getAmbariName());
notification.setClusterName(stack.getCluster().getName());
notification.setClusterId(stack.getCluster().getId());
}
return new Notification<>(notification);
}
Aggregations