use of io.cdap.cdap.cli.util.table.Table in project cdap by cdapio.
the class StatusProgramsCommand method runBatchCommand.
@Override
protected void runBatchCommand(PrintStream printStream, Args<BatchProgram> args) throws Exception {
List<BatchProgramStatus> results = programClient.getStatus(args.appId.getParent(), args.programs);
Table table = Table.builder().setHeader("name", "type", "status", "error").setRows(results, new RowMaker<BatchProgramStatus>() {
@Override
public List<?> makeRow(BatchProgramStatus result) {
return Lists.newArrayList(result.getProgramId(), result.getProgramType(), result.getStatus(), result.getError());
}
}).build();
cliConfig.getTableRenderer().render(cliConfig, printStream, table);
}
use of io.cdap.cdap.cli.util.table.Table in project cdap by cdapio.
the class StopProgramsCommand method runBatchCommand.
@Override
protected void runBatchCommand(PrintStream printStream, Args<BatchProgram> args) throws Exception {
List<BatchProgramResult> results = programClient.stop(args.appId.getParent(), args.programs);
Table table = Table.builder().setHeader("name", "type", "error").setRows(results, new RowMaker<BatchProgramResult>() {
@Override
public List<?> makeRow(BatchProgramResult result) {
return Lists.newArrayList(result.getProgramId(), result.getProgramType(), result.getError());
}
}).build();
cliConfig.getTableRenderer().render(cliConfig, printStream, table);
}
use of io.cdap.cdap.cli.util.table.Table in project cdap by cdapio.
the class DescribeArtifactCommand method perform.
@Override
public void perform(Arguments arguments, PrintStream output) throws Exception {
String artifactName = arguments.get(ArgumentName.ARTIFACT_NAME.toString());
String artifactVersion = arguments.get(ArgumentName.ARTIFACT_VERSION.toString());
ArtifactId artifactId = cliConfig.getCurrentNamespace().artifact(artifactName, artifactVersion);
String scopeStr = arguments.getOptional(ArgumentName.SCOPE.toString());
ArtifactInfo info;
if (scopeStr == null) {
info = artifactClient.getArtifactInfo(artifactId);
} else {
ArtifactScope scope = ArtifactScope.valueOf(scopeStr.toUpperCase());
info = artifactClient.getArtifactInfo(artifactId, scope);
}
Table table = Table.builder().setHeader("name", "version", "scope", "app classes", "plugin classes", "properties", "parents").setRows(ImmutableList.of((List<String>) ImmutableList.of(info.getName(), info.getVersion(), info.getScope().name(), GSON.toJson(info.getClasses().getApps()), GSON.toJson(info.getClasses().getPlugins()), GSON.toJson(info.getProperties()), Joiner.on('/').join(info.getParents())))).build();
cliConfig.getTableRenderer().render(cliConfig, output, table);
}
use of io.cdap.cdap.cli.util.table.Table in project cdap by cdapio.
the class ListDatasetInstancesCommand method perform.
@Override
public void perform(Arguments arguments, PrintStream output) throws Exception {
List<DatasetSpecificationSummary> datasetMetas = datasetClient.list(cliConfig.getCurrentNamespace());
Table table = Table.builder().setHeader("name", "type", "description").setRows(datasetMetas, new RowMaker<DatasetSpecificationSummary>() {
@Override
public List<?> makeRow(DatasetSpecificationSummary object) {
return Lists.newArrayList(object.getName(), object.getType(), object.getDescription());
}
}).build();
cliConfig.getTableRenderer().render(cliConfig, output, table);
}
use of io.cdap.cdap.cli.util.table.Table in project cdap by cdapio.
the class ListDatasetModulesCommand method perform.
@Override
public void perform(Arguments arguments, PrintStream output) throws Exception {
List<DatasetModuleMeta> modules = client.list(cliConfig.getCurrentNamespace());
Table table = Table.builder().setHeader("name", "className").setRows(modules, new RowMaker<DatasetModuleMeta>() {
@Override
public List<?> makeRow(DatasetModuleMeta object) {
return Lists.newArrayList(object.getName(), object.getClassName());
}
}).build();
cliConfig.getTableRenderer().render(cliConfig, output, table);
}
Aggregations