use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AwsInstanceTemplateV4SpotParameters 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.base.parameter.template.AwsInstanceTemplateV4SpotParameters in project cloudbreak by hortonworks.
the class InstanceTemplateParameterConverter method convert.
private AwsInstanceTemplateV4SpotParameters convert(AwsInstanceTemplateV1SpotParameters source) {
AwsInstanceTemplateV4SpotParameters target = new AwsInstanceTemplateV4SpotParameters();
target.setPercentage(source.getPercentage());
target.setMaxPrice(source.getMaxPrice());
return target;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AwsInstanceTemplateV4SpotParameters in project cloudbreak by hortonworks.
the class SdxService method updateAwsSpotParameters.
private void updateAwsSpotParameters(StackV4Request stackRequest, SdxAwsSpotParameters sdxSpotParameters) {
stackRequest.getInstanceGroups().stream().map(InstanceGroupV4Request::getTemplate).peek(template -> {
if (template.getAws() == null) {
template.setAws(new AwsInstanceTemplateV4Parameters());
}
}).map(InstanceTemplateV4Base::getAws).peek(aws -> {
if (aws.getSpot() == null) {
aws.setSpot(new AwsInstanceTemplateV4SpotParameters());
}
}).map(AwsInstanceTemplateV4Parameters::getSpot).forEach(spot -> {
spot.setPercentage(sdxSpotParameters.getPercentage());
spot.setMaxPrice(sdxSpotParameters.getMaxPrice());
});
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AwsInstanceTemplateV4SpotParameters in project cloudbreak by hortonworks.
the class AwsCloudProvider method template.
@Override
public InstanceTemplateV4TestDto template(InstanceTemplateV4TestDto template) {
AwsInstanceTemplateV4Parameters aws = new AwsInstanceTemplateV4Parameters();
AwsInstanceTemplateV4SpotParameters spot = new AwsInstanceTemplateV4SpotParameters();
spot.setPercentage(getSpotPercentage());
aws.setSpot(spot);
return template.withInstanceType(awsProperties.getInstance().getType()).withAws(aws);
}
Aggregations