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

bxt.command.elasticbeanstalk.DescribeEvents Maven / Gradle / Ivy

The newest version!
package bxt.command.elasticbeanstalk;


import bxt.command.Command;
import com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalk;
import com.amazonaws.services.elasticbeanstalk.model.DescribeEventsRequest;
import com.amazonaws.services.elasticbeanstalk.model.EventDescription;
import com.google.common.collect.ImmutableList;
import dagger.Lazy;

import javax.inject.Inject;
import java.io.PrintStream;
import java.util.Comparator;

public final class DescribeEvents implements Command<
        DescribeEventsRequest, ImmutableList> {

    private final Lazy client;

    @Inject
    public DescribeEvents(Lazy client) {
        this.client = client;
    }

    @Override
    public ImmutableList call(DescribeEventsRequest request) {
        return ImmutableList.copyOf(client.get().describeEvents(request).getEvents());
    }

    @Override
    public void prettyPrint(ImmutableList eventDescriptions, PrintStream out) {
        eventDescriptions.stream()
                .sorted(Comparator.comparing(EventDescription::getEventDate).reversed())
                .forEach(ElasticBeanstalkUtils::printEvent);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy