Search in sources :

Example 1 with CloudbreakEventsJson

use of com.sequenceiq.cloudbreak.api.model.CloudbreakEventsJson in project cloudbreak by hortonworks.

the class InteractiveCredentialCreationHandler method sendErrorNotification.

public void sendErrorNotification(String owner, String account, String cloudPlatform, String errorMessage) {
    CloudbreakEventsJson notification = new CloudbreakEventsJson();
    notification.setEventType("CREDENTIAL_CREATE_FAILED");
    notification.setEventTimestamp(new Date().getTime());
    notification.setEventMessage(errorMessage);
    notification.setOwner(owner);
    notification.setAccount(account);
    notification.setCloud(cloudPlatform);
    notificationSender.send(new Notification<>(notification));
}
Also used : CloudbreakEventsJson(com.sequenceiq.cloudbreak.api.model.CloudbreakEventsJson) Date(java.util.Date)

Example 2 with CloudbreakEventsJson

use of com.sequenceiq.cloudbreak.api.model.CloudbreakEventsJson in project cloudbreak by hortonworks.

the class ImageStatusCheckerTask method getImageCopyNotification.

private Notification<CloudbreakEventsJson> getImageCopyNotification(ImageStatusResult result, Stack stack) {
    CloudbreakEventsJson notification = new CloudbreakEventsJson();
    notification.setEventType("IMAGE_COPY_STATE");
    notification.setEventTimestamp(new Date().getTime());
    notification.setEventMessage(String.valueOf(result.getStatusProgressValue()));
    notification.setOwner(stack.getOwner());
    notification.setAccount(stack.getAccount());
    notification.setCloud(stack.cloudPlatform());
    notification.setRegion(stack.getRegion());
    notification.setStackId(stack.getId());
    notification.setStackName(stack.getDisplayName());
    notification.setStackStatus(stack.getStatus());
    return new Notification<>(notification);
}
Also used : CloudbreakEventsJson(com.sequenceiq.cloudbreak.api.model.CloudbreakEventsJson) Date(java.util.Date) Notification(com.sequenceiq.cloudbreak.service.notification.Notification)

Example 3 with CloudbreakEventsJson

use of com.sequenceiq.cloudbreak.api.model.CloudbreakEventsJson in project cloudbreak by hortonworks.

the class AmbariOperationsStatusCheckerTask method getAmbariProgressNotification.

private Notification<CloudbreakEventsJson> getAmbariProgressNotification(Long progressValue, Stack stack, AmbariOperationType ambariOperationType) {
    CloudbreakEventsJson notification = new CloudbreakEventsJson();
    notification.setEventType(ambariOperationType.name());
    notification.setEventTimestamp(new Date().getTime());
    notification.setEventMessage(String.valueOf(progressValue));
    notification.setOwner(stack.getOwner());
    notification.setAccount(stack.getAccount());
    notification.setCloud(stack.cloudPlatform());
    notification.setRegion(stack.getRegion());
    notification.setStackId(stack.getId());
    notification.setStackName(stack.getDisplayName());
    notification.setStackStatus(stack.getStatus());
    if (stack.getCluster() != null) {
        notification.setClusterId(stack.getCluster().getId());
        notification.setClusterName(stack.getCluster().getName());
    }
    return new Notification<>(notification);
}
Also used : CloudbreakEventsJson(com.sequenceiq.cloudbreak.api.model.CloudbreakEventsJson) Date(java.util.Date) Notification(com.sequenceiq.cloudbreak.service.notification.Notification)

Example 4 with CloudbreakEventsJson

use of com.sequenceiq.cloudbreak.api.model.CloudbreakEventsJson in project cloudbreak by hortonworks.

the class StructuredNotificationEventToCloudbreakEventJsonConverter method convert.

@Override
public CloudbreakEventsJson convert(StructuredNotificationEvent source) {
    CloudbreakEventsJson cloudbreakEvent = new CloudbreakEventsJson();
    NotificationDetails notificationDetails = source.getNotificationDetails();
    OperationDetails operationDetails = source.getOperation();
    cloudbreakEvent.setEventType(notificationDetails.getNotificationType());
    cloudbreakEvent.setEventTimestamp(operationDetails.getTimestamp());
    cloudbreakEvent.setEventMessage(notificationDetails.getNotification());
    cloudbreakEvent.setOwner(operationDetails.getUserId());
    cloudbreakEvent.setAccount(operationDetails.getAccount());
    cloudbreakEvent.setCloud(notificationDetails.getCloud());
    cloudbreakEvent.setRegion(notificationDetails.getRegion());
    cloudbreakEvent.setAvailabilityZone(notificationDetails.getAvailabiltyZone());
    cloudbreakEvent.setBlueprintId(notificationDetails.getBlueprintId());
    cloudbreakEvent.setBlueprintName(notificationDetails.getBlueprintName());
    cloudbreakEvent.setClusterId(notificationDetails.getClusterId());
    cloudbreakEvent.setClusterName(notificationDetails.getClusterName());
    cloudbreakEvent.setStackId(notificationDetails.getStackId());
    cloudbreakEvent.setStackName(notificationDetails.getStackName());
    cloudbreakEvent.setStackStatus(Status.valueOf(notificationDetails.getStackStatus()));
    cloudbreakEvent.setNodeCount(notificationDetails.getNodeCount());
    cloudbreakEvent.setInstanceGroup(notificationDetails.getInstanceGroup());
    if (notificationDetails.getClusterStatus() != null) {
        cloudbreakEvent.setClusterStatus(Status.valueOf(notificationDetails.getClusterStatus()));
    }
    return cloudbreakEvent;
}
Also used : OperationDetails(com.sequenceiq.cloudbreak.structuredevent.event.OperationDetails) CloudbreakEventsJson(com.sequenceiq.cloudbreak.api.model.CloudbreakEventsJson) NotificationDetails(com.sequenceiq.cloudbreak.structuredevent.event.NotificationDetails)

Example 5 with CloudbreakEventsJson

use of com.sequenceiq.cloudbreak.api.model.CloudbreakEventsJson in project cloudbreak by hortonworks.

the class StackCreationService method getImageCopyNotification.

private Notification<CloudbreakEventsJson> getImageCopyNotification(CheckImageResult result, Stack stack) {
    CloudbreakEventsJson notification = new CloudbreakEventsJson();
    notification.setEventType("IMAGE_COPY_STATE");
    notification.setEventTimestamp(new Date().getTime());
    notification.setEventMessage(String.valueOf(result.getStatusProgressValue()));
    notification.setOwner(stack.getOwner());
    notification.setAccount(stack.getAccount());
    notification.setCloud(stack.cloudPlatform());
    notification.setRegion(stack.getRegion());
    notification.setStackId(stack.getId());
    notification.setStackName(stack.getDisplayName());
    notification.setStackStatus(stack.getStatus());
    return new Notification<>(notification);
}
Also used : CloudbreakEventsJson(com.sequenceiq.cloudbreak.api.model.CloudbreakEventsJson) Date(java.util.Date) 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