Search in sources :

Example 16 with CloudbreakEventsJson

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);
}
Also used : CloudbreakEventsJson(com.sequenceiq.cloudbreak.api.model.CloudbreakEventsJson) Notification(com.sequenceiq.cloudbreak.service.notification.Notification)

Aggregations

CloudbreakEventsJson (com.sequenceiq.cloudbreak.api.model.CloudbreakEventsJson)16 Notification (com.sequenceiq.cloudbreak.service.notification.Notification)7 Date (java.util.Date)7 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)4 Stack (com.sequenceiq.cloudbreak.domain.Stack)4 Test (org.junit.Test)4 StackEndpoint (com.sequenceiq.cloudbreak.api.endpoint.common.StackEndpoint)1 EventEndpoint (com.sequenceiq.cloudbreak.api.endpoint.v1.EventEndpoint)1 StackV1Endpoint (com.sequenceiq.cloudbreak.api.endpoint.v1.StackV1Endpoint)1 Status (com.sequenceiq.cloudbreak.api.model.Status)1 InteractiveCredentialCreationStatus (com.sequenceiq.cloudbreak.cloud.event.credential.InteractiveCredentialCreationStatus)1 AbstractEntityConverterTest (com.sequenceiq.cloudbreak.converter.AbstractEntityConverterTest)1 NotificationDetails (com.sequenceiq.cloudbreak.structuredevent.event.NotificationDetails)1 OperationDetails (com.sequenceiq.cloudbreak.structuredevent.event.OperationDetails)1 StructuredNotificationEvent (com.sequenceiq.cloudbreak.structuredevent.event.StructuredNotificationEvent)1 HistoryEndpoint (com.sequenceiq.periscope.api.endpoint.v1.HistoryEndpoint)1 Scheduled (org.springframework.scheduling.annotation.Scheduled)1