@Override public void perform(Arguments arguments, PrintStream output) throws Exception { String streamId = arguments.get(ArgumentName.NEW_STREAM.toString()); streamClient.create(streamId); output.printf("Successfully created stream with ID '%s'\n", streamId); }
@Override public void perform(Arguments arguments, PrintStream printStream) throws Exception { String[] programIdParts = arguments.get("app-id.schedule-id").split("\\."); if (programIdParts.length < 2) { throw new CommandInputError(this); } String appId = programIdParts[0]; String scheduleName = programIdParts[1]; Id.Schedule scheduleId = Id.Schedule.from(cliConfig.getCurrentNamespace(), appId, scheduleName); printStream.println(scheduleClient.getStatus(scheduleId)); }
@Override public void perform(Arguments arguments, PrintStream printStream) throws Exception { String[] programIdParts = arguments.get("app-id.schedule-id").split("\\."); if (programIdParts.length < 2) { throw new CommandInputError(this); } String appId = programIdParts[0]; String scheduleName = programIdParts[1]; Id.Schedule schedule = Id.Schedule.from(cliConfig.getCurrentNamespace(), appId, scheduleName); scheduleClient.resume(schedule); printStream.printf("Successfully resumed schedule '%s' in app '%s'\n", scheduleName, appId); }
@Override public void perform(Arguments arguments, PrintStream output) throws Exception { String[] programIdParts = arguments.get(ElementType.WORKFLOW.getArgumentName().toString()).split("\\."); if (programIdParts.length < 2) { throw new CommandInputError(this); } final String appId = programIdParts[0]; String workflowName = programIdParts[1]; Id.Workflow workflowId = Id.Workflow.from(cliConfig.getCurrentNamespace(), appId, workflowName); List<ScheduleSpecification> list = scheduleClient.list(workflowId); Table table = Table.builder() .setHeader( "application", "program", "program type", "name", "type", "description", "properties", "runtime args") .setRows( list, new RowMaker<ScheduleSpecification>() { @Override public List<?> makeRow(ScheduleSpecification object) { return Lists.newArrayList( appId, object.getProgram().getProgramName(), object.getProgram().getProgramType().name(), object.getSchedule().getName(), getScheduleType(object.getSchedule()), object.getSchedule().getDescription(), getScheduleProperties(object.getSchedule()), GSON.toJson(object.getProperties())); } }) .build(); cliConfig.getTableRenderer().render(cliConfig, output, table); }
@Override @SuppressWarnings("deprecation") public void perform(Arguments arguments, PrintStream output) throws Exception { String[] programIdParts = arguments.get(elementType.getArgumentName().toString()).split("\\."); String appId = programIdParts[0]; int instances; switch (elementType) { case FLOWLET: if (programIdParts.length < 3) { throw new CommandInputError(this); } String flowId = programIdParts[1]; String flowletId = programIdParts[2]; instances = programClient.getFlowletInstances(appId, flowId, flowletId); break; case WORKER: if (programIdParts.length < 2) { throw new CommandInputError(this); } String workerId = programIdParts[1]; instances = programClient.getWorkerInstances(appId, workerId); break; case SERVICE: if (programIdParts.length < 2) { throw new CommandInputError(this); } String service = programIdParts[1]; instances = programClient.getServiceInstances(appId, service); break; default: // TODO: remove this throw new IllegalArgumentException( "Unrecognized program element type for scaling: " + elementType); } output.println(instances); }