Skip to content

Commit

Permalink
[function] Function endpoint admin/v3/functions/{tenant}/{namespace} …
Browse files Browse the repository at this point in the history
…always returns 404 (apache#6767)

Fix apache#6839 
### Motivation

The V3 endpoint that returns a list of all functions in a namespace always returns 404. The V2 version of the endpoint returns the actual list of functions in the namespace. It looks like during the switch from V2 to V3, the implementation for the endpoint was missed. This endpoint is part of the current API [documentation](https://pulsar.apache.org/functions-rest-api/?version=2.5.0#operation/listFunctions), so I don't think it was removed intentionally.

This endpoint is also used by the pulsar-admin command, so that always returns 404:

```
pulsar-admin functions list --tenant chris-kafkaesque-io --namespace local-useast2-aws
HTTP 404 Not Found

Reason: HTTP 404 Not Found
```

### Modifications

I have added the endpoint to `FunctionsApiV3Resource.java`. It is essentially a clone of the V2 version.

### Verifying this change

This is a pretty small change. I have confirmed that the V3 version of the endpoint now returns the same list of functions as the V2 version. I have also confirmed that the pulsar-admin command now works:

```
bin/pulsar-admin functions list --tenant chris-kafkaesque-io --namespace TTL
23:45:10.763 [main] INFO  org.apache.pulsar.common.util.SecurityUtility - Found and Instantiated Bouncy Castle provider in classpath BC
"exclaim"
"pulsar-functions-0.1"
```
  • Loading branch information
cdbartholomew authored May 9, 2020
1 parent 8381371 commit 714a776
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ public FunctionConfig getFunctionInfo(final @PathParam("tenant") String tenant,
return functions.getFunctionInfo(tenant, namespace, functionName, clientAppId(), clientAuthData());
}

@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/{tenant}/{namespace}")
public List<String> listSources(final @PathParam("tenant") String tenant,
final @PathParam("namespace") String namespace) {
return functions.listFunctions(tenant, namespace, clientAppId(), clientAuthData());
}

@GET
@ApiOperation(
value = "Displays the status of a Pulsar Function instance",
Expand Down

0 comments on commit 714a776

Please sign in to comment.