use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.scale.DownscaleRequest in project cloudbreak by hortonworks.
the class FreeIpaDownscaleAction method action.
@Override
public FreeIpaDownscaleTestDto action(TestContext testContext, FreeIpaDownscaleTestDto testDto, FreeIpaClient client) throws Exception {
Log.whenJson(LOGGER, format(" FreeIPA downscale request:%n"), testDto.getRequest());
DownscaleRequest downscaleRequest = new DownscaleRequest();
downscaleRequest.setEnvironmentCrn(testDto.getRequest().getEnvironmentCrn());
downscaleRequest.setTargetAvailabilityType(testDto.getRequest().getTargetAvailabilityType());
testDto.setResponse(client.getDefaultClient().getFreeIpaV1Endpoint().downscale(downscaleRequest));
testDto.setFlow("FreeIPA downscale", testDto.getResponse().getFlowIdentifier());
testDto.setOperationId(testDto.getResponse().getOperationId());
Log.whenJson(LOGGER, format(" FreeIPA downscale started: %n"), testDto.getResponse());
return testDto;
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.scale.DownscaleRequest 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);
}
Aggregations