Search in sources :

Example 1 with DistroXScaleV1Request

use of com.sequenceiq.distrox.api.v1.distrox.model.DistroXScaleV1Request in project cloudbreak by hortonworks.

the class DistroXScaleAction method action.

@Override
public DistroXTestDto action(TestContext testContext, DistroXTestDto testDto, CloudbreakClient client) throws Exception {
    Log.when(LOGGER, String.format("Distrox scale request on: %s. Hostgroup: %s, desiredCount: %d", testDto.getName(), hostGroup, desiredCount));
    Log.whenJson(LOGGER, " Distrox scale request: ", testDto.getRequest());
    DistroXScaleV1Request scaleRequest = new DistroXScaleV1Request();
    scaleRequest.setGroup(hostGroup);
    scaleRequest.setDesiredCount(desiredCount);
    scaleRequest.setAdjustmentType(adjustmentType);
    scaleRequest.setThreshold(threshold);
    FlowIdentifier flowIdentifier = client.getDefaultClient().distroXV1Endpoint().putScalingByName(testDto.getName(), scaleRequest);
    StackV4Response stackV4Response = client.getDefaultClient().distroXV1Endpoint().getByName(testDto.getName(), new HashSet<>(Arrays.asList("hardware_info", "events")));
    testDto.setFlow("Distrox scale", flowIdentifier);
    testDto.setResponse(stackV4Response);
    Log.whenJson(LOGGER, " Distrox scale response: ", stackV4Response);
    LOGGER.info("Hardware info for stack after upscale: {}", stackV4Response.getHardwareInfoGroups());
    return testDto;
}
Also used : DistroXScaleV1Request(com.sequenceiq.distrox.api.v1.distrox.model.DistroXScaleV1Request) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) FlowIdentifier(com.sequenceiq.flow.api.model.FlowIdentifier)

Aggregations

StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)1 DistroXScaleV1Request (com.sequenceiq.distrox.api.v1.distrox.model.DistroXScaleV1Request)1 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)1