use of io.cdap.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 io.cdap.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);
}
use of io.cdap.cdap.cli.util.RowMaker in project cdap by caskdata.
the class GetServiceEndpointsCommand method perform.
@Override
public void perform(Arguments arguments, PrintStream output) throws Exception {
ServiceId serviceId = new ServiceId(parseProgramId(arguments, ElementType.SERVICE));
List<ServiceHttpEndpoint> endpoints = serviceClient.getEndpoints(serviceId);
Table table = Table.builder().setHeader("method", "path").setRows(endpoints, new RowMaker<ServiceHttpEndpoint>() {
@Override
public List<?> makeRow(ServiceHttpEndpoint endpoint) {
return Lists.newArrayList(endpoint.getMethod(), endpoint.getPath());
}
}).build();
cliConfig.getTableRenderer().render(cliConfig, output, table);
}
use of io.cdap.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 io.cdap.cdap.cli.util.RowMaker in project cdap by caskdata.
the class ListArtifactPluginsCommand 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 pluginType = arguments.get(ArgumentName.PLUGIN_TYPE.toString());
final List<PluginSummary> pluginSummaries;
String scopeStr = arguments.getOptional(ArgumentName.SCOPE.toString());
if (scopeStr == null) {
pluginSummaries = artifactClient.getPluginSummaries(artifactId, pluginType);
} else {
pluginSummaries = artifactClient.getPluginSummaries(artifactId, pluginType, ArtifactScope.valueOf(scopeStr.toUpperCase()));
}
Table table = Table.builder().setHeader("type", "name", "classname", "description", "artifact").setRows(pluginSummaries, new RowMaker<PluginSummary>() {
@Override
public List<?> makeRow(PluginSummary object) {
return Lists.newArrayList(object.getType(), object.getName(), object.getClassName(), object.getDescription(), object.getArtifact().toString());
}
}).build();
cliConfig.getTableRenderer().render(cliConfig, output, table);
}
Aggregations