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

com.spotinst.sdkjava.model.SpotinstEventsLogsRepo 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 danielsarisrael on 09/05/2021.
 */
public class SpotinstEventsLogsRepo implements ISpotinstEventsLogsRepo {

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

        try {
            List apiEventsLogs = SpotinstEventsLogsService
                    .getEventsLogs(filter.getFromDate(), filter.getToDate(), filter.getSeverity(),
                                   filter.getResourceId(), filter.getLimit(), filter.getElastigroupId(), authToken,
                                   account);

            List eventsLogs =
                    apiEventsLogs.stream().map(ApiEventsLogsConverter::dalToBl).collect(Collectors.toList());

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

        return retVal;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy