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

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

public class SpotinstElastigroupInstanceStatusRepoGcp implements ISpotinstElastigroupInstanceStatusRepoGcp {

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

        try {
            List groupActiveInstanceStatus;
            List apiGroupActiveInstanceStatus =
                    SpotinstElastigroupServiceGcp.getGroupStatus(elastigroupId, authToken, account);

            groupActiveInstanceStatus =
                    apiGroupActiveInstanceStatus.stream().map(ApiElastigroupInstanceStatusConverterGcp::toBl)
                                            .collect(Collectors.toList());

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

        return retVal;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy