use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request in project cloudbreak by hortonworks.
the class FreeIpaTestDto method mapInstanceTemplateRequest.
private InstanceTemplateRequest mapInstanceTemplateRequest(InstanceGroupV4Request request) {
InstanceTemplateRequest template = new InstanceTemplateRequest();
template.setInstanceType(request.getTemplate().getInstanceType());
template.setAttachedVolumes(request.getTemplate().getAttachedVolumes().stream().map(volreq -> {
VolumeRequest volumeRequest = new VolumeRequest();
volumeRequest.setCount(volreq.getCount());
volumeRequest.setSize(volreq.getSize());
volumeRequest.setType(volreq.getType());
return volumeRequest;
}).collect(Collectors.toSet()));
Optional.ofNullable(request.getTemplate().getAws()).map(AwsInstanceTemplateV4Parameters::getSpot).map(AwsInstanceTemplateV4SpotParameters::getPercentage).ifPresent(spotPercentage -> {
AwsInstanceTemplateParameters awsInstanceTemplateParameters = new AwsInstanceTemplateParameters();
AwsInstanceTemplateSpotParameters awsInstanceTemplateSpotParameters = new AwsInstanceTemplateSpotParameters();
awsInstanceTemplateSpotParameters.setPercentage(spotPercentage);
awsInstanceTemplateParameters.setSpot(awsInstanceTemplateSpotParameters);
template.setAws(awsInstanceTemplateParameters);
});
return template;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request in project cloudbreak by hortonworks.
the class InstanceGroupV1ToInstanceGroupV4Converter method convert.
private InstanceGroupV4Request convert(NetworkV4Request network, InstanceGroupV1Request source, DetailedEnvironmentResponse environment) {
InstanceGroupV4Request response = new InstanceGroupV4Request();
response.setNodeCount(source.getNodeCount());
response.setType(source.getType());
response.setCloudPlatform(source.getCloudPlatform());
response.setName(source.getName());
response.setTemplate(getIfNotNull(source.getTemplate(), environment, instanceTemplateConverter::convert));
response.setRecoveryMode(source.getRecoveryMode());
response.setScalabilityOption(source.getScalabilityOption());
response.setSecurityGroup(createSecurityGroupFromEnvironment(source.getType(), environment));
response.setRecipeNames(source.getRecipeNames());
response.setMinimumNodeCount(source.getMinimumNodeCount());
response.setAws(getIfNotNull(source.getAws(), instanceGroupParameterConverter::convert));
response.setAzure(getIfNotNull(source.getAzure(), instanceGroupParameterConverter::convert));
response.setGcp(getIfNotNull(source.getGcp(), instanceGroupParameterConverter::convert));
response.setYarn(getIfNotNull(source.getYarn(), instanceGroupParameterConverter::convert));
response.setNetwork(getInstanceGroupNetworkV4Request(network, source, environment));
return response;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request in project cloudbreak by hortonworks.
the class StackV4RequestToTemplatePreparationObjectConverterTest method createInstanceGroups.
private List<InstanceGroupV4Request> createInstanceGroups() {
List<InstanceGroupV4Request> instanceGroups = new ArrayList<>(GENERAL_TEST_QUANTITY);
for (int i = 0; i < GENERAL_TEST_QUANTITY; i++) {
InstanceGroupV4Request instanceGroup = new InstanceGroupV4Request();
InstanceTemplateV4Request template = new InstanceTemplateV4Request();
template.setAttachedVolumes(Collections.EMPTY_SET);
instanceGroup.setName(String.format("group-%d", i));
instanceGroup.setTemplate(template);
instanceGroup.setType(InstanceGroupType.CORE);
instanceGroup.setNodeCount(i);
instanceGroups.add(instanceGroup);
}
return instanceGroups;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request in project cloudbreak by hortonworks.
the class NodeCountLimitValidatorTest method stackV4Request.
private StackV4Request stackV4Request(int nodeCount) {
StackV4Request stackV4Request = new StackV4Request();
InstanceGroupV4Request instanceGroupV4Request = new InstanceGroupV4Request();
instanceGroupV4Request.setNodeCount(nodeCount);
stackV4Request.setInstanceGroups(Lists.newArrayList(instanceGroupV4Request));
return stackV4Request;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request in project cloudbreak by hortonworks.
the class InstanceGroupV1ToInstanceGroupV4ConverterTest method prepareInstanceGroupV4Requests.
private List<InstanceGroupV4Request> prepareInstanceGroupV4Requests(InstanceGroupType instanceGroupType) {
InstanceGroupV4Request instanceGroup = new InstanceGroupV4Request();
instanceGroup.setAws(AWS_INSTANCE_GROUP_V4_PARAMETERS);
instanceGroup.setName(INSTANCE_GROUP_NAME);
if (InstanceGroupType.GATEWAY.equals(instanceGroupType)) {
instanceGroup.setNodeCount(1);
} else {
instanceGroup.setNodeCount(NODE_COUNT_1);
}
instanceGroup.setRecipeNames(RECIPE_NAMES);
instanceGroup.setRecoveryMode(RecoveryMode.AUTO);
instanceGroup.setTemplate(new InstanceTemplateV4Request());
instanceGroup.setType(instanceGroupType);
return List.of(instanceGroup);
}
Aggregations