All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.spotinst.sdkjava.model.ApiElastigroupScalingResponseConverter Maven / Gradle / Ivy

There is a newer version: 1.0.121
Show newest version
package com.spotinst.sdkjava.model;


import java.util.LinkedList;
import java.util.List;

/**
 * Created by talzur on 12/12/2016.
 */
class ApiElastigroupScalingResponseConverter {
    static ElastigroupScalingResponse dalToBl(ApiElastigroupScalingResponse apiElastigroupScalingResponse) {
        ElastigroupScalingResponse retVal = new ElastigroupScalingResponse();
        List newApiInstances = apiElastigroupScalingResponse.getNewInstances();
        List newApiSpotRequests = apiElastigroupScalingResponse.getNewSpotRequests();
        if (newApiInstances != null) {
            List newInstances = new LinkedList<>();
            for (ApiNewInstance newApiInstance : newApiInstances) {
                ElastigroupNewInstance newInstance = new ElastigroupNewInstance();
                newInstance.setAvailabilityZone(newApiInstance.getAvailabilityZone());
                newInstance.setInstanceId(newApiInstance.getInstanceId());
                newInstance.setInstanceType(newApiInstance.getInstanceType());
                newInstances.add(newInstance);
            }
            retVal.setNewInstances(newInstances);
        }
        if (newApiSpotRequests != null) {
            List newSpotRequests = new LinkedList<>();
            for (ApiNewSpotRequest newApiSpotRequest : newApiSpotRequests) {
                ElastigroupNewSpotRequest newSpotRequest = new ElastigroupNewSpotRequest();
                newSpotRequest.setInstanceType(newApiSpotRequest.getInstanceType());
                newSpotRequest.setAvailabilityZone(newApiSpotRequest.getAvailabilityZone());
                newSpotRequest.setSpotInstanceRequestId(newApiSpotRequest.getSpotInstanceRequestId());
                newSpotRequests.add(newSpotRequest);
            }
            retVal.setNewSpotRequests(newSpotRequests);
        }

        return retVal;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy