Search in sources :

Example 1 with InstanceOfferRequestVO

use of com.epam.pipeline.controller.vo.InstanceOfferRequestVO in project cloud-pipeline by epam.

the class InstanceOfferManager method getAllInstanceTypes.

public List<InstanceType> getAllInstanceTypes() {
    InstanceOfferRequestVO requestVO = new InstanceOfferRequestVO();
    requestVO.setTermType(ON_DEMAND_TERM_TYPE);
    requestVO.setOperatingSystem(LINUX_OPERATING_SYSTEM);
    requestVO.setTenancy(SHARED_TENANCY);
    requestVO.setUnit(HOURS_UNIT);
    requestVO.setProductFamily(INSTANCE_PRODUCT_FAMILY);
    return instanceOfferDao.loadInstanceTypes(requestVO);
}
Also used : InstanceOfferRequestVO(com.epam.pipeline.controller.vo.InstanceOfferRequestVO)

Example 2 with InstanceOfferRequestVO

use of com.epam.pipeline.controller.vo.InstanceOfferRequestVO in project cloud-pipeline by epam.

the class InstanceOfferManager method getPriceForDisk.

private double getPriceForDisk(int instanceDisk, String regionId) {
    InstanceOfferRequestVO requestVO = new InstanceOfferRequestVO();
    requestVO.setProductFamily(STORAGE_PRODUCT_FAMILY);
    requestVO.setVolumeType(GENERAL_PURPOSE_VOLUME_TYPE);
    requestVO.setRegion(regionId);
    List<InstanceOffer> offers = instanceOfferDao.loadInstanceOffers(requestVO);
    if (offers.size() == 1) {
        return offers.get(0).getPricePerUnit() / (DAYS_IN_MONTH * HOURS_IN_DAY) * instanceDisk;
    }
    return 0;
}
Also used : InstanceOffer(com.epam.pipeline.entity.cluster.InstanceOffer) InstanceOfferRequestVO(com.epam.pipeline.controller.vo.InstanceOfferRequestVO)

Example 3 with InstanceOfferRequestVO

use of com.epam.pipeline.controller.vo.InstanceOfferRequestVO in project cloud-pipeline by epam.

the class InstanceOfferManager method getPricePerHourForInstance.

public double getPricePerHourForInstance(String instanceType, String regionId) {
    InstanceOfferRequestVO requestVO = new InstanceOfferRequestVO();
    requestVO.setInstanceType(instanceType);
    requestVO.setTermType(ON_DEMAND_TERM_TYPE);
    requestVO.setOperatingSystem(LINUX_OPERATING_SYSTEM);
    requestVO.setTenancy(SHARED_TENANCY);
    requestVO.setUnit(HOURS_UNIT);
    requestVO.setProductFamily(INSTANCE_PRODUCT_FAMILY);
    requestVO.setRegion(regionId);
    return ListUtils.emptyIfNull(instanceOfferDao.loadInstanceOffers(requestVO)).stream().map(InstanceOffer::getPricePerUnit).filter(price -> Double.compare(price, 0.0) > 0).min(Double::compareTo).orElse(0.0);
}
Also used : InstanceOfferRequestVO(com.epam.pipeline.controller.vo.InstanceOfferRequestVO)

Aggregations

InstanceOfferRequestVO (com.epam.pipeline.controller.vo.InstanceOfferRequestVO)3 InstanceOffer (com.epam.pipeline.entity.cluster.InstanceOffer)1