public ServiceId service(String program) { return new ServiceId(this, program); }
public ServiceId service(String program) { return new ServiceId(this, program); }
@Override public ServiceManager getServiceManager(String serviceName) { ServiceId serviceId = new ServiceId(application, serviceName); return new RemoteServiceManager(serviceId, clientConfig, restClient, this); }
@Override public void perform(Arguments arguments, PrintStream output) throws Exception { ServiceId serviceId = new ServiceId(parseProgramId(arguments, ElementType.SERVICE)); Map<String, Integer> routeConfig = serviceClient.getRouteConfig(serviceId); output.printf(GSON.toJson(routeConfig)); }
@Override public void perform(Arguments arguments, PrintStream output) throws Exception { ServiceId serviceId = new ServiceId(parseProgramId(arguments, ElementType.SERVICE)); Map<String, Integer> routeConfig = serviceClient.getRouteConfig(serviceId); output.printf(GSON.toJson(routeConfig)); }
@Override public void perform(Arguments arguments, PrintStream output) throws Exception { ServiceId serviceId = new ServiceId(parseProgramId(arguments, ElementType.SERVICE)); serviceClient.checkAvailability(serviceId); output.println("Service is available to accept requests."); }
@Override public void perform(Arguments arguments, PrintStream output) throws Exception { ServiceId serviceId = new ServiceId(parseProgramId(arguments, ElementType.SERVICE)); serviceClient.checkAvailability(serviceId); output.println("Service is available to accept requests."); }
/** * returns service related metrics * @param namespace * @param applicationId * @param serviceId * @return {@link co.cask.cdap.api.metrics.RuntimeMetrics} */ public RuntimeMetrics getServiceMetrics(String namespace, String applicationId, String serviceId) { ServiceId service = new ServiceId(namespace, applicationId, serviceId); return getMetrics(MetricsTags.service(service), Constants.Metrics.Name.Service.SERVICE_INPUT, Constants.Metrics.Name.Service.SERVICE_PROCESSED, Constants.Metrics.Name.Service.SERVICE_EXCEPTIONS); }
/** * returns service related metrics * @param namespace * @param applicationId * @param serviceId * @return {@link co.cask.cdap.api.metrics.RuntimeMetrics} */ public RuntimeMetrics getServiceMetrics(String namespace, String applicationId, String serviceId) { ServiceId service = new ServiceId(namespace, applicationId, serviceId); return getMetrics(MetricsTags.service(service), Constants.Metrics.Name.Service.SERVICE_INPUT, Constants.Metrics.Name.Service.SERVICE_PROCESSED, Constants.Metrics.Name.Service.SERVICE_EXCEPTIONS); }
private ServiceId deserializeServiceId(JsonObject id) { ProgramId program = deserializeProgramId(id); return new ServiceId(program.getParent(), program.getProgram()); }
@Override public ServiceId toEntityId() { return new ServiceId(super.getNamespaceId(), super.getApplicationId(), super.getId()); }
private ServiceId deserializeServiceId(JsonObject id) { ProgramId program = deserializeProgramId(id); return new ServiceId(program.getParent(), program.getProgram()); }
@Override public ServiceId toEntityId() { return new ServiceId(super.getNamespaceId(), super.getApplicationId(), super.getId()); }
private ServiceId deserializeServiceId(JsonObject id) { ProgramId program = deserializeProgramId(id); return new ServiceId(program.getParent(), program.getProgram()); }
@Override public void perform(Arguments arguments, PrintStream output) throws Exception { ServiceId serviceId = new ServiceId(parseProgramId(arguments, ElementType.SERVICE)); String appName = serviceId.getApplication(); String serviceName = serviceId.getProgram(); serviceClient.deleteRouteConfig(serviceId); output.printf("Successfully deleted route configuration of %s '%s' of application '%s'\n", ElementType.SERVICE.getName(), serviceName, appName); }
@Override public void perform(Arguments arguments, PrintStream output) throws Exception { ServiceId serviceId = new ServiceId(parseProgramId(arguments, ElementType.SERVICE)); String appName = serviceId.getApplication(); String serviceName = serviceId.getProgram(); serviceClient.deleteRouteConfig(serviceId); output.printf("Successfully deleted route configuration of %s '%s' of application '%s'\n", ElementType.SERVICE.getName(), serviceName, appName); }
@Override public void perform(Arguments arguments, PrintStream output) throws Exception { ServiceId serviceId = new ServiceId(parseProgramId(arguments, ElementType.SERVICE)); String routeConfig = arguments.get(ArgumentName.ROUTE_CONFIG.getName()); serviceClient.storeRouteConfig(serviceId, ArgumentParser.parseStringIntegerMap( routeConfig, ArgumentName.ROUTE_CONFIG.toString())); output.printf("Successfully set route configuration of %s '%s' of application '%s' to '%s'\n", ElementType.SERVICE.getName(), serviceId.getProgram(), serviceId.getApplication(), routeConfig); }
@Override public void perform(Arguments arguments, PrintStream output) throws Exception { ServiceId serviceId = new ServiceId(parseProgramId(arguments, ElementType.SERVICE)); String routeConfig = arguments.get(ArgumentName.ROUTE_CONFIG.getName()); serviceClient.storeRouteConfig(serviceId, ArgumentParser.parseStringIntegerMap( routeConfig, ArgumentName.ROUTE_CONFIG.toString())); output.printf("Successfully set route configuration of %s '%s' of application '%s' to '%s'\n", ElementType.SERVICE.getName(), serviceId.getProgram(), serviceId.getApplication(), routeConfig); }
@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); }
@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); }