bxt.command.codedeploy.GetApplications 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.codedeploy;
import ansitable.AnsiTable;
import bxt.command.Command;
import com.amazonaws.services.codedeploy.AmazonCodeDeploy;
import com.amazonaws.services.codedeploy.model.ApplicationInfo;
import com.amazonaws.services.codedeploy.model.BatchGetApplicationsRequest;
import com.google.common.collect.ImmutableList;
import dagger.Lazy;
import javax.inject.Inject;
import java.io.PrintStream;
public final class GetApplications implements Command<
BatchGetApplicationsRequest, ImmutableList> {
private final Lazy client;
@Inject
public GetApplications(Lazy client) {
this.client = client;
}
@Override
public ImmutableList call(BatchGetApplicationsRequest request) {
return ImmutableList.copyOf(
client.get().batchGetApplications(request).getApplicationsInfo());
}
@Override
public void prettyPrint(ImmutableList applicationInfos, PrintStream out) {
AnsiTable.builder()
.column("name", ApplicationInfo::getApplicationName)
.column("created", info -> info.getCreateTime().toString())
.column("github", info -> info.isLinkedToGitHub().toString())
.build()
.print(applicationInfos, out);
}
}