use of com.sequenceiq.environment.environment.dto.FreeIpaCreationAwsSpotParametersDto in project cloudbreak by hortonworks.
the class EnvironmentDetailsToCDPFreeIPADetailsConverter method convert.
public UsageProto.CDPFreeIPADetails convert(EnvironmentDetails environmentDetails) {
UsageProto.CDPFreeIPADetails.Builder cdpFreeIPADetails = UsageProto.CDPFreeIPADetails.newBuilder();
cdpFreeIPADetails.setNodes(DEFAULT_INTEGER_VALUE);
if (environmentDetails != null) {
FreeIpaCreationDto freeIpaCreationDto = environmentDetails.getFreeIpaCreation();
if (freeIpaCreationDto != null) {
cdpFreeIPADetails.setNodes(freeIpaCreationDto.getInstanceCountByGroup());
cdpFreeIPADetails.setMultiAz(freeIpaCreationDto.isEnableMultiAz());
FreeIpaCreationAwsParametersDto aws = freeIpaCreationDto.getAws();
if (aws != null) {
FreeIpaCreationAwsSpotParametersDto spot = aws.getSpot();
if (spot != null && spot.getPercentage() != null) {
cdpFreeIPADetails.setSpot(spot.getPercentage() > 0);
}
}
}
}
UsageProto.CDPFreeIPADetails ret = cdpFreeIPADetails.build();
LOGGER.debug("Converted CDPFreeIPADetails: {}", ret);
return ret;
}
Aggregations