bxt.command.elasticbeanstalk.DescribeEvents Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bxt Show documentation
Show all versions of bxt Show documentation
Command-line tools for Amazon Web Services
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);
}
}