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

bxt.command.codedeploy.GetApplications Maven / Gradle / Ivy

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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy