Search in sources :

Example 6 with AvailabilityType

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.AvailabilityType in project cloudbreak by hortonworks.

the class FreeIpaScalingService method downscale.

public DownscaleResponse downscale(String accountId, DownscaleRequest request) {
    Stack stack = stackService.getByEnvironmentCrnAndAccountIdWithListsAndMdcContext(request.getEnvironmentCrn(), accountId);
    Set<InstanceMetaData> allInstances = stack.getNotDeletedInstanceMetaDataSet();
    AvailabilityType originalAvailabilityType = AvailabilityType.getByInstanceCount(allInstances.size());
    logRequest(OperationType.DOWNSCALE, request, originalAvailabilityType);
    validationService.validateStackForDownscale(allInstances, stack, new ScalingPath(originalAvailabilityType, request.getTargetAvailabilityType()));
    return triggerDownscale(request, stack, originalAvailabilityType);
}
Also used : InstanceMetaData(com.sequenceiq.freeipa.entity.InstanceMetaData) ScalingPath(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.scale.ScalingPath) AvailabilityType(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.AvailabilityType) Stack(com.sequenceiq.freeipa.entity.Stack)

Aggregations

AvailabilityType (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.AvailabilityType)4 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)3 ScalingPath (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.scale.ScalingPath)3 InstanceMetaData (com.sequenceiq.freeipa.entity.InstanceMetaData)3 Stack (com.sequenceiq.freeipa.entity.Stack)3 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)2 Operation (com.sequenceiq.freeipa.entity.Operation)2 DownscaleResponse (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.scale.DownscaleResponse)1 UpscaleResponse (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.scale.UpscaleResponse)1 DownscaleEvent (com.sequenceiq.freeipa.flow.freeipa.downscale.event.DownscaleEvent)1 UpscaleEvent (com.sequenceiq.freeipa.flow.freeipa.upscale.event.UpscaleEvent)1 List (java.util.List)1 Test (org.junit.jupiter.api.Test)1