fix allocation spelling error, update docs (#9527)

* fix allocation spelling error, update docs

* assign TopicACLPolicy and TopicACLToken properly
This commit is contained in:
Drew Bailey 2020-12-04 12:04:58 -05:00 committed by GitHub
parent 3934d3daca
commit c0bd238eb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 9 deletions

View file

@ -18,11 +18,11 @@ type Topic string
const ( const (
TopicDeployment Topic = "Deployment" TopicDeployment Topic = "Deployment"
TopicEvaluation Topic = "Evaluation" TopicEvaluation Topic = "Evaluation"
TopicAllocation Topic = "Allococation" TopicAllocation Topic = "Allocation"
TopicJob Topic = "Job" TopicJob Topic = "Job"
TopicNode Topic = "Node" TopicNode Topic = "Node"
TopicACLPolicy Topic = "ACLToken" TopicACLPolicy Topic = "ACLPolicy"
TopicACLToken Topic = "ACLPolicy" TopicACLToken Topic = "ACLToken"
TopicAll Topic = "*" TopicAll Topic = "*"
TypeNodeRegistration = "NodeRegistration" TypeNodeRegistration = "NodeRegistration"

View file

@ -8,10 +8,7 @@ description: |-
# Events HTTP API <sup>Beta</sup> # Events HTTP API <sup>Beta</sup>
The `/event` endpoints are used to stream events and manage event sinks. Event The `/event/stream` endpoint is used to stream events generated by Nomad.
sinks allow for operators to configure a sink (such as a webhook). Nomad will
subscribe to the event stream with the configured sinks topics and send events
to the sink in near real time.
## Event Stream ## Event Stream
@ -26,6 +23,9 @@ The stream will be kept alive until the connection is closed.
The table below shows this endpoint's [required ACLs](/api-docs#acls). Due to The table below shows this endpoint's [required ACLs](/api-docs#acls). Due to
the nature of this endpoint individual topics require specific policies. the nature of this endpoint individual topics require specific policies.
Note that if you do not include a `topic` parameter all topics will be included
by default, requiring a management token.
| Topic | ACL Required | | Topic | ACL Required |
| ------------ | -------------------- | | ------------ | -------------------- |
| `*` | `management` | | `*` | `management` |
@ -43,8 +43,12 @@ the nature of this endpoint individual topics require specific policies.
the requested index is no longer in the buffer the stream will start at the the requested index is no longer in the buffer the stream will start at the
next available index. next available index.
- `namespace` `(string: "default")` - Specifies the target namespace to filter
on. Specifying `*` includes all namespaces for event types that support
namespaces.
- `topic` `(topic:filter_key: "*:*")` - Specifies a topic to subscribe to and - `topic` `(topic:filter_key: "*:*")` - Specifies a topic to subscribe to and
filter on. The default is to subscrive to all topics. Multiple topics may be filter on. The default is to subscribe to all topics. Multiple topics may be
specified by passing multiple `topic` parameters. A valid topic parameter specified by passing multiple `topic` parameters. A valid topic parameter
includes a `topic` type and an optional `filter_key` separated by a colon includes a `topic` type and an optional `filter_key` separated by a colon
`:`. As an example `?topic=Deployment:redis` would subscribe to all `:`. As an example `?topic=Deployment:redis` would subscribe to all
@ -95,15 +99,17 @@ the nature of this endpoint individual topics require specific policies.
### Sample Request ### Sample Request
```shell-session ```shell-session
# Subscribe to all events and topics
$ curl -s -v -N http://127.0.0.1:4646/v1/event/stream $ curl -s -v -N http://127.0.0.1:4646/v1/event/stream
``` ```
```shell-session ```shell-session
# Start at index 100 and subscribe to all Evaluation events
$ curl -s -v -N http://127.0.0.1:4646/v1/event/stream?index=100&topic=Evaluation $ curl -s -v -N http://127.0.0.1:4646/v1/event/stream?index=100&topic=Evaluation
``` ```
```shell-session ```shell-session
$ curl -s -v -N \ $ curl -G -s -v -N \
--data-urlencode "topic=Node:ccc4ce56-7f0a-4124-b8b1-a4015aa82c40" \ --data-urlencode "topic=Node:ccc4ce56-7f0a-4124-b8b1-a4015aa82c40" \
--data-urlencode "topic=Deployment" \ --data-urlencode "topic=Deployment" \
--data-urlencode "topic=Job:web" \ --data-urlencode "topic=Job:web" \