Search in sources :

Example 1 with StackDetails

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

the class StackToStackDetailsConverter method convert.

@Override
public StackDetails convert(Stack source) {
    StackDetails stackDetails = new StackDetails();
    stackDetails.setId(source.getId());
    stackDetails.setName(source.getName());
    stackDetails.setRegion(source.getRegion());
    stackDetails.setAvailabilityZone(source.getAvailabilityZone());
    stackDetails.setDescription(source.getDescription());
    stackDetails.setCloudPlatform(source.cloudPlatform());
    stackDetails.setPlatformVariant(source.getPlatformVariant());
    stackDetails.setStatus(source.getStatus().name());
    stackDetails.setDetailedStatus(source.getStackStatus().getDetailedStackStatus().name());
    stackDetails.setStatusReason(source.getStatusReason());
    stackDetails.setInstanceGroups((List<InstanceGroupDetails>) conversionService.convert(source.getInstanceGroups(), TypeDescriptor.forObject(source.getInstanceGroups()), TypeDescriptor.collection(List.class, TypeDescriptor.valueOf(InstanceGroupDetails.class))));
    convertComponents(stackDetails, source);
    convertNetwork(stackDetails, source.getNetwork(), source.cloudPlatform());
    return stackDetails;
}
Also used : InstanceGroupDetails(com.sequenceiq.cloudbreak.structuredevent.event.InstanceGroupDetails) StackDetails(com.sequenceiq.cloudbreak.structuredevent.event.StackDetails) List(java.util.List)

Example 2 with StackDetails

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

the class StructuredFlowEventFactory method createStucturedFlowEvent.

public StructuredFlowEvent createStucturedFlowEvent(Long stackId, FlowDetails flowDetails, Boolean detailed, Exception exception) {
    Stack stack = stackService.getById(stackId);
    UserProfile userProfile = userProfileService.get(stack.getAccount(), stack.getOwner());
    OperationDetails operationDetails = new OperationDetails("FLOW", "STACK", stackId, stack.getAccount(), stack.getOwner(), userProfile.getUserName(), cloudbreakNodeConfig.getId(), cbVersion);
    StackDetails stackDetails = null;
    ClusterDetails clusterDetails = null;
    BlueprintDetails blueprintDetails = null;
    if (detailed) {
        stackDetails = conversionService.convert(stack, StackDetails.class);
        Cluster cluster = stack.getCluster();
        if (cluster != null) {
            clusterDetails = conversionService.convert(cluster, ClusterDetails.class);
            blueprintDetails = conversionService.convert(cluster.getBlueprint(), BlueprintDetails.class);
        }
    }
    return exception != null ? new StructuredFlowErrorEvent(operationDetails, flowDetails, stackDetails, clusterDetails, blueprintDetails, ExceptionUtils.getStackTrace(exception)) : new StructuredFlowEvent(operationDetails, flowDetails, stackDetails, clusterDetails, blueprintDetails);
}
Also used : OperationDetails(com.sequenceiq.cloudbreak.structuredevent.event.OperationDetails) UserProfile(com.sequenceiq.cloudbreak.domain.UserProfile) BlueprintDetails(com.sequenceiq.cloudbreak.structuredevent.event.BlueprintDetails) ClusterDetails(com.sequenceiq.cloudbreak.structuredevent.event.ClusterDetails) StructuredFlowErrorEvent(com.sequenceiq.cloudbreak.structuredevent.event.StructuredFlowErrorEvent) StackDetails(com.sequenceiq.cloudbreak.structuredevent.event.StackDetails) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) StructuredFlowEvent(com.sequenceiq.cloudbreak.structuredevent.event.StructuredFlowEvent) Stack(com.sequenceiq.cloudbreak.domain.Stack)

Aggregations

StackDetails (com.sequenceiq.cloudbreak.structuredevent.event.StackDetails)2 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)1 Stack (com.sequenceiq.cloudbreak.domain.Stack)1 UserProfile (com.sequenceiq.cloudbreak.domain.UserProfile)1 BlueprintDetails (com.sequenceiq.cloudbreak.structuredevent.event.BlueprintDetails)1 ClusterDetails (com.sequenceiq.cloudbreak.structuredevent.event.ClusterDetails)1 InstanceGroupDetails (com.sequenceiq.cloudbreak.structuredevent.event.InstanceGroupDetails)1 OperationDetails (com.sequenceiq.cloudbreak.structuredevent.event.OperationDetails)1 StructuredFlowErrorEvent (com.sequenceiq.cloudbreak.structuredevent.event.StructuredFlowErrorEvent)1 StructuredFlowEvent (com.sequenceiq.cloudbreak.structuredevent.event.StructuredFlowEvent)1 List (java.util.List)1