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

com.spotinst.sdkjava.model.SpotinstElastigroupInstanceHealthinessRepo 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.List;
import java.util.stream.Collectors;

/**
 * Created by yossi.elman on 13/04/2020.
 */
public class SpotinstElastigroupInstanceHealthinessRepo implements ISpotinstElastigroupInstanceHealthinessRepo {

    @Override
    public RepoGenericResponse> getAll(String elastigroupId, String authToken,
                                                                            String account) {
        RepoGenericResponse> retVal;

        try {
            List instanceHealthinesses;
            List apiInstanceHealthinesses =
                    SpotinstElastigroupService.getInstanceHealthiness(elastigroupId, authToken, account);

            instanceHealthinesses =
                    apiInstanceHealthinesses.stream().map(ApiElastigroupInstanceHealthinessConverter::dalToBl)
                                            .collect(Collectors.toList());

            retVal = new RepoGenericResponse<>(instanceHealthinesses);
        }
        catch (SpotinstHttpException ex) {
            retVal = ExceptionHelper.handleHttpException(ex);
        }

        return retVal;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy