use of co.cask.cdap.cli.util.RowMaker in project cdap by caskdata.
the class ListDatasetTypesCommand method perform.
@Override
public void perform(Arguments arguments, PrintStream output) throws Exception {
List<DatasetTypeMeta> datasetTypeMetas = datasetTypeClient.list(cliConfig.getCurrentNamespace());
Table table = Table.builder().setHeader("name", "modules").setRows(datasetTypeMetas, new RowMaker<DatasetTypeMeta>() {
@Override
public List<?> makeRow(DatasetTypeMeta object) {
List<String> modulesStrings = Lists.newArrayList();
for (DatasetModuleMeta module : object.getModules()) {
modulesStrings.add(module.getName());
}
return Lists.newArrayList(object.getName(), Joiner.on(", ").join(modulesStrings));
}
}).build();
cliConfig.getTableRenderer().render(cliConfig, output, table);
}
use of co.cask.cdap.cli.util.RowMaker in project cdap by caskdata.
the class ListNamespacesCommand method perform.
@Override
public void perform(Arguments arguments, PrintStream output) throws Exception {
Table table = Table.builder().setHeader("name", "description", "config").setRows(namespaceClient.list(), new RowMaker<NamespaceMeta>() {
@Override
public List<?> makeRow(NamespaceMeta object) {
return Lists.newArrayList(object.getName(), object.getDescription(), NamespaceCommandUtils.prettyPrintNamespaceConfigCLI(object.getConfig()));
}
}).build();
cliConfig.getTableRenderer().render(cliConfig, output, table);
}
use of co.cask.cdap.cli.util.RowMaker in project cdap by caskdata.
the class StartProgramsCommand method runBatchCommand.
@Override
protected void runBatchCommand(PrintStream printStream, Args<BatchProgramStart> args) throws Exception {
List<BatchProgramResult> results = programClient.start(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 co.cask.cdap.cli.util.RowMaker in project cdap by caskdata.
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 co.cask.cdap.cli.util.RowMaker in project cdap by caskdata.
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);
}
Aggregations