Search in sources :

Example 1 with InstanceTemplateV4Base

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceTemplateV4Base 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());
    });
}
Also used : AwsInstanceTemplateV4Parameters(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AwsInstanceTemplateV4Parameters) AwsInstanceTemplateV4SpotParameters(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AwsInstanceTemplateV4SpotParameters)

Aggregations

AwsInstanceTemplateV4Parameters (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AwsInstanceTemplateV4Parameters)1 AwsInstanceTemplateV4SpotParameters (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AwsInstanceTemplateV4SpotParameters)1