use of io.cdap.cdap.cli.util.RowMaker in project cdap by caskdata.
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);
}
use of io.cdap.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 io.cdap.cdap.cli.util.RowMaker in project cdap by caskdata.
the class GetWorkflowTokenCommand method getWorkflowToken.
private Table getWorkflowToken(ProgramRunId runId, WorkflowToken.Scope workflowTokenScope, String key) throws UnauthenticatedException, IOException, NotFoundException, UnauthorizedException {
WorkflowTokenDetail workflowToken = workflowClient.getWorkflowToken(runId, workflowTokenScope, key);
List<Map.Entry<String, List<WorkflowTokenDetail.NodeValueDetail>>> tokenKeys = new ArrayList<>();
tokenKeys.addAll(workflowToken.getTokenData().entrySet());
return Table.builder().setHeader("token key", "token value").setRows(tokenKeys, new RowMaker<Map.Entry<String, List<WorkflowTokenDetail.NodeValueDetail>>>() {
@Override
public List<?> makeRow(Map.Entry<String, List<WorkflowTokenDetail.NodeValueDetail>> object) {
return Lists.newArrayList(object.getKey(), GSON.toJson(object.getValue()));
}
}).build();
}
use of io.cdap.cdap.cli.util.RowMaker in project cdap by caskdata.
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.RowMaker in project cdap by caskdata.
the class DescribeDatasetModuleCommand method perform.
@Override
public void perform(Arguments arguments, PrintStream output) throws Exception {
DatasetModuleId moduleId = cliConfig.getCurrentNamespace().datasetModule(arguments.get(ArgumentName.DATASET_MODULE.toString()));
DatasetModuleMeta datasetModuleMeta = datasetModuleClient.get(moduleId);
Table table = Table.builder().setHeader("name", "className", "jarLocationPath", "types", "usesModules", "usedByModules").setRows(ImmutableList.of(datasetModuleMeta), new RowMaker<DatasetModuleMeta>() {
@Override
public List<?> makeRow(DatasetModuleMeta object) {
return Lists.newArrayList(object.getName(), object.getClassName(), object.getJarLocationPath(), Joiner.on(", ").join(object.getTypes()), Joiner.on(", ").join(object.getUsesModules()), Joiner.on(", ").join(object.getUsedByModules()));
}
}).build();
cliConfig.getTableRenderer().render(cliConfig, output, table);
}
Aggregations