@Override void runCmd() throws Exception { admin.functions().deleteFunction(tenant, namespace, functionName); print("Deleted successfully"); } }
@Override void runCmd() throws Exception { admin.functions().getConnectorsList().stream().filter(x -> isNotBlank(x.getSinkClass())) .forEach(connector -> { System.out.println(connector.getName()); System.out.println(WordUtils.wrap(connector.getDescription(), 80)); System.out.println("----------------------------------------"); }); } }
@Override void runCmd() throws Exception { String json = Utils.printJson(admin.functions().getFunction(tenant, namespace, functionName)); Gson gson = new GsonBuilder().setPrettyPrinting().create(); System.out.println(gson.toJson(new JsonParser().parse(json))); } }
@Override void runCmd() throws Exception { if (Utils.isFunctionPackageUrlSupported(archive)) { admin.functions().createFunctionWithUrl(SinkConfigUtils.convert(sinkConfig), sinkConfig.getArchive()); } else { admin.functions().createFunction(SinkConfigUtils.convert(sinkConfig), sinkConfig.getArchive()); } print("Created successfully"); } }
@Override void runCmd() throws Exception { String json = Utils.printJson( isBlank(instanceId) ? admin.functions().getFunctionStatus(tenant, namespace, functionName) : admin.functions().getFunctionStatus(tenant, namespace, functionName, Integer.parseInt(instanceId))); Gson gson = new GsonBuilder().setPrettyPrinting().create(); System.out.println(gson.toJson(new JsonParser().parse(json))); } }
@Override void runCmd() throws Exception { print(admin.functions().getFunctions(tenant, namespace)); } }
protected String validateSourceType(String sourceType) throws IOException { Set<String> availableSources; try { availableSources = admin.functions().getSources(); } catch (PulsarAdminException e) { throw new IOException(e); } if (!availableSources.contains(sourceType)) { throw new ParameterException( "Invalid source type '" + sourceType + "' -- Available sources are: " + availableSources); } // Source type is a valid built-in connector type return "builtin://" + sourceType; } }
protected String validateSinkType(String sinkType) throws IOException { Set<String> availableSinks; try { availableSinks = admin.functions().getSinks(); } catch (PulsarAdminException e) { throw new IOException(e); } if (!availableSinks.contains(sinkType)) { throw new ParameterException( "Invalid sink type '" + sinkType + "' -- Available sinks are: " + availableSinks); } // Source type is a valid built-in connector type return "builtin://" + sinkType; } }
@Override void runCmd() throws Exception { // merge deprecated args with new args mergeArgs(); if (StringUtils.isBlank(destinationFile)) { throw new ParameterException("--destination-file needs to be specified"); } admin.functions().downloadFunction(destinationFile, path); print("Downloaded successfully"); } }
@Override void runCmd() throws Exception { if (Utils.isFunctionPackageUrlSupported(this.sourceConfig.getArchive())) { admin.functions().createFunctionWithUrl(SourceConfigUtils.convert(sourceConfig), sourceConfig.getArchive()); } else { admin.functions().createFunction(SourceConfigUtils.convert(sourceConfig), sourceConfig.getArchive()); } print("Created successfully"); } }
@Override void runCmd() throws Exception { if (Utils.isFunctionPackageUrlSupported(functionConfig.getJar())) { admin.functions().createFunctionWithUrl(FunctionConfigUtils.convert(functionConfig, classLoader), functionConfig.getJar()); } else { admin.functions().createFunction(FunctionConfigUtils.convert(functionConfig, classLoader), userCodeFile); } print("Created successfully"); } }
@Override void runCmd() throws Exception { admin.functions().deleteFunction(tenant, namespace, name); print("Delete source successfully"); } }
@Override void runCmd() throws Exception { admin.functions().getConnectorsList().stream().filter(x -> !StringUtils.isEmpty(x.getSourceClass())) .forEach(connector -> { System.out.println(connector.getName()); System.out.println(WordUtils.wrap(connector.getDescription(), 80)); System.out.println("----------------------------------------"); }); } }
@Override void runCmd() throws Exception { admin.functions().deleteFunction(tenant, namespace, name); print("Deleted successfully"); } }