service discovery: add pagination and filtering support to info requests (#12552)

* services: add pagination and filter support to info RPC.
* cli: add filter flag to service info command.
* docs: add pagination and filter details to services info API.
* paginator: minor updates to comment and func signature.
This commit is contained in:
James Rasell
2022-04-13 07:41:44 +02:00
committed by GitHub
parent 36c89f61bb
commit 281a0fb38e
8 changed files with 240 additions and 8 deletions

View File

@@ -77,6 +77,23 @@ The table below shows this endpoint's support for
- `:service_name` `(string: <required>)` - Specifies the service name. This is
specified as part of the path.
- `namespace` `(string: "default")` - Specifies the target namespace. This
parameter is used before any `filter` expression is applied.
- `next_token` `(string: "")` - This endpoint supports paging. The `next_token`
parameter accepts a string which identifies the next expected service. This
value can be obtained from the `X-Nomad-NextToken` header from the previous
response.
- `per_page` `(int: 0)` - Specifies a maximum number of services to return for
this request. If omitted, the response is not paginated. The value of the
`X-Nomad-NextToken` header of the last response can be used as the `next_token`
of the next request to fetch additional pages.
- `filter` `(string: "")` - Specifies the [expression](/api-docs#filtering)
used to filter the results. Consider using pagination or a query parameter to
reduce resource used to serve the request.
### Sample Request
```shell-session