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

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

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

import com.spotinst.sdkjava.exception.ExceptionHelper;
import com.spotinst.sdkjava.exception.SpotinstHttpException;

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

/**
 * Created by talzur on 11/01/2017.
 */
class SpotinstElastigroupActiveInstanceRepo implements ISpotinstElastigroupActiveInstanceRepo {
    @Override
    public RepoGenericResponse> getAll(ActiveInstanceFilter filter, String authToken, String account) {
        RepoGenericResponse> retVal;

        try {
            List elastigroupActiveInstances = new LinkedList<>();
            List apiElastigroupActiveInstances = SpotinstElastigroupService.getGroupActiveInstances(filter.getElastigroupId(),authToken,account);
            for (ApiElastigroupActiveInstance apiElastigroupActiveInstance : apiElastigroupActiveInstances) {

                ElastigroupActiveInstance elastigroupActiveInstance = ApiElastigroupActiveInstanceConverter.dalToBl(apiElastigroupActiveInstance);
                elastigroupActiveInstances.add(elastigroupActiveInstance);
            }

            retVal = new RepoGenericResponse<>(elastigroupActiveInstances);

        } catch (SpotinstHttpException e) {
            retVal = ExceptionHelper.handleHttpException(e);
        }

        return retVal;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy