nicoloboschi commented on code in PR #16822:
URL: https://github.com/apache/pulsar/pull/16822#discussion_r947619596
##########
pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/FunctionsImpl.java:
##########
@@ -70,11 +71,13 @@
public class FunctionsImpl extends ComponentResource implements Functions {
private final WebTarget functions;
+ private final WebTarget worker;
private final AsyncHttpClient asyncHttpClient;
public FunctionsImpl(WebTarget web, Authentication auth, AsyncHttpClient
asyncHttpClient, long readTimeoutMs) {
super(auth, readTimeoutMs);
this.functions = web.path("/admin/v3/functions");
+ this.worker = web.path("/admin/v2/worker");
Review Comment:
+1 for `pulsar-admin functions`. However it's a bit weird that the rest
endpoint is under "/worker"
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/Worker.java:
##########
@@ -115,6 +116,21 @@ public List<ConnectorDefinition> getConnectorsList()
throws IOException {
return workers().getListOfConnectors(clientAppId());
}
+ @GET
+ @ApiOperation(
+ value = "Fetches the list of built-in Pulsar functions",
+ response = FunctionDefinition.class,
+ responseContainer = "List"
+ )
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "Get builtin functions
successfully.")
+ })
+ @Path("/builtinfunctions")
Review Comment:
IMO if we want to follow the same as the "/connectors" above this endpoint
should be "/functions"
##########
pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java:
##########
@@ -1310,4 +1312,17 @@ private void parseFullyQualifiedFunctionName(String
fqfn, FunctionConfig functio
}
}
+ @Parameters(commandDescription = "Get the list of Pulsar Functions
supported by Pulsar cluster")
+ public class ListBuiltInFunctions extends BaseCommand {
+ @Override
+ void runCmd() throws Exception {
+ getAdmin().functions().getBuiltInFunctions()
+ .forEach(function -> {
+ System.out.println(function.getName());
Review Comment:
could we create a common method to display this kind of stuff ? (sinks,
sources, functions..)
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/Worker.java:
##########
@@ -115,6 +116,21 @@ public List<ConnectorDefinition> getConnectorsList()
throws IOException {
return workers().getListOfConnectors(clientAppId());
}
+ @GET
+ @ApiOperation(
+ value = "Fetches the list of built-in Pulsar functions",
+ response = FunctionDefinition.class,
+ responseContainer = "List"
+ )
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "Get builtin functions
successfully.")
Review Comment:
what about error responses ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]