Search in sources :

Example 1 with FreeIpaCreationAwsParametersDto

use of com.sequenceiq.environment.environment.dto.FreeIpaCreationAwsParametersDto 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;
}
Also used : FreeIpaCreationDto(com.sequenceiq.environment.environment.dto.FreeIpaCreationDto) FreeIpaCreationAwsSpotParametersDto(com.sequenceiq.environment.environment.dto.FreeIpaCreationAwsSpotParametersDto) FreeIpaCreationAwsParametersDto(com.sequenceiq.environment.environment.dto.FreeIpaCreationAwsParametersDto) UsageProto(com.cloudera.thunderhead.service.common.usage.UsageProto)

Aggregations

UsageProto (com.cloudera.thunderhead.service.common.usage.UsageProto)1 FreeIpaCreationAwsParametersDto (com.sequenceiq.environment.environment.dto.FreeIpaCreationAwsParametersDto)1 FreeIpaCreationAwsSpotParametersDto (com.sequenceiq.environment.environment.dto.FreeIpaCreationAwsSpotParametersDto)1 FreeIpaCreationDto (com.sequenceiq.environment.environment.dto.FreeIpaCreationDto)1